import React from 'react'; import { FaDirections, FaGlobeAfrica, FaMountain } from 'react-icons/fa'; import { MdFullscreen, MdRadar, MdWbShade } from 'react-icons/md'; import { setExaggeration, setHillShade, setMapStyle, } from '@core/slices/mapSlice'; import { useAppDispatch } from '@hooks/useAppDispatch'; import { useAppSelector } from '@hooks/useAppSelector'; import { useMapbox } from '@hooks/useMapbox'; import { IconButton } from '@meshtastic/components'; import type { MapStyle } from './styles'; import { MapStyles } from './styles'; export const Map = (): JSX.Element => { const dispatch = useAppDispatch(); const darkMode = useAppSelector((state) => state.app.darkMode); const mapState = useAppSelector((state) => state.map); const { ref } = useMapbox(); const ChangeMapStyle = React.useCallback( (styleName: string, style: MapStyle) => { dispatch( setMapStyle( mapState.style.title === styleName ? darkMode ? MapStyles.Dark : MapStyles.Light : style, ), ); }, [dispatch, darkMode, mapState.style.title], ); return (
{ ChangeMapStyle('Satellite', MapStyles.Satellite); }} icon={} />
{ ChangeMapStyle('Outdoors', MapStyles.Outdoors); }} icon={} /> {mapState.style.title === 'Outdoors' && ( { dispatch(setHillShade(!mapState.hillShade)); }} icon={} /> )}

{ dispatch(setExaggeration(!mapState.exaggeration)); }} icon={} /> } /> } />
); };