diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-15 09:58:37 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-15 09:58:37 -0700 |
commit | 63cf082bd077087e551d2946c3e2a48a605a3532 (patch) | |
tree | 15587eaa69ea5daa4ab483e2caa16cf665f37597 /modern/src/map/main | |
parent | dcaaa40f71f45070add4f23ffda66d18b611562c (diff) | |
download | trackermap-web-63cf082bd077087e551d2946c3e2a48a605a3532.tar.gz trackermap-web-63cf082bd077087e551d2946c3e2a48a605a3532.tar.bz2 trackermap-web-63cf082bd077087e551d2946c3e2a48a605a3532.zip |
Clean up replay page
Diffstat (limited to 'modern/src/map/main')
-rw-r--r-- | modern/src/map/main/CurrentPositionsMap.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/modern/src/map/main/CurrentPositionsMap.js b/modern/src/map/main/CurrentPositionsMap.js index 80795497..76a0a0b9 100644 --- a/modern/src/map/main/CurrentPositionsMap.js +++ b/modern/src/map/main/CurrentPositionsMap.js @@ -1,11 +1,18 @@ -import React, { } from 'react'; -import { useSelector } from 'react-redux'; +import React, { useCallback } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { devicesActions } from '../../store'; import PositionsMap from '../PositionsMap'; const CurrentPositionsMap = () => { + const dispatch = useDispatch(); + + const onClick = useCallback((_, deviceId) => { + dispatch(devicesActions.select(deviceId)); + }, [dispatch]); + const positions = useSelector((state) => state.positions.items); - return (<PositionsMap positions={Object.values(positions)} />); + return (<PositionsMap positions={Object.values(positions)} onClick={onClick} />); }; export default CurrentPositionsMap; |