diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-03 09:08:31 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-03 09:08:31 -0700 |
commit | aed55c77c58d74879dd9acedbab8965233d47aa3 (patch) | |
tree | 8eab4b729100aab5e5f13d7a35a2d2288feb477a /modern/src/main | |
parent | 7d521e8411dbeb9ca6bbeb98453145b44c7e5913 (diff) | |
download | trackermap-web-aed55c77c58d74879dd9acedbab8965233d47aa3.tar.gz trackermap-web-aed55c77c58d74879dd9acedbab8965233d47aa3.tar.bz2 trackermap-web-aed55c77c58d74879dd9acedbab8965233d47aa3.zip |
Selected device direction (fix #924)
Diffstat (limited to 'modern/src/main')
-rw-r--r-- | modern/src/main/MainPage.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modern/src/main/MainPage.js b/modern/src/main/MainPage.js index 5a35dcef..27e2631f 100644 --- a/modern/src/main/MainPage.js +++ b/modern/src/main/MainPage.js @@ -31,6 +31,7 @@ import usePersistedState from '../common/util/usePersistedState'; import MapLiveRoutes from '../map/main/MapLiveRoutes'; import { useDeviceReadonly } from '../common/util/permissions'; import MapPositions from '../map/MapPositions'; +import MapDirection from '../map/MapDirection'; const useStyles = makeStyles((theme) => ({ root: { @@ -135,6 +136,7 @@ const MainPage = () => { const selectedDeviceId = useSelector((state) => state.devices.selectedId); const positions = useSelector((state) => Object.values(state.positions.items)); + const selectedPosition = positions.find((position) => selectedDeviceId && position.deviceId === selectedDeviceId); const [searchKeyword, setSearchKeyword] = useState(''); const [collapsed, setCollapsed] = useState(false); @@ -162,6 +164,9 @@ const MainPage = () => { <MapAccuracy /> {mapLiveRoutes && <MapLiveRoutes />} <MapPositions positions={positions} onClick={onClick} showStatus /> + {selectedPosition && selectedPosition.course && ( + <MapDirection position={selectedPosition} /> + )} <MapDefaultCamera /> <MapSelectedDevice /> <PoiMap /> |