From ff764e2b2ddacd0c2f87a71c56f07c730fdc8fd3 Mon Sep 17 00:00:00 2001 From: Kenneth Brewer Date: Wed, 29 Apr 2026 10:22:18 -0400 Subject: [PATCH] Addressed further pr comments about the api, onSave async, and adding a comment about rehypeRaw --- .../inertia/components/maps/MapComponent.tsx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/admin/inertia/components/maps/MapComponent.tsx b/admin/inertia/components/maps/MapComponent.tsx index bac307d..d9e6c15 100644 --- a/admin/inertia/components/maps/MapComponent.tsx +++ b/admin/inertia/components/maps/MapComponent.tsx @@ -46,6 +46,29 @@ export default function MapComponent() { } }, []) + useEffect(() => { + const params = new URLSearchParams(window.location.search) + + const lat = Number(params.get('lat')) + const lng = Number(params.get('lng')) + const zoom = Number(params.get('zoom') ?? 12) + + if ( + Number.isFinite(lat) && + Number.isFinite(lng) && + lat >= -90 && + lat <= 90 && + lng >= -180 && + lng <= 180 + ) { + mapRef.current?.flyTo({ + center: [lng, lat], + zoom: Number.isFinite(zoom) ? zoom : 12, + duration: 1500, + }) + } + }, []) + const handleMapClick = useCallback((e: MapLayerMouseEvent) => { setPlacingMarker({ lng: e.lngLat.lng, lat: e.lngLat.lat }) setMarkerName('')