import React, { useCallback } from 'react'; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; import { useDispatch, useSelector } from 'react-redux'; import MapView from '../map/core/MapView'; import MapSelectedDevice from '../map/main/MapSelectedDevice'; import MapAccuracy from '../map/main/MapAccuracy'; import MapGeofence from '../map/MapGeofence'; import MapCurrentLocation from '../map/MapCurrentLocation'; import PoiMap from '../map/main/PoiMap'; import MapPadding from '../map/MapPadding'; import { devicesActions } from '../store'; import MapDefaultCamera from '../map/main/MapDefaultCamera'; import MapLiveRoutes from '../map/main/MapLiveRoutes'; import MapPositions from '../map/MapPositions'; import MapOverlay from '../map/overlay/MapOverlay'; import MapGeocoder from '../map/geocoder/MapGeocoder'; import MapScale from '../map/MapScale'; import MapNotification from '../map/notification/MapNotification'; import useFeatures from '../common/util/useFeatures'; const MainMap = ({ filteredPositions, selectedPosition, onEventsClick }) => { const theme = useTheme(); const dispatch = useDispatch(); const desktop = useMediaQuery(theme.breakpoints.up('md')); const eventsAvailable = useSelector((state) => !!state.events.items.length); const features = useFeatures(); const onMarkerClick = useCallback((_, deviceId) => { dispatch(devicesActions.selectId(deviceId)); }, [dispatch]); return ( <> {!features.disableEvents && ( )} {desktop && ( )} ); }; export default MainMap;