diff --git a/client/src/components/infoDrawer/infoDrawer.js b/client/src/components/infoDrawer/infoDrawer.js
index 57bfd77b..9f41ef14 100644
--- a/client/src/components/infoDrawer/infoDrawer.js
+++ b/client/src/components/infoDrawer/infoDrawer.js
@@ -1,13 +1,9 @@
import React, { PureComponent } from "react";
-import { connect, shallowEqual } from "react-redux";
+import { connect } from "react-redux";
import { Drawer } from "@blueprintjs/core";
-import Async from "react-async";
import InfoFormat from "./infoFormat";
-import {
- selectableCategoryNames,
- createCategorySummaryFromDfCol,
-} from "../../util/stateManager/controlsHelpers";
+import { selectableCategoryNames } from "../../util/stateManager/controlsHelpers";
@connect((state) => {
return {
@@ -20,44 +16,6 @@ import {
};
})
class InfoDrawer extends PureComponent {
- static watchAsync(props, prevProps) {
- return !shallowEqual(props.watchProps, prevProps.watchProps);
- }
-
- fetchAsyncProps = async (props) => {
- const { schema } = props.watchProps;
- const { annoMatrix } = this.props;
-
- const allCategoryNames = selectableCategoryNames(schema).sort();
-
- const nonUserAnnoCategories = allCategoryNames.map((catName) => {
- const isUserAnno = schema?.annotations?.obsByName[catName]?.writable;
- if (!isUserAnno) return annoMatrix.fetch("obs", catName);
- return null;
- });
- const singleValueCategories = (
- await Promise.all(nonUserAnnoCategories)
- ).reduce((acc, categoryData, i) => {
- // Actually check to see if it is null(user anno)
- if (!categoryData) return acc;
- const catName = allCategoryNames[i];
-
- const column = categoryData.icol(0);
- const colSchema = schema.annotations.obsByName[catName];
-
- const categorySummary = createCategorySummaryFromDfCol(column, colSchema);
-
- const { numCategoryValues } = categorySummary;
- // Add to the array if the category has only one value
- if (numCategoryValues === 1) {
- acc.set(catName, categorySummary.allCategoryValues[0]);
- }
- return acc;
- }, new Map());
-
- return { singleValueCategories };
- };
-
handleClose = () => {
const { dispatch } = this.props;
@@ -74,45 +32,31 @@ class InfoDrawer extends PureComponent {
dataPortalProps,
} = this.props;
+ const allCategoryNames = selectableCategoryNames(schema).sort();
+ const singleValueCategories = new Map();
+
+ allCategoryNames.forEach((catName) => {
+ const isUserAnno = schema?.annotations?.obsByName[catName]?.writable;
+ const colSchema = schema.annotations.obsByName[catName];
+ if (!isUserAnno && colSchema.categories?.length === 1) {
+ singleValueCategories.set(catName, colSchema.categories[0]);
+ }
+ });
+
return (
+
{contributors.map((contributor) => { const { email, name, institution } = contributor; @@ -22,7 +22,7 @@ const renderContributors = (contributors, affiliations, skeleton) => { ); })}
- {renderAffiliations(affiliations, skeleton)} + {renderAffiliations(affiliations)} > ); }; @@ -39,14 +39,14 @@ const buildAffiliations = (contributors = []) => { return affiliations; }; -const renderAffiliations = (affiliations, skeleton) => { +const renderAffiliations = (affiliations) => { if (affiliations.length === 0) return null; return ( <> -+
{doi} @@ -71,12 +71,12 @@ const renderDOILink = (type, doi, skeleton) => { ); }; -const renderOrganism = (organism, skeleton) => { +const renderOrganism = (organism) => { if (!organism) return null; return ( <> -
{organism}
+{organism}
> ); }; @@ -85,11 +85,11 @@ const ONTOLOGY_KEY = "ontology_term_id"; const CAT_WIDTH = "30%"; const VAL_WIDTH = "35%"; // Render list of metadata attributes found in categorical field -const renderSingleValueCategories = (singleValueCategories, skeleton) => { +const renderSingleValueCategories = (singleValueCategories) => { if (singleValueCategories.size === 0) return null; return ( <> -- + {aboutURL}
@@ -179,24 +167,14 @@ const renderLinks = (projectLinks, aboutURL, skeleton) => { ); }; -const NUM_CATEGORIES = 8; - -// Generates arbitrary placeholder array for singleValueCategories skeleton shape -const singleValueCategoriesPlaceholder = Array.from(Array(NUM_CATEGORIES)).map( - (_, index) => { - return [index, index]; - } -); - const InfoFormat = React.memo( ({ datasetTitle, - singleValueCategories = new Map(singleValueCategoriesPlaceholder), - aboutURL = "thisisabouthtelengthofaurl", + singleValueCategories, + aboutURL, dataPortalProps = {}, - skeleton = false, }) => { - if (dataPortalProps.corpora_schema_version === "1.0.0") { + if (dataPortalProps.version?.["corpora_schema_version"] !== "1.0.0") { dataPortalProps = {}; } const { @@ -212,15 +190,13 @@ const InfoFormat = React.memo( return (