From 84b1e73fa7b24516390bb73ae2fa09b37da15257 Mon Sep 17 00:00:00 2001 From: Satyam-Rastogi Date: Mon, 18 May 2026 18:29:29 +0530 Subject: [PATCH] fix(storm-intel): modal z-index, zone click-to-zoom, drawer close on fly-to, left padding - ZoneAssignmentModal: portal to document.body with z-9999 so it renders above Leaflet map stacking context - ZoneLayer: clicking any zone polygon or centroid circle fits map bounds to that zone - handleFlyTo: closes detail drawer after zooming so the map is unobstructed - StormDetailDrawer: pl-5 on header, body, and footer for consistent left padding --- src/components/storm/ZoneAssignmentModal.jsx | 10 ++++++---- src/pages/StormIntelPage.jsx | 20 ++++++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) 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

-
+