Skip to content

Commit

Permalink
Use optinal chain
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt committed Oct 17, 2024
1 parent facd5f4 commit 0f4efce
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions src/client/src/pages/detail/form/location/identifierSegment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,27 @@ const IdentifierSegment = ({ borehole, editingEnabled, updateBorehole }: Identif
{borehole.data.id}
</Grid>
<Grid item xs={1} />
{borehole.data.custom.identifiers &&
borehole.data.custom.identifiers.map(identifier => (
<>
<Grid item xs={6}>
<DomainText id={identifier.id} schema="borehole_identifier" />
</Grid>
<Grid item xs={5}>
{identifier.value}
</Grid>
<Grid item xs={1} sx={{ pt: "0 !important", textAlign: "right" }}>
{editingEnabled && (
<IconButton
onClick={() => {
removeEntry(identifier);
}}
data-cy="identifier-delete">
{<Trash2 size={16} />}
</IconButton>
)}
</Grid>
</>
))}
{borehole.data.custom.identifiers?.map(identifier => (
<>
<Grid item xs={6}>
<DomainText id={identifier.id} schema="borehole_identifier" />
</Grid>
<Grid item xs={5}>
{identifier.value}
</Grid>
<Grid item xs={1} sx={{ pt: "0 !important", textAlign: "right" }}>
{editingEnabled && (
<IconButton
onClick={() => {
removeEntry(identifier);
}}
data-cy="identifier-delete">
{<Trash2 size={16} />}
</IconButton>
)}
</Grid>
</>
))}
</Grid>
{editingEnabled && (
<Grid container spacing={2} sx={{ mt: 1 }}>
Expand Down

0 comments on commit 0f4efce

Please sign in to comment.