diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-07-02 22:15:01 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2024-07-02 22:15:01 -0600 |
commit | f574d9c1c9fa89788838faf0b1a39a0e7d4c6755 (patch) | |
tree | 100a5610cf7f603ba607b58fa3bffc69b54125aa /src/main/DeviceRow.jsx | |
parent | 5f064d0a7743abdd9ffe645de1ffd55bb5c4f72f (diff) | |
download | trackermap-web-f574d9c1c9fa89788838faf0b1a39a0e7d4c6755.tar.gz trackermap-web-f574d9c1c9fa89788838faf0b1a39a0e7d4c6755.tar.bz2 trackermap-web-f574d9c1c9fa89788838faf0b1a39a0e7d4c6755.zip |
Re-add position details to DeviceRow, this time statically
Diffstat (limited to 'src/main/DeviceRow.jsx')
-rw-r--r-- | src/main/DeviceRow.jsx | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/main/DeviceRow.jsx b/src/main/DeviceRow.jsx index b7c2646e..7edf64f7 100644 --- a/src/main/DeviceRow.jsx +++ b/src/main/DeviceRow.jsx @@ -74,7 +74,7 @@ const DeviceRow = ({ data, index, style }) => { const deviceSecondary = useAttributePreference('deviceSecondary', ''); const positionAttributes = usePositionAttributes(t); - const positionItems = useAttributePreference('positionItems', 'speed,address,totalDistance,course'); + const positionItems = ['speed', 'address', 'hours', 'serverTime']; const primaryText = () => { // RATIONALE: we connect output/out1 to engine lock @@ -115,6 +115,33 @@ const DeviceRow = ({ data, index, style }) => { return ( <> {deviceSecondary && item[deviceSecondary] && item[deviceSecondary]} + {/* RATIONALE: clients want more info in the list */} + {positionItems.map((attr) => { + if (position && (position.hasOwnProperty(attr) || position.attributes.hasOwnProperty(attr))) { + return ( + <AttrItem + key={attr} + attr={attr} + name={positionAttributes[attr]?.name || attr} + content={( + <PositionValue + position={position} + property={position.hasOwnProperty(attr) ? attr : null} + attribute={position.hasOwnProperty(attr) ? null : attr} + /> + )} + /> + ); + } + + return ( + <AttrItem + key={attr} + attr={attr} + name={positionAttributes[attr]?.name || attr} + /> + ); + })} </> ); }; @@ -187,13 +214,11 @@ const DeviceRow = ({ data, index, style }) => { const AttrItem = ({ attr, name, content }) => { const attrIcon = () => { switch(attr) { - case "address": return <PlaceIcon fontSize="inherit" />; - case "deviceTime": return <ScheduleIcon fontSize="inherit" />; - case "fixTime": return <ScheduleIcon fontSize="inherit" />; - case "hours": return <AvTimerIcon fontSize="inherit" />; - case "serverTime": return <ScheduleIcon fontSize="inherit" />; - case "speed": return <SpeedIcon fontSize="inherit" />; - default: return <b>{name}</b>; + case "address": return <PlaceIcon fontSize="inherit" />; + case "hours": return <AvTimerIcon fontSize="inherit" />; + case "speed": return <SpeedIcon fontSize="inherit" />; + case "serverTime": return <ScheduleIcon fontSize="inherit" />; + default: return <b>{name}</b>; } }; |