aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
Diffstat (limited to 'modern')
-rw-r--r--modern/src/common/attributes/useCommonUserAttributes.js4
-rw-r--r--modern/src/map/MapPositions.js15
-rw-r--r--modern/src/resources/l10n/en.json1
-rw-r--r--modern/src/settings/PreferencesPage.js12
4 files changed, 31 insertions, 1 deletions
diff --git a/modern/src/common/attributes/useCommonUserAttributes.js b/modern/src/common/attributes/useCommonUserAttributes.js
index 154471ce..bd88d1e8 100644
--- a/modern/src/common/attributes/useCommonUserAttributes.js
+++ b/modern/src/common/attributes/useCommonUserAttributes.js
@@ -9,6 +9,10 @@ export default (t) => useMemo(() => ({
name: t('mapLiveRoutes'),
type: 'string',
},
+ mapDirection: {
+ name: t('mapDirection'),
+ type: 'string',
+ },
mapFollow: {
name: t('deviceFollow'),
type: 'boolean',
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js
index 2f038ec6..ba510209 100644
--- a/modern/src/map/MapPositions.js
+++ b/modern/src/map/MapPositions.js
@@ -16,9 +16,22 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
const iconScale = useAttributePreference('iconScale', 1);
const mapCluster = useAttributePreference('mapCluster', true);
const hours12 = usePreference('twelveHourFormat');
+ const directionType = useAttributePreference('mapDirection', 'selected');
const createFeature = (devices, position, selectedPositionId) => {
const device = devices[position.deviceId];
+ let showDirection;
+ switch (directionType) {
+ case 'none':
+ showDirection = false;
+ break;
+ case 'all':
+ showDirection = true;
+ break;
+ default:
+ showDirection = selectedPositionId === position.id;
+ break;
+ }
return {
id: position.id,
deviceId: position.deviceId,
@@ -27,7 +40,7 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
category: mapIconKey(device.category),
color: showStatus ? position.attributes.color || getStatusColor(device.status) : 'neutral',
rotation: position.course,
- direction: selectedPositionId === position.id,
+ direction: showDirection,
};
};
diff --git a/modern/src/resources/l10n/en.json b/modern/src/resources/l10n/en.json
index 7a3fd272..7a7c5516 100644
--- a/modern/src/resources/l10n/en.json
+++ b/modern/src/resources/l10n/en.json
@@ -351,6 +351,7 @@
"mapShapeCircle": "Circle",
"mapShapePolyline": "Polyline",
"mapLiveRoutes": "Live Routes",
+ "mapDirection": "Show Direction",
"mapCurrentLocation": "Current Location",
"mapPoiLayer": "POI Layer",
"mapClustering": "Markers Clustering",
diff --git a/modern/src/settings/PreferencesPage.js b/modern/src/settings/PreferencesPage.js
index e939732a..fcf34739 100644
--- a/modern/src/settings/PreferencesPage.js
+++ b/modern/src/settings/PreferencesPage.js
@@ -244,6 +244,18 @@ const PreferencesPage = () => {
<MenuItem value="all">{t('notificationAlways')}</MenuItem>
</Select>
</FormControl>
+ <FormControl>
+ <InputLabel>{t('mapDirection')}</InputLabel>
+ <Select
+ label={t('mapDirection')}
+ value={attributes.mapDirection || 'selected'}
+ onChange={(e) => setAttributes({ ...attributes, mapDirection: e.target.value })}
+ >
+ <MenuItem value="none">{t('sharedDisabled')}</MenuItem>
+ <MenuItem value="selected">{t('deviceSelected')}</MenuItem>
+ <MenuItem value="all">{t('notificationAlways')}</MenuItem>
+ </Select>
+ </FormControl>
<FormGroup>
<FormControlLabel
control={(