diff options
Diffstat (limited to 'modern/src/map/MapPositions.js')
-rw-r--r-- | modern/src/map/MapPositions.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js index 704c24bd..e4365fab 100644 --- a/modern/src/map/MapPositions.js +++ b/modern/src/map/MapPositions.js @@ -1,13 +1,13 @@ import { useId, useCallback, useEffect } from 'react'; import { useSelector } from 'react-redux'; import { map } from './core/MapView'; -import { getStatusColor } from '../common/util/formatter'; +import { formatTime, getStatusColor } from '../common/util/formatter'; import usePersistedState from '../common/util/usePersistedState'; import { mapIconKey } from './core/preloadImages'; import { findFonts } from './core/mapUtil'; import { useAttributePreference } from '../common/util/preferences'; -const MapPositions = ({ positions, onClick, showStatus, selectedPosition }) => { +const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleField }) => { const id = useId(); const clusters = `${id}-clusters`; const direction = `${id}-direction`; @@ -24,6 +24,7 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition }) => { id: position.id, deviceId: position.deviceId, name: device.name, + fixTime: formatTime(position.fixTime), category: mapIconKey(device.category), color: showStatus ? position.attributes.color || getStatusColor(device.status) : 'neutral', rotation: position.course, @@ -84,7 +85,7 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition }) => { 'icon-image': '{category}-{color}', 'icon-size': iconScale, 'icon-allow-overlap': true, - 'text-field': '{name}', + 'text-field': `{${titleField || 'name'}}`, 'text-allow-overlap': true, 'text-anchor': 'bottom', 'text-offset': [0, -2 * iconScale], |