aboutsummaryrefslogtreecommitdiff
path: root/modern/src/main/MainPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-03 09:08:31 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-03 09:08:31 -0700
commitaed55c77c58d74879dd9acedbab8965233d47aa3 (patch)
tree8eab4b729100aab5e5f13d7a35a2d2288feb477a /modern/src/main/MainPage.js
parent7d521e8411dbeb9ca6bbeb98453145b44c7e5913 (diff)
downloadtrackermap-web-aed55c77c58d74879dd9acedbab8965233d47aa3.tar.gz
trackermap-web-aed55c77c58d74879dd9acedbab8965233d47aa3.tar.bz2
trackermap-web-aed55c77c58d74879dd9acedbab8965233d47aa3.zip
Selected device direction (fix #924)
Diffstat (limited to 'modern/src/main/MainPage.js')
-rw-r--r--modern/src/main/MainPage.js5
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 />