aboutsummaryrefslogtreecommitdiff
path: root/modern/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-27 09:15:49 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-27 09:15:49 -0700
commit5f1de2f30ffcc80c75a4a3256340a56d822dc1fa (patch)
tree353ca310b7e42c11ec1a1ab8f40974224b3378ee /modern/src/main
parent8f7387f026c8b983f8896626c1db689e23e148b9 (diff)
downloadtrackermap-web-5f1de2f30ffcc80c75a4a3256340a56d822dc1fa.tar.gz
trackermap-web-5f1de2f30ffcc80c75a4a3256340a56d822dc1fa.tar.bz2
trackermap-web-5f1de2f30ffcc80c75a4a3256340a56d822dc1fa.zip
Better map icon handling
Diffstat (limited to 'modern/src/main')
-rw-r--r--modern/src/main/DevicesList.js4
-rw-r--r--modern/src/main/StatusCard.js3
2 files changed, 4 insertions, 3 deletions
diff --git a/modern/src/main/DevicesList.js b/modern/src/main/DevicesList.js
index 022da390..108c3397 100644
--- a/modern/src/main/DevicesList.js
+++ b/modern/src/main/DevicesList.js
@@ -18,7 +18,6 @@ import BatteryCharging20Icon from '@mui/icons-material/BatteryCharging20';
import FlashOnIcon from '@mui/icons-material/FlashOn';
import FlashOffIcon from '@mui/icons-material/FlashOff';
import ErrorIcon from '@mui/icons-material/Error';
-
import moment from 'moment';
import { devicesActions } from '../store';
import { useEffectAsync } from '../reactHelper';
@@ -26,6 +25,7 @@ import {
formatAlarm, formatBoolean, formatPercentage, formatStatus, getStatusColor,
} from '../common/util/formatter';
import { useTranslation } from '../common/components/LocalizationProvider';
+import { mapIcons } from '../map/core/preloadImages';
const useStyles = makeStyles((theme) => ({
list: {
@@ -86,7 +86,7 @@ const DeviceRow = ({ data, index, style }) => {
<ListItem button key={item.id} className={classes.listItem} onClick={() => dispatch(devicesActions.select(item.id))}>
<ListItemAvatar>
<Avatar>
- <img className={classes.icon} src={`images/icon/${item.category || 'default'}.svg`} alt="" />
+ <img className={classes.icon} src={mapIcons[item.category || 'default']} alt="" />
</Avatar>
</ListItemAvatar>
<ListItemText
diff --git a/modern/src/main/StatusCard.js b/modern/src/main/StatusCard.js
index d991bd6a..5a65f4c7 100644
--- a/modern/src/main/StatusCard.js
+++ b/modern/src/main/StatusCard.js
@@ -32,6 +32,7 @@ import usePersistedState from '../common/util/usePersistedState';
import usePositionAttributes from '../common/attributes/usePositionAttributes';
import { devicesActions } from '../store';
import { useCatch } from '../reactHelper';
+import { mapIcons } from '../map/core/preloadImages';
const useStyles = makeStyles((theme) => ({
card: {
@@ -110,7 +111,7 @@ const StatusCard = ({ deviceId, onClose }) => {
<CardHeader
avatar={(
<Avatar>
- <img className={classes.icon} src={`images/icon/${device.category || 'default'}.svg`} alt="" />
+ <img className={classes.icon} src={mapIcons[device.category || 'default']} alt="" />
</Avatar>
)}
action={(