Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resize export radio buttons and fix empty cohort summaries #997

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 54 additions & 41 deletions ui/src/cohortSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,64 @@ export type CohortSummaryProps = {
};

export function CohortSummary(props: CohortSummaryProps) {
let hasCriteria = false;
props.cohort?.groupSections?.forEach((gs) => {
gs.groups.forEach((g) => {
if (g.criteria.length) {
hasCriteria = true;
}
});
});

return (
<GridLayout rows height="auto">
{props.cohort.groupSections.map((s, si) => (
<GridLayout key={s.id} rows height="auto">
<Typography
variant="body2em"
component="p"
sx={{ "::first-letter": { textTransform: "capitalize" } }}
>
{si != 0 ? "and " : ""}
{s.filter.excluded ? "exclude " : "include "}participants with
{s.filter.kind === GroupSectionFilterKind.Any ? " any " : " all "}
of the following criteria:
</Typography>
{s.groups.map((g, gi) => (
<GridBox key={g.id} sx={{ height: "auto" }}>
<Typography variant="body2" component="span">
{getCriteriaTitleFull(g.criteria[0])}
</Typography>
{g.criteria.length > 1 ? (
<span>
{!hasCriteria ? (
<Typography variant="body2em">All participants</Typography>
) : (
props.cohort.groupSections.map((s, si) => (
<GridLayout key={s.id} rows height="auto">
<Typography
variant="body2em"
component="p"
sx={{ "::first-letter": { textTransform: "capitalize" } }}
>
{si != 0 ? "and " : ""}
{s.filter.excluded ? "exclude " : "include "}participants with
{s.filter.kind === GroupSectionFilterKind.Any ? " any " : " all "}
of the following criteria:
</Typography>
{s.groups.map((g, gi) => (
<GridBox key={g.id} sx={{ height: "auto" }}>
<Typography variant="body2" component="span">
{getCriteriaTitleFull(g.criteria[0])}
</Typography>
{g.criteria.length > 1 ? (
<span>
<Typography variant="body2em" component="span">
{" where "}
</Typography>
<Typography variant="body2" component="span">
{g.criteria
.slice(1)
.map((c) =>
getCriteriaTitle(c, getCriteriaPlugin(c, g.entity))
)
.join(", ")}
</Typography>
</span>
) : null}
{gi != s.groups.length - 1 ? (
<Typography variant="body2em" component="span">
{" where "}
{s.filter.kind === GroupSectionFilterKind.Any
? " or "
: " and "}
</Typography>
<Typography variant="body2" component="span">
{g.criteria
.slice(1)
.map((c) =>
getCriteriaTitle(c, getCriteriaPlugin(c, g.entity))
)
.join(", ")}
</Typography>
</span>
) : null}
{gi != s.groups.length - 1 ? (
<Typography variant="body2em" component="span">
{s.filter.kind === GroupSectionFilterKind.Any
? " or "
: " and "}
</Typography>
) : null}
</GridBox>
))}
</GridLayout>
))}
) : null}
</GridBox>
))}
</GridLayout>
))
)}
</GridLayout>
);
}
3 changes: 2 additions & 1 deletion ui/src/export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -860,11 +860,12 @@ function ExportDialog(
<DialogContent>
{stage === ExportDialogStage.MODEL_SELECT ? (
<Loading status={exportModelsState}>
<FormControl>
<FormControl sx={{ width: "100%" }}>
<RadioGroup
value={model?.id ?? ""}
onChange={onSelectModel}
sx={{
width: "100%",
gap: 1,
}}
>
Expand Down