diff options
Diffstat (limited to 'modern/src/map/main/MapCurrentPositions.js')
-rw-r--r-- | modern/src/map/main/MapCurrentPositions.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modern/src/map/main/MapCurrentPositions.js b/modern/src/map/main/MapCurrentPositions.js new file mode 100644 index 00000000..ff05d2d1 --- /dev/null +++ b/modern/src/map/main/MapCurrentPositions.js @@ -0,0 +1,18 @@ +import React, { useCallback } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; + +import { devicesActions } from '../../store'; +import MapPositions from '../MapPositions'; + +const MapCurrentPositions = () => { + const dispatch = useDispatch(); + + const onClick = useCallback((_, deviceId) => { + dispatch(devicesActions.select(deviceId)); + }, [dispatch]); + + const positions = useSelector((state) => state.positions.items); + return (<MapPositions positions={Object.values(positions)} onClick={onClick} />); +}; + +export default MapCurrentPositions; |