diff options
author | Anton Tananaev <anton@traccar.org> | 2022-10-28 17:02:39 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-10-28 17:02:39 -0700 |
commit | 17b990eabe36138a4a879deef8d03b16ee27e1ba (patch) | |
tree | b1eb82f53012ad990163996d1ce633cbbbc19c6c /modern/src | |
parent | dd09b5c7ed235088d86ba9898261d74228b825ee (diff) | |
download | trackermap-web-17b990eabe36138a4a879deef8d03b16ee27e1ba.tar.gz trackermap-web-17b990eabe36138a4a879deef8d03b16ee27e1ba.tar.bz2 trackermap-web-17b990eabe36138a4a879deef8d03b16ee27e1ba.zip |
Change live routes config
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/common/attributes/useCommonUserAttributes.js | 2 | ||||
-rw-r--r-- | modern/src/main/MainMap.js | 4 | ||||
-rw-r--r-- | modern/src/resources/l10n/en.json | 1 | ||||
-rw-r--r-- | modern/src/settings/PreferencesPage.js | 21 |
4 files changed, 16 insertions, 12 deletions
diff --git a/modern/src/common/attributes/useCommonUserAttributes.js b/modern/src/common/attributes/useCommonUserAttributes.js index cef6daf8..154471ce 100644 --- a/modern/src/common/attributes/useCommonUserAttributes.js +++ b/modern/src/common/attributes/useCommonUserAttributes.js @@ -7,7 +7,7 @@ export default (t) => useMemo(() => ({ }, mapLiveRoutes: { name: t('mapLiveRoutes'), - type: 'boolean', + type: 'string', }, mapFollow: { name: t('deviceFollow'), diff --git a/modern/src/main/MainMap.js b/modern/src/main/MainMap.js index 279f3a85..07bb3c42 100644 --- a/modern/src/main/MainMap.js +++ b/modern/src/main/MainMap.js @@ -30,7 +30,7 @@ const MainMap = ({ filteredPositions, selectedPosition, onEventsClick }) => { const features = useFeatures(); - const mapLiveRoutes = useAttributePreference('mapLiveRoutes', false); + const mapLiveRoutes = useAttributePreference('mapLiveRoutes', 'none'); const onMarkerClick = useCallback((_, deviceId) => { dispatch(devicesActions.select(deviceId)); @@ -42,7 +42,7 @@ const MainMap = ({ filteredPositions, selectedPosition, onEventsClick }) => { <MapOverlay /> <MapGeofence /> <MapAccuracy positions={filteredPositions} /> - {mapLiveRoutes && <MapLiveRoutes />} + {mapLiveRoutes !== 'none' && <MapLiveRoutes />} <MapPositions positions={filteredPositions} onClick={onMarkerClick} diff --git a/modern/src/resources/l10n/en.json b/modern/src/resources/l10n/en.json index e20faddb..e9474691 100644 --- a/modern/src/resources/l10n/en.json +++ b/modern/src/resources/l10n/en.json @@ -184,6 +184,7 @@ "loginLogout": "Logout", "loginLogo": "Logo", "devicesAndState": "Devices and State", + "deviceSelected": "Selected Device", "deviceTitle": "Devices", "devicePrimaryInfo": "Device Title", "deviceSecondaryInfo": "Device Detail", diff --git a/modern/src/settings/PreferencesPage.js b/modern/src/settings/PreferencesPage.js index 97548cbb..6aad1153 100644 --- a/modern/src/settings/PreferencesPage.js +++ b/modern/src/settings/PreferencesPage.js @@ -223,6 +223,18 @@ const PreferencesPage = () => { /> )} /> + <FormControl> + <InputLabel>{t('mapLiveRoutes')}</InputLabel> + <Select + label={t('mapLiveRoutes')} + value={attributes.mapLiveRoutes || 'none'} + onChange={(e) => setAttributes({ ...attributes, mapLiveRoutes: 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={( @@ -236,15 +248,6 @@ const PreferencesPage = () => { <FormControlLabel control={( <Checkbox - checked={attributes.hasOwnProperty('mapLiveRoutes') ? attributes.mapLiveRoutes : false} - onChange={(e) => setAttributes({ ...attributes, mapLiveRoutes: e.target.checked })} - /> - )} - label={t('mapLiveRoutes')} - /> - <FormControlLabel - control={( - <Checkbox checked={attributes.hasOwnProperty('mapFollow') ? attributes.mapFollow : false} onChange={(e) => setAttributes({ ...attributes, mapFollow: e.target.checked })} /> |