diff options
-rw-r--r-- | modern/src/DevicesList.js | 4 | ||||
-rw-r--r-- | modern/src/map/SelectedDeviceMap.js | 52 |
2 files changed, 28 insertions, 28 deletions
diff --git a/modern/src/DevicesList.js b/modern/src/DevicesList.js index 1bc1fa7..62a28cf 100644 --- a/modern/src/DevicesList.js +++ b/modern/src/DevicesList.js @@ -96,7 +96,7 @@ const DeviceRow = ({ data, index, style }) => { const showIgnition = position?.attributes.hasOwnProperty('ignition') && position.attributes.ignition === true; const statusColor = () => { - if (item.status == "online") { + if (showIgnition) { return 'primary'; } else { return 'error'; @@ -117,7 +117,7 @@ const DeviceRow = ({ data, index, style }) => { <img className={classes.icon} src={`images/icon/${(item.category || 'default').toLowerCase()}.png`} alt="" /> </ListItemAvatar> - {/* Status icon */} + {/* Status icon (now ignition) */} <ListItemText primary={ <Typography noWrap> <FiberManualRecordIcon fontSize="inherit" color={statusColor()} classes={{ colorPrimary: classes.green }} /> diff --git a/modern/src/map/SelectedDeviceMap.js b/modern/src/map/SelectedDeviceMap.js index 3a5c997..1d38a60 100644 --- a/modern/src/map/SelectedDeviceMap.js +++ b/modern/src/map/SelectedDeviceMap.js @@ -1,26 +1,26 @@ -import { useEffect } from 'react'; - -import { useSelector } from 'react-redux'; -import { map } from './Map'; - -const SelectedDeviceMap = () => { - const mapCenter = useSelector((state) => { - if (state.devices.selectedId) { - const position = state.positions.items[state.devices.selectedId] || null; - if (position) { - return { deviceId: state.devices.selectedId, position: [position.longitude, position.latitude] }; - } - } - return null; - }); - - useEffect(() => { - if (mapCenter) { - map.easeTo({ center: mapCenter.position, zoom: 18 }); - } - }, [mapCenter]); - - return null; -}; - -export default SelectedDeviceMap; +import { useEffect } from 'react';
+
+import { useSelector } from 'react-redux';
+import { map } from './Map';
+
+const SelectedDeviceMap = () => {
+ const mapCenter = useSelector((state) => {
+ if (state.devices.selectedId) {
+ const position = state.positions.items[state.devices.selectedId] || null;
+ if (position) {
+ return { deviceId: state.devices.selectedId, position: [position.longitude, position.latitude] };
+ }
+ }
+ return null;
+ });
+
+ useEffect(() => {
+ if (mapCenter) {
+ map.easeTo({ center: mapCenter.position, zoom: 18 });
+ }
+ }, [mapCenter]);
+
+ return null;
+};
+
+export default SelectedDeviceMap;
|