aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-07-02 22:15:01 -0600
committerIván Ávalos <avalos@disroot.org>2024-07-02 22:15:01 -0600
commitf574d9c1c9fa89788838faf0b1a39a0e7d4c6755 (patch)
tree100a5610cf7f603ba607b58fa3bffc69b54125aa
parent5f064d0a7743abdd9ffe645de1ffd55bb5c4f72f (diff)
downloadtrackermap-web-f574d9c1c9fa89788838faf0b1a39a0e7d4c6755.tar.gz
trackermap-web-f574d9c1c9fa89788838faf0b1a39a0e7d4c6755.tar.bz2
trackermap-web-f574d9c1c9fa89788838faf0b1a39a0e7d4c6755.zip
Re-add position details to DeviceRow, this time staticallyHEADmaster
-rw-r--r--src/main/DeviceList.jsx2
-rw-r--r--src/main/DeviceRow.jsx41
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>;
}
};