diff options
author | Iván Ávalos <avalos@disroot.org> | 2023-03-04 11:47:23 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2023-03-04 11:47:23 -0600 |
commit | 5c425999cf2d2aed657c61dbc636d9ac178aa63a (patch) | |
tree | 0b2a18606719730534281df1cc58c5f6fc14ff94 /modern/src | |
parent | dc126a515783a2998aa40e7bee66b4f9846c9fe8 (diff) | |
download | etbsa-traccar-web-5c425999cf2d2aed657c61dbc636d9ac178aa63a.tar.gz etbsa-traccar-web-5c425999cf2d2aed657c61dbc636d9ac178aa63a.tar.bz2 etbsa-traccar-web-5c425999cf2d2aed657c61dbc636d9ac178aa63a.zip |
Ícono de status ahora marca ignición
Diffstat (limited to 'modern/src')
-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;
|