Skip to content

Commit e1923d2

Browse files
committed
feat: implement new measures visibility
1 parent 5bb3095 commit e1923d2

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

packages/instrument-renderer/src/components/InstrumentSummary/InstrumentSummary.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ export const InstrumentSummary = ({ data, instrument, subject, timeCollected }:
2828
}
2929

3030
const computedMeasures = filter(computeInstrumentMeasures(instrument, data), (_, key) => {
31-
return !instrument.measures?.[key]!.hidden;
31+
const measure = instrument.measures?.[key];
32+
if (measure?.visibility === 'hidden' || measure?.hidden === true) {
33+
return false;
34+
} else if (measure?.visibility === 'visible' || measure?.visibility === false) {
35+
return true;
36+
}
37+
return instrument.defaultMeasureVisibility === 'visible';
3238
});
3339

3440
const handleDownload = () => {
@@ -62,15 +68,17 @@ export const InstrumentSummary = ({ data, instrument, subject, timeCollected }:
6268
timeStyle: 'long'
6369
});
6470

71+
const title = (instrument.clientDetails?.title ?? instrument.details.title).trim();
72+
6573
return (
6674
<div className="print:bg-primary-foreground space-y-6 print:fixed print:left-0 print:top-0 print:z-50 print:h-screen print:w-screen">
6775
<div className="flex">
6876
<div className="flex-grow">
6977
<Heading variant="h4">
70-
{instrument.details.title.trim()
78+
{title
7179
? t({
72-
en: `Summary of Results for the ${instrument.details.title}`,
73-
fr: `${instrument.details.title} : résumé des résultats`
80+
en: `Summary of Results for the ${title}`,
81+
fr: `${title} : résumé des résultats`
7482
})
7583
: t({
7684
en: 'Summary of Results',
@@ -163,7 +171,7 @@ export const InstrumentSummary = ({ data, instrument, subject, timeCollected }:
163171
en: 'Title',
164172
fr: 'Titre'
165173
}),
166-
value: instrument.details.title
174+
value: title
167175
},
168176
{
169177
label: t({

0 commit comments

Comments
 (0)