Skip to content

Commit e225e96

Browse files
committed
refactor: display N/A when modality list is empty or missing in dataset results; refs #40
1 parent b0200b2 commit e225e96

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

src/components/SearchPage/DatasetCard.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,25 @@ const DatasetCard: React.FC<DatasetCardProps> = ({
7676
<Typography variant="body2" mt={1}>
7777
<strong>Modalities:</strong>
7878
</Typography>
79-
{modality?.map((mod, idx) => (
80-
<Chip
81-
key={idx}
82-
label={mod}
83-
variant="outlined"
84-
sx={{
85-
color: Colors.darkPurple,
86-
border: `1px solid ${Colors.darkPurple}`,
87-
fontWeight: "bold",
88-
}}
89-
/>
90-
))}
79+
80+
{Array.isArray(modality) && modality.length > 0 ? (
81+
modality.map((mod, idx) => (
82+
<Chip
83+
key={idx}
84+
label={mod}
85+
variant="outlined"
86+
sx={{
87+
color: Colors.darkPurple,
88+
border: `1px solid ${Colors.darkPurple}`,
89+
fontWeight: "bold",
90+
}}
91+
/>
92+
))
93+
) : (
94+
<Typography variant="body2" mt={1}>
95+
N/A
96+
</Typography>
97+
)}
9198
</Stack>
9299

93100
<Stack direction="row" spacing={1} flexWrap="wrap" gap={1}>

0 commit comments

Comments
 (0)