Skip to content

Commit

Permalink
fix data-type summaries
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Aug 10, 2023
1 parent f786d6f commit 9eb8dbf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/datasets/datatype/DataTypeSummaryModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ import VariantSummary from "./VariantSummary";
import { useSelector } from "react-redux";

const DataTypeSummaryModal = ({dataType, summary, onCancel, visible}) => {
summary = summary || {};
dataType = dataType || {};
if (!dataType) {
return <></>;
}

const isFetchingSummaries = useSelector((state) => state.datasetDataTypes.isFetching);

let Summary = GenericSummary;
let summaryData = summary;
switch (dataType.id) {
case "variant":
// TODO: variant summary
Summary = VariantSummary;
break;
case "phenopacket":
Summary = PhenopacketSummary;
break;
default:
summaryData = summary ?? dataType;
}

return <>
Expand All @@ -32,9 +35,9 @@ const DataTypeSummaryModal = ({dataType, summary, onCancel, visible}) => {
<Tag>{dataType.id}</Tag>
</>}
>
{(!summary || isFetchingSummaries)
{(!summaryData || isFetchingSummaries)
? <Skeleton/>
: <Summary summary={summary}/>}
: <Summary summary={summaryData}/>}
</Modal>
</>;
};
Expand Down

0 comments on commit 9eb8dbf

Please sign in to comment.