diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-19 20:30:56 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-19 20:30:56 -0700 |
commit | 9e7ca99218cb7176d27a7a2271294e976d885ccd (patch) | |
tree | d171d6c9416bbb56b4b1cda490c03936b8d2ff5a /modern/src/main/MainPage.js | |
parent | 1e685dcf92e5eaa5579fd1cf5bbe84d4886117d7 (diff) | |
download | trackermap-web-9e7ca99218cb7176d27a7a2271294e976d885ccd.tar.gz trackermap-web-9e7ca99218cb7176d27a7a2271294e976d885ccd.tar.bz2 trackermap-web-9e7ca99218cb7176d27a7a2271294e976d885ccd.zip |
Option to hide geofences
Diffstat (limited to 'modern/src/main/MainPage.js')
-rw-r--r-- | modern/src/main/MainPage.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modern/src/main/MainPage.js b/modern/src/main/MainPage.js index fb748a68..afcfd5ae 100644 --- a/modern/src/main/MainPage.js +++ b/modern/src/main/MainPage.js @@ -146,8 +146,9 @@ const MainPage = () => { const features = useFeatures(); - const [mapMapOnSelect] = usePersistedState('mapOnSelect', false); + const [mapOnSelect] = usePersistedState('mapOnSelect', false); + const [mapGeofences] = usePersistedState('mapGeofences', true); const [mapLiveRoutes] = usePersistedState('mapLiveRoutes', false); const selectedDeviceId = useSelector((state) => state.devices.selectedId); @@ -181,10 +182,10 @@ const MainPage = () => { useEffect(() => setDevicesOpen(desktop), [desktop]); useEffect(() => { - if (!desktop && mapMapOnSelect && selectedDeviceId) { + if (!desktop && mapOnSelect && selectedDeviceId) { setDevicesOpen(false); } - }, [desktop, mapMapOnSelect, selectedDeviceId]); + }, [desktop, mapOnSelect, selectedDeviceId]); const onClick = useCallback((_, deviceId) => { dispatch(devicesActions.select(deviceId)); @@ -212,7 +213,7 @@ const MainPage = () => { <div className={classes.root}> <MapView> <MapOverlay /> - <MapGeofence /> + {mapGeofences && <MapGeofence />} <MapAccuracy /> {mapLiveRoutes && <MapLiveRoutes />} <MapPositions positions={filteredPositions} onClick={onClick} showStatus /> |