From a3a274ed3041a65821dfc9d161aa22efcc8c1dfc Mon Sep 17 00:00:00 2001 From: mikkojamG Date: Mon, 14 Apr 2025 13:29:13 +0300 Subject: [PATCH 1/2] fix: leaflet-draw rectangle bug --- src/components/CommentFormMap/CommentFormMap.jsx | 5 ++--- src/components/admin/HearingFormStep3.jsx | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/CommentFormMap/CommentFormMap.jsx b/src/components/CommentFormMap/CommentFormMap.jsx index 42b2d6258..717f423dd 100644 --- a/src/components/CommentFormMap/CommentFormMap.jsx +++ b/src/components/CommentFormMap/CommentFormMap.jsx @@ -64,8 +64,7 @@ class CommentFormMap extends React.Component { url={this.props.mapTileUrl} attribution='© OpenStreetMap contributors' /> - + {this.props.contents !== null &&
{this.props.contents}
} { circle: false, circlemarker: false, polyline: false, + rectangle: { showArea: false }, marker: { icon: new Leaflet.Icon({ iconUrl: leafletMarkerIconUrl, From 6f748a0f4de027a1411d95040ec893aa72b878ff Mon Sep 17 00:00:00 2001 From: mikkojamG Date: Mon, 14 Apr 2025 14:06:51 +0300 Subject: [PATCH 2/2] chore: map style fixes --- src/components/CommentFormMap/CommentFormMap.jsx | 2 +- src/components/Hearing/Comment/index.jsx | 2 +- src/components/Hearing/HearingMap.jsx | 7 +------ src/components/OverviewMap.jsx | 8 ++++---- src/components/UserComment/UserComment.jsx | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/components/CommentFormMap/CommentFormMap.jsx b/src/components/CommentFormMap/CommentFormMap.jsx index 717f423dd..86678e165 100644 --- a/src/components/CommentFormMap/CommentFormMap.jsx +++ b/src/components/CommentFormMap/CommentFormMap.jsx @@ -75,7 +75,7 @@ class CommentFormMap extends React.Component { circlemarker: false, polyline: false, polygon: allToolsEnabled, - rectangle: { showArea: false }, + rectangle: allToolsEnabled ? { showArea: false } : false, marker: { icon: new Leaflet.Icon({ iconUrl: leafletMarkerIconUrl, diff --git a/src/components/Hearing/Comment/index.jsx b/src/components/Hearing/Comment/index.jsx index ca6b01164..67e4df1c0 100644 --- a/src/components/Hearing/Comment/index.jsx +++ b/src/components/Hearing/Comment/index.jsx @@ -580,7 +580,7 @@ const Comment = (props) => { {data.geojson && (
- {state.displayMap && data.geojson && ( diff --git a/src/components/Hearing/HearingMap.jsx b/src/components/Hearing/HearingMap.jsx index 8e301770f..f37a37ce7 100644 --- a/src/components/Hearing/HearingMap.jsx +++ b/src/components/Hearing/HearingMap.jsx @@ -6,12 +6,7 @@ import OverviewMap from '../OverviewMap'; const HearingMap = ({ hearing, ...props }) => (
- +
); diff --git a/src/components/OverviewMap.jsx b/src/components/OverviewMap.jsx index f2157ec3d..f599391d4 100644 --- a/src/components/OverviewMap.jsx +++ b/src/components/OverviewMap.jsx @@ -184,19 +184,19 @@ const OverviewMap = ({ mapElementLimit = 0, showOnCarousel = false, ...props }) * @returns {Bool} */ const shouldMapRender = () => (showOnCarousel ? dimensions.height && dimensions.width : true); - - /* eslint-disable react-hooks/exhaustive-deps */ + + /* eslint-disable react-hooks/exhaustive-deps */ useEffect(() => { getHearingMapContent(hearings); handleUpdateMapDimensions(mapContainer); // Add any other functions that should run on component mount or hearings change here - }, [hearings]); + }, [hearings]); if (typeof window === 'undefined') return null; if (!contents && props.hideIfEmpty) { return null; } - + return ( shouldMapRender() && ( { - + const [displayMap, setDisplayMap] = useState(false); const { comment, locale } = props; const { hearing_data: data } = comment;