diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/DeviceList.jsx | 2 | ||||
-rw-r--r-- | 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 ( + <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>; } }; |