From c404e4b59c8d365d50769b9c6699a70a9181439c Mon Sep 17 00:00:00 2001 From: robinvandermolen Date: Tue, 10 Dec 2024 08:42:04 +0100 Subject: [PATCH] :fire: [open-formulieren/open-forms#2177] Removing old map functionality and components --- src/components/Map/index.jsx | 44 +++--------------------------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/src/components/Map/index.jsx b/src/components/Map/index.jsx index 32dbf1bdc..77883cd8f 100644 --- a/src/components/Map/index.jsx +++ b/src/components/Map/index.jsx @@ -1,9 +1,8 @@ import {GeoSearchControl} from 'leaflet-geosearch'; -import isEqual from 'lodash/isEqual'; import PropTypes from 'prop-types'; -import React, {useCallback, useContext, useEffect} from 'react'; +import React, {useContext, useEffect} from 'react'; import {defineMessages, useIntl} from 'react-intl'; -import {MapContainer, Marker, TileLayer, useMap, useMapEvent} from 'react-leaflet'; +import {MapContainer, TileLayer, useMap} from 'react-leaflet'; import {useGeolocation} from 'react-use'; import {ConfigContext} from 'Context'; @@ -72,12 +71,6 @@ const LeaftletMap = ({ const defaultCoordinates = useDefaultCoordinates(); const coordinates = markerCoordinates || defaultCoordinates; - const onWrapperMarkerSet = coordinates => { - const coordinatesChanged = !isEqual(markerCoordinates, coordinates); - if (!coordinatesChanged) return; - onMarkerSet(coordinates); - }; - const modifiers = disabled ? ['disabled'] : []; const className = getBEMClassName('leaflet-map', modifiers); @@ -104,7 +97,6 @@ const LeaftletMap = ({ {coordinates ? ( <> - ) : null} - {disabled ? : } + {/*{disabled ? : }*/} {markerCoordinates && markerCoordinates.length && ( @@ -239,24 +231,6 @@ SearchControl.propTypes = { }), }; -const MarkerWrapper = ({position, onMarkerSet, ...props}) => { - const shouldSetMarker = !!(position && position.length === 2); - - useEffect(() => { - if (!shouldSetMarker) return; - if (!onMarkerSet) return; - onMarkerSet(position); - }); - - // only render a marker if we explicitly have a marker - return shouldSetMarker ? : null; -}; - -MarkerWrapper.propTypes = { - position: PropTypes.arrayOf(PropTypes.number), - onMarkerSet: PropTypes.func, -}; - const DisabledMapControls = () => { const map = useMap(); useEffect(() => { @@ -271,16 +245,4 @@ const DisabledMapControls = () => { return null; }; -const CaptureClick = ({setMarker}) => { - useMapEvent('click', event => { - const newLatLng = [event.latlng.lat, event.latlng.lng]; - setMarker(newLatLng); - }); - return null; -}; - -CaptureClick.propTypes = { - setMarker: PropTypes.func.isRequired, -}; - export default LeaftletMap;