Skip to content

Commit

Permalink
feat(grower-detail): display device manufacturer with device id (Gree…
Browse files Browse the repository at this point in the history
…nstand#196)

* feat(grower-detail): display device manufacturer with device id

* feat(grower-detail): display device manufacturer with device id
  • Loading branch information
gwynndp authored Nov 24, 2021
1 parent 6fef653 commit ba9158f
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/components/GrowerDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ const GrowerDetail = (props) => {
setGrowerRegistrations(sortedRegistrations);
setDeviceIdentifiers(
sortedRegistrations
.map((reg) => reg.device_identifier)
.map((reg) => ({
id: reg.device_identifier,
os:
reg.manufacturer.toLowerCase() === 'apple'
? 'iOS'
: 'Android',
}))
.filter((id) => id),
);
}
Expand Down Expand Up @@ -247,12 +253,22 @@ const GrowerDetail = (props) => {
<Typography variant="subtitle1">
Device Identifier{deviceIdentifiers.length >= 2 ? 's' : ''}
</Typography>
{(deviceIdentifiers.length &&
deviceIdentifiers.map((identifier, index) => (
<Typography variant="body1" key={index}>
{identifier}
</Typography>
))) || <Typography variant="body1">---</Typography>}
{(deviceIdentifiers.length && (
<table>
<tbody>
{deviceIdentifiers.map((device, i) => (
<tr key={i}>
<td>
<Typography variant="body1">{device.id}</Typography>
</td>
<td>
<Typography variant="body1">({device.os})</Typography>
</td>
</tr>
))}
</tbody>
</table>
)) || <Typography variant="body1">---</Typography>}
</Grid>
</Grid>
</Grid>
Expand Down

0 comments on commit ba9158f

Please sign in to comment.