diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-28 08:16:24 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-28 08:16:24 -0700 |
commit | 2870790d4d1a53af27c41f1591720c38c7c95520 (patch) | |
tree | bb9de8a34434655539d4a6c50c07a9e96b0600dd /modern/src/main/MainPage.js | |
parent | c615c9e2f0acf91684d4cb6d9555eccf403971d2 (diff) | |
download | trackermap-web-2870790d4d1a53af27c41f1591720c38c7c95520.tar.gz trackermap-web-2870790d4d1a53af27c41f1591720c38c7c95520.tar.bz2 trackermap-web-2870790d4d1a53af27c41f1591720c38c7c95520.zip |
Show map on selection (fix #948)
Diffstat (limited to 'modern/src/main/MainPage.js')
-rw-r--r-- | modern/src/main/MainPage.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modern/src/main/MainPage.js b/modern/src/main/MainPage.js index f9341eb6..41e51609 100644 --- a/modern/src/main/MainPage.js +++ b/modern/src/main/MainPage.js @@ -129,6 +129,8 @@ const MainPage = () => { const desktop = useMediaQuery(theme.breakpoints.up('md')); const phone = useMediaQuery(theme.breakpoints.down('sm')); + const [mapMapOnSelect] = usePersistedState('mapOnSelect', false); + const [mapLiveRoutes] = usePersistedState('mapLiveRoutes', false); const selectedDeviceId = useSelector((state) => state.devices.selectedId); @@ -143,6 +145,12 @@ const MainPage = () => { useEffect(() => setCollapsed(!desktop), [desktop]); + useEffect(() => { + if (!desktop && mapMapOnSelect && selectedDeviceId) { + setCollapsed(true); + } + }, [desktop, mapMapOnSelect, selectedDeviceId]); + const onClick = useCallback((_, deviceId) => { dispatch(devicesActions.select(deviceId)); }, [dispatch]); |