feat: remove info drawer and reintroduce singleton categories (#2421)

* refactor: drop non-session auth from frontend

* remove dataset drawer and reintroduce singleton values
This commit is contained in:
Severiano Badajoz
2021-09-20 16:58:55 +00:00
committed by GitHub
parent ef2ab07ca0
commit f49c3d8fe7
6 changed files with 27 additions and 297 deletions
@@ -494,12 +494,23 @@ const CategoryRender = React.memo(
*/
const { numCategoryValues } = categorySummary;
const isSingularValue = !isUserAnno && numCategoryValues === 1;
if (isSingularValue) {
/*
Entire category has a single value, special case.
*/
return null;
const theOneValue = categorySummary.categoryValues[0];
return (
<div style={{ marginBottom: 10, marginTop: 4 }}>
<Truncate>
<span style={{ maxWidth: 150, fontWeight: 700 }}>
{metadataField}
</span>
</Truncate>
<Truncate>
<span style={{ maxWidth: 150 }}>{`: ${theOneValue}`}</span>
</Truncate>
</div>
);
}
/*
+11 -12
View File
@@ -193,18 +193,17 @@ class Categories extends React.Component {
{/* READ ONLY CATEGORICAL FIELDS */}
{/* this is duplicative but flat, could be abstracted */}
{allCategoryNames.map((catName) =>
!schema.annotations.obsByName[catName].writable &&
(schema.annotations.obsByName[catName].categories?.length > 1 ||
!schema.annotations.obsByName[catName].categories) ? (
<Category
key={catName}
metadataField={catName}
onExpansionChange={this.onExpansionChange}
isExpanded={expandedCats.has(catName)}
createAnnoModeActive={createAnnoModeActive}
/>
) : null
{allCategoryNames.map(
(catName) =>
!schema.annotations.obsByName[catName].writable && (
<Category
key={catName}
metadataField={catName}
onExpansionChange={this.onExpansionChange}
isExpanded={expandedCats.has(catName)}
createAnnoModeActive={createAnnoModeActive}
/>
)
)}
{/* WRITEABLE FIELDS */}
{allCategoryNames.map((catName) =>