aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/main/DevicesList.js4
-rw-r--r--modern/src/map/MapPositions.js3
-rw-r--r--modern/src/map/core/preloadImages.js2
3 files changed, 6 insertions, 3 deletions
diff --git a/modern/src/main/DevicesList.js b/modern/src/main/DevicesList.js
index a91b81e2..5bbc8c4f 100644
--- a/modern/src/main/DevicesList.js
+++ b/modern/src/main/DevicesList.js
@@ -22,7 +22,7 @@ import {
formatAlarm, formatBoolean, formatPercentage, formatStatus, getStatusColor,
} from '../common/util/formatter';
import { useTranslation } from '../common/components/LocalizationProvider';
-import { mapIcons } from '../map/core/preloadImages';
+import { mapIconKey, mapIcons } from '../map/core/preloadImages';
import { useAdministrator } from '../common/util/permissions';
const useStyles = makeStyles((theme) => ({
@@ -91,7 +91,7 @@ const DeviceRow = ({ data, index, style }) => {
>
<ListItemAvatar>
<Avatar>
- <img className={classes.icon} src={mapIcons[item.category || 'default']} alt="" />
+ <img className={classes.icon} src={mapIcons[mapIconKey(item.category)]} alt="" />
</Avatar>
</ListItemAvatar>
<ListItemText
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js
index 89a48df1..c1c3a1ca 100644
--- a/modern/src/map/MapPositions.js
+++ b/modern/src/map/MapPositions.js
@@ -4,6 +4,7 @@ import { useSelector } from 'react-redux';
import { map } from './core/MapView';
import { getStatusColor } from '../common/util/formatter';
import usePersistedState from '../common/util/usePersistedState';
+import { mapIconKey } from './core/preloadImages';
const MapPositions = ({ positions, onClick, showStatus }) => {
const id = 'positions';
@@ -19,7 +20,7 @@ const MapPositions = ({ positions, onClick, showStatus }) => {
id: position.id,
deviceId: position.deviceId,
name: device.name,
- category: device.category || 'default',
+ category: mapIconKey(device.category),
color: showStatus ? position.attributes.color || getStatusColor(device.status) : 'neutral',
};
};
diff --git a/modern/src/map/core/preloadImages.js b/modern/src/map/core/preloadImages.js
index 8649a347..770c1c57 100644
--- a/modern/src/map/core/preloadImages.js
+++ b/modern/src/map/core/preloadImages.js
@@ -49,6 +49,8 @@ export const mapIcons = {
van: vanSvg,
};
+export const mapIconKey = (category) => (mapIcons.hasOwnProperty(category) ? category : 'default');
+
export const mapImages = {};
export default async () => {