Skip to content

Commit

Permalink
Fixed some small bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Emil Balitzki <[email protected]>
  • Loading branch information
Corgam committed Jul 13, 2024
1 parent 7ba29cf commit df9d608
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
24 changes: 15 additions & 9 deletions frontend/src/components/DataView/DataRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const DataRow: React.FC<RowProps> = ({ row, currentDatasets }) => {
return (
<Fragment>
<TableRow className="data-row">
{row.subdata.length > 0 ? (
{row.subdata && row.subdata.length > 0 ? (
<TableCell className="toggle-column" size="small">
<IconButton
aria-label="expand row"
Expand Down Expand Up @@ -155,14 +155,20 @@ const DataRow: React.FC<RowProps> = ({ row, currentDatasets }) => {
<Collapse in={open} timeout="auto" unmountOnExit>
<Table size="small" aria-label="subdata">
<TableBody className="subdata-rows-container">
{row.subdata.map((subItem) => (
<TableRow key={subItem.key}>
<TableCell component="th" scope="row" size="small">
{subItem.key}
</TableCell>
<TableCell size="small">{subItem.value}</TableCell>
</TableRow>
))}
{row.subdata ? (
<div>
{row.subdata.map((subItem) => (
<TableRow key={subItem.key}>
<TableCell component="th" scope="row" size="small">
{subItem.key}
</TableCell>
<TableCell size="small">{subItem.value}</TableCell>
</TableRow>
))}
</div>
) : (
<div></div>
)}
</TableBody>
</Table>
</Collapse>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/DataView/DataView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const DataView = () => {
<TableBody>
{filterData(data?.selectionData ?? []).map((row) => (
<DataRow
key={row.datasetID}
key={row.displayName + row.value + row.coordinate}
row={row}
currentDatasets={currentDatasets}
/>
Expand All @@ -241,7 +241,7 @@ const DataView = () => {
<TableBody>
{filterData(data?.individualData ?? []).map((row) => (
<DataRow
key={row.datasetID}
key={row.displayName + row.value + row.coordinate}
row={row}
currentDatasets={currentDatasets}
/>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types/LocationDataTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface DatasetItem {
value: string | null;
datasetID: string | null;
coordinate: number[] | null;
subdata: SubdataItem[];
subdata: SubdataItem[] | null;
}

/**
Expand Down

0 comments on commit df9d608

Please sign in to comment.