aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/PositionsMap.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/map/PositionsMap.js')
-rw-r--r--modern/src/map/PositionsMap.js14
1 files changed, 2 insertions, 12 deletions
diff --git a/modern/src/map/PositionsMap.js b/modern/src/map/PositionsMap.js
index 8d100534..791c7abe 100644
--- a/modern/src/map/PositionsMap.js
+++ b/modern/src/map/PositionsMap.js
@@ -9,6 +9,7 @@ import { map } from './Map';
import store from '../store';
import StatusView from './StatusView';
import theme from '../theme';
+import { getStatusColor } from '../common/formatter';
const PositionsMap = ({ positions }) => {
const id = 'positions';
@@ -17,24 +18,13 @@ const PositionsMap = ({ positions }) => {
const history = useHistory();
const devices = useSelector((state) => state.devices.items);
- const deviceColor = (device) => {
- switch (device.status) {
- case 'online':
- return 'green';
- case 'offline':
- return 'red';
- default:
- return 'gray';
- }
- };
-
const createFeature = (devices, position) => {
const device = devices[position.deviceId];
return {
deviceId: position.deviceId,
name: device.name,
category: device.category || 'default',
- color: deviceColor(device),
+ color: getStatusColor(device.status),
};
};