diff --git a/src/components/storm/ZoneAssignmentModal.jsx b/src/components/storm/ZoneAssignmentModal.jsx index d922ce3..edd445d 100644 --- a/src/components/storm/ZoneAssignmentModal.jsx +++ b/src/components/storm/ZoneAssignmentModal.jsx @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import ReactDOM from 'react-dom'; import { motion, AnimatePresence } from 'framer-motion'; import { X, MapPin, Check } from 'lucide-react'; import { DISPATCH_REPS } from '../../data/mockStore'; @@ -38,14 +39,14 @@ const ZoneAssignmentModal = ({ open, onClose, onSave, polygon = [], linkedStormI }); }; - return ( + return ReactDOM.createPortal( {open && ( <> {/* Color accent bar */}
@@ -188,7 +189,8 @@ const ZoneAssignmentModal = ({ open, onClose, onSave, polygon = [], linkedStormI )} - + , + document.body ); }; diff --git a/src/pages/StormIntelPage.jsx b/src/pages/StormIntelPage.jsx index 6494e66..07753db 100644 --- a/src/pages/StormIntelPage.jsx +++ b/src/pages/StormIntelPage.jsx @@ -97,7 +97,16 @@ const MapFlyTo = ({ storm, flyCount }) => { }; const ZoneLayer = ({ zones }) => { + const map = useMap(); if (!zones?.length) return null; + + const flyToZone = (polygon) => { + try { + const bounds = L.latLngBounds(polygon); + map.fitBounds(bounds, { padding: [50, 50], maxZoom: 15, animate: true, duration: 0.7 }); + } catch { /* malformed polygon */ } + }; + return zones.map(zone => { if (!zone.polygon?.length) return null; const centroid = zone.polygon.reduce( @@ -116,6 +125,7 @@ const ZoneLayer = ({ zones }) => { opacity: zone.status === 'completed' ? 0.45 : 0.85, dashArray: zone.status === 'completed' ? '5 4' : undefined, }} + eventHandlers={{ click: () => flyToZone(zone.polygon) }} >
@@ -126,11 +136,12 @@ const ZoneLayer = ({ zones }) => {
- {/* Agent initials circle at centroid */} + {/* Agent initials circle at centroid — also clickable */} flyToZone(zone.polygon) }} >

{zone.name}

@@ -527,7 +538,7 @@ const StormDetailDrawer = ({ storm, open, onClose, onFlyTo, onAssignZone, canMan >
-
+
@@ -547,7 +558,7 @@ const StormDetailDrawer = ({ storm, open, onClose, onFlyTo, onAssignZone, canMan
-
+

{storm.areaName} @@ -617,7 +628,7 @@ const StormDetailDrawer = ({ storm, open, onClose, onFlyTo, onAssignZone, canMan

-
+