aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/main/CurrentPositionsMap.js
blob: 76a0a0b9e6ee6a47130916453cc900e0f61b212c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)} onClick={onClick} />);
};

export default CurrentPositionsMap;