From f574d9c1c9fa89788838faf0b1a39a0e7d4c6755 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Tue, 2 Jul 2024 22:15:01 -0600 Subject: Re-add position details to DeviceRow, this time statically --- src/main/DeviceList.jsx | 2 +- src/main/DeviceRow.jsx | 41 +++++++++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/main/DeviceList.jsx b/src/main/DeviceList.jsx index ce5819b2..b6e48b53 100644 --- a/src/main/DeviceList.jsx +++ b/src/main/DeviceList.jsx @@ -53,7 +53,7 @@ const DeviceList = ({ devices }) => { height={height} itemCount={devices.length} itemData={devices} - itemSize={72} + itemSize={155} overscanCount={10} innerRef={listInnerEl} > 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 ( + + )} + /> + ); + } + + return ( + + ); + })} ); }; @@ -187,13 +214,11 @@ const DeviceRow = ({ data, index, style }) => { const AttrItem = ({ attr, name, content }) => { const attrIcon = () => { switch(attr) { - case "address": return ; - case "deviceTime": return ; - case "fixTime": return ; - case "hours": return ; - case "serverTime": return ; - case "speed": return ; - default: return {name}; + case "address": return ; + case "hours": return ; + case "speed": return ; + case "serverTime": return ; + default: return {name}; } }; -- cgit v1.2.3