Skip to content

Commit

Permalink
Add conditional rendering of metadata tables
Browse files Browse the repository at this point in the history
  • Loading branch information
o-jorgensen committed Sep 24, 2024
1 parent bcb53f4 commit 4862aef
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,47 +109,49 @@ export const GrossDepositionEnviromentGroup = ({
<Typography variant="h4" as="h3">
Gross Depositional Environment (GDE)
</Typography>
<Table>
<Table.Head>
<Table.Row>
<Table.Cell></Table.Cell>
<Table.Cell>GDE</Table.Cell>
<Table.Cell>Depositional environment</Table.Cell>
<Table.Cell>Subenvironment</Table.Cell>
<Table.Cell>Architectural element</Table.Cell>
</Table.Row>
</Table.Head>

<Table.Body>
{gdeGroups.map((row) => (
<Table.Row key={row.geologicalGroupId}>
<Table.Cell>
<Button
variant="ghost_icon"
onClick={() => deleteGdeRow(row.geologicalGroupId)}
>
<Icon
data={deleteIcon}
title={'Delete gross deposition enviroment row'}
/>
</Button>
</Table.Cell>
<Table.Cell>{row.grossDepEnv.identifier}</Table.Cell>
<Table.Cell>{row.depEnv.identifier}</Table.Cell>
<Table.Cell>{row.subenv.identifier}</Table.Cell>
<Table.Cell>
{row.architecturalElements.length > 0 && (
<ul>
{row.architecturalElements.map((a) => (
<li key={a.geologicalStandardId}>{a.identifier}</li>
))}
</ul>
)}
</Table.Cell>
{gdeGroups.length > 0 && (
<Table>
<Table.Head>
<Table.Row>
<Table.Cell></Table.Cell>
<Table.Cell>GDE</Table.Cell>
<Table.Cell>Depositional environment</Table.Cell>
<Table.Cell>Subenvironment</Table.Cell>
<Table.Cell>Architectural element</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table>
</Table.Head>

<Table.Body>
{gdeGroups.map((row) => (
<Table.Row key={row.geologicalGroupId}>
<Table.Cell>
<Button
variant="ghost_icon"
onClick={() => deleteGdeRow(row.geologicalGroupId)}
>
<Icon
data={deleteIcon}
title={'Delete gross deposition enviroment row'}
/>
</Button>
</Table.Cell>
<Table.Cell>{row.grossDepEnv.identifier}</Table.Cell>
<Table.Cell>{row.depEnv.identifier}</Table.Cell>
<Table.Cell>{row.subenv.identifier}</Table.Cell>
<Table.Cell>
{row.architecturalElements.length > 0 && (
<ul>
{row.architecturalElements.map((a) => (
<li key={a.geologicalStandardId}>{a.identifier}</li>
))}
</ul>
)}
</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table>
)}
<div>
<Button variant="outlined" onClick={handleGdeDialog}>
Add GDE…
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,47 +82,51 @@ export const OutcropAnalogueGroup = ({
<Typography variant="h4" as="h3">
Outcrop Analogue
</Typography>
<Table>
<Table.Head>
<Table.Row>
<Table.Cell></Table.Cell>
<Table.Cell>Analogue</Table.Cell>
<Table.Cell>Region</Table.Cell>
<Table.Cell>Basin</Table.Cell>
<Table.Cell>Category</Table.Cell>
</Table.Row>
</Table.Head>
<Table.Body>
{outcropGroup.map((row) => (
<Table.Row key={row.outcropId}>
<Table.Cell>
<Button
variant="ghost_icon"
onClick={() =>
handleDeleteOutcropAnalogue(
row.outcropId ? row.outcropId : 'none',
)
}
>
<Icon data={deleteIcon} title={'Delete strat column row'} />
</Button>
</Table.Cell>
<Table.Cell>
<Styled.StratColCell>{row.name}</Styled.StratColCell>
</Table.Cell>
<Table.Cell>{row.region}</Table.Cell>
<Table.Cell>
<Styled.StratColCell>
{row.basins?.map((item) => item)}
</Styled.StratColCell>
</Table.Cell>
<Table.Cell>
<Styled.StratColCell>{row.outcropCategory}</Styled.StratColCell>
</Table.Cell>
{outcropGroup.length > 0 && (
<Table>
<Table.Head>
<Table.Row>
<Table.Cell></Table.Cell>
<Table.Cell>Analogue</Table.Cell>
<Table.Cell>Region</Table.Cell>
<Table.Cell>Basin</Table.Cell>
<Table.Cell>Category</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table>
</Table.Head>
<Table.Body>
{outcropGroup.map((row) => (
<Table.Row key={row.outcropId}>
<Table.Cell>
<Button
variant="ghost_icon"
onClick={() =>
handleDeleteOutcropAnalogue(
row.outcropId ? row.outcropId : 'none',
)
}
>
<Icon data={deleteIcon} title={'Delete strat column row'} />
</Button>
</Table.Cell>
<Table.Cell>
<Styled.StratColCell>{row.name}</Styled.StratColCell>
</Table.Cell>
<Table.Cell>{row.region}</Table.Cell>
<Table.Cell>
<Styled.StratColCell>
{row.basins?.map((item) => item)}
</Styled.StratColCell>
</Table.Cell>
<Table.Cell>
<Styled.StratColCell>
{row.outcropCategory}
</Styled.StratColCell>
</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table>
)}
<div>
<Button variant="outlined" onClick={handleOutcropDialog}>
Add outcrop analogue…
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,72 +32,75 @@ export const StratigrapicGroups = ({
Stratigraphic column
</Typography>

<Table>
<Table.Head>
<Table.Row>
<Table.Cell></Table.Cell>
<Table.Cell>Country</Table.Cell>
<Table.Cell>Field</Table.Cell>
<Table.Cell>Stratigraphic column</Table.Cell>
<Table.Cell>Level 1 (group)</Table.Cell>
<Table.Cell>Level 2 (formation)</Table.Cell>
<Table.Cell>Level 3 (formation/subzone)</Table.Cell>
</Table.Row>
</Table.Head>
{stratColumnGroups.length > 0 && (
<Table>
<Table.Head>
<Table.Row>
<Table.Cell></Table.Cell>
<Table.Cell>Country</Table.Cell>
<Table.Cell>Field</Table.Cell>
<Table.Cell>Stratigraphic column</Table.Cell>
<Table.Cell>Level 1 (group)</Table.Cell>
<Table.Cell>Level 2 (formation)</Table.Cell>
<Table.Cell>Level 3 (formation/subzone)</Table.Cell>
</Table.Row>
</Table.Head>

<Table.Body>
{stratColumnGroups.map((row) => (
<Table.Row key={row.stratigraphicGroupId}>
<Table.Cell>
<Button
variant="ghost_icon"
onClick={() => deleteRow(row.stratigraphicGroupId)}
>
<Icon data={deleteIcon} title={'Delete strat column row'} />
</Button>
</Table.Cell>
<Table.Cell>{row.country.identifier}</Table.Cell>
<Table.Cell>
<Styled.StratColCell>
{row.field.identifier}
</Styled.StratColCell>
</Table.Cell>
<Table.Cell>
<Styled.StratColCell>
{row.stratColumn.identifier}
</Styled.StratColCell>
</Table.Cell>
{filterUnitLevel(row, 1).length > 0 ? (
<Table.Body>
{stratColumnGroups.map((row) => (
<Table.Row key={row.stratigraphicGroupId}>
<Table.Cell>
<Styled.StratColCell>
{filterUnitLevel(row, 1)[0].identifier}
</Styled.StratColCell>
<Button
variant="ghost_icon"
onClick={() => deleteRow(row.stratigraphicGroupId)}
>
<Icon data={deleteIcon} title={'Delete strat column row'} />
</Button>
</Table.Cell>
) : (
<Table.Cell>-</Table.Cell>
)}
{filterUnitLevel(row, 2).length > 0 ? (
<Table.Cell>{row.country.identifier}</Table.Cell>
<Table.Cell>
<Styled.StratColCell>
{filterUnitLevel(row, 2)[0].identifier}
{row.field.identifier}
</Styled.StratColCell>
</Table.Cell>
) : (
<Table.Cell>-</Table.Cell>
)}
{filterUnitLevel(row, 3).length > 0 ? (
<Table.Cell>
<Styled.StratColCell>
{filterUnitLevel(row, 3)[0].identifier}
{row.stratColumn.identifier}
</Styled.StratColCell>
</Table.Cell>
) : (
<Table.Cell>-</Table.Cell>
)}
</Table.Row>
))}
</Table.Body>
</Table>
{filterUnitLevel(row, 1).length > 0 ? (
<Table.Cell>
<Styled.StratColCell>
{filterUnitLevel(row, 1)[0].identifier}
</Styled.StratColCell>
</Table.Cell>
) : (
<Table.Cell>-</Table.Cell>
)}
{filterUnitLevel(row, 2).length > 0 ? (
<Table.Cell>
<Styled.StratColCell>
{filterUnitLevel(row, 2)[0].identifier}
</Styled.StratColCell>
</Table.Cell>
) : (
<Table.Cell>-</Table.Cell>
)}
{filterUnitLevel(row, 3).length > 0 ? (
<Table.Cell>
<Styled.StratColCell>
{filterUnitLevel(row, 3)[0].identifier}
</Styled.StratColCell>
</Table.Cell>
) : (
<Table.Cell>-</Table.Cell>
)}
</Table.Row>
))}
</Table.Body>
</Table>
)}

<div>
<Button variant="outlined" onClick={handleStratColDialog}>
Add stratigraphic column…
Expand Down

0 comments on commit 4862aef

Please sign in to comment.