aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-07 19:18:02 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-07 19:18:02 -0600
commitfdacbe991e0ccea66ab684a2e119607ad95299ee (patch)
tree909bb48c3896eaf808dd78f036aed1d76a815960
parentbe38d879dc5cdcc8f81c9ea13365355f686b2869 (diff)
downloadetbsa-traccar-web-fdacbe991e0ccea66ab684a2e119607ad95299ee.tar.gz
etbsa-traccar-web-fdacbe991e0ccea66ab684a2e119607ad95299ee.tar.bz2
etbsa-traccar-web-fdacbe991e0ccea66ab684a2e119607ad95299ee.zip
Use ignition instead of status to render label colors in map
-rw-r--r--modern/src/map/PositionsMap.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/modern/src/map/PositionsMap.js b/modern/src/map/PositionsMap.js
index b53cbfb..6bd7bcb 100644
--- a/modern/src/map/PositionsMap.js
+++ b/modern/src/map/PositionsMap.js
@@ -18,13 +18,15 @@ const PositionsMap = ({ positions }) => {
const devices = useSelector((state) => state.devices.items);
const deviceColor = (device) => {
- switch (device.status) {
- case 'online':
+ const position = positions[device.id];
+ if (position) {
+ if (position.attributes.ignition) {
return 'green';
- case 'offline':
+ } else {
return 'red';
- default:
- return 'gray';
+ }
+ } else {
+ return 'gray';
}
};