feat(storm-intel): Storm Intelligence Hub — Phase 1

Adds a new Storm Intel section to the sidebar and routes for ADMIN and OWNER roles.

- StormIntelPage: full-height layout with Leaflet map + storm polygon overlays,
  severity-coded color system, horizontal filter bar (date range / severity / sort),
  and a scrollable storm event list
- Storm detail drawer slides in from right with hail size, est. homes, days ago,
  conversion window indicator (Hot Zone / Warm / Cold / Too Fresh), intel text,
  and quick-action buttons (Create Lead, Open in Dispatch, Assign Canvassers stub)
- Clicking a storm card or map polygon zooms the map to that polygon and opens the drawer
- useStormEvents hook with USE_MOCK flag, date-range cutoff filter, type/severity filter,
  sort by date or severity, and conversionWindow() helper
- api/storm-events.js: NWS api.weather.gov proxy (free, no auth needed), parses
  GeoJSON polygons and hail size from alert descriptions
- MOCK_STORM_EVENTS: 7 realistic Plano TX storm events with accurate polygon coords
- Sidebar: CloudLightning "Storm Intel" entry added for OWNER and ADMIN nav
This commit is contained in:
Satyam-Rastogi
2026-05-18 16:49:37 +05:30
parent 4c1c454681
commit 2e797c89f6
6 changed files with 979 additions and 1 deletions
+119
View File
@@ -5582,3 +5582,122 @@ export const LEAD_FORM_OPTIONS = {
'SD','TN','TX','UT','VT','VA','WA','WV','WI','WY',
],
};
// Storm Events mock history of severe weather events in Plano TX area
// Each polygon is an array of [lat, lng] pairs forming the storm impact boundary.
// severity scale: trace (<1"), moderate (11.5"), significant (1.52"), severe (2"+)
// conversionWindow: days 760 = hot, 61120 = warm, >120 = cold
export const MOCK_STORM_EVENTS = [
{
id: 'SE-001',
date: '2026-04-28',
type: 'hail',
severity: 'severe',
maxHailSize: 2.5,
areaName: 'NE Plano / Spring Creek Pkwy',
county: 'Collin',
estimatedHomes: 1240,
description: 'Golf ballsized hail (2.5") swept through northeast Plano, generating dozens of immediate roof damage reports. Highest claim density in the Spring Creek / Custer Rd corridor.',
source: 'NOAA',
polygon: [
[33.110, -96.715], [33.101, -96.695], [33.083, -96.695],
[33.074, -96.715], [33.083, -96.735], [33.101, -96.735],
],
},
{
id: 'SE-002',
date: '2026-03-15',
type: 'hail',
severity: 'moderate',
maxHailSize: 1.2,
areaName: 'Central Plano / W 15th St',
county: 'Collin',
estimatedHomes: 870,
description: 'Quarter-sized hail moved through central Plano neighborhoods. Minor granule loss on older roofs; several shingle bruising reports filed.',
source: 'NWS',
polygon: [
[33.072, -96.748], [33.065, -96.730], [33.051, -96.730],
[33.044, -96.748], [33.051, -96.766], [33.065, -96.766],
],
},
{
id: 'SE-003',
date: '2026-02-03',
type: 'hail',
severity: 'significant',
maxHailSize: 1.75,
areaName: 'SE Plano / Parker Rd Corridor',
county: 'Collin',
estimatedHomes: 960,
description: 'Half-dollar sized hail impacted the Parker Rd corridor. High claim conversion probability — many homes in this zone have 1520 year old roofs.',
source: 'NOAA',
polygon: [
[33.036, -96.718], [33.029, -96.700], [33.015, -96.700],
[33.008, -96.718], [33.015, -96.736], [33.029, -96.736],
],
},
{
id: 'SE-004',
date: '2026-01-20',
type: 'hail',
severity: 'moderate',
maxHailSize: 1.0,
areaName: 'W Plano / Legacy West',
county: 'Collin',
estimatedHomes: 680,
description: 'Quarter-sized hail with sustained winds up to 45 mph. Mixed residential and commercial impact around the Legacy West district.',
source: 'NWS',
polygon: [
[33.086, -96.822], [33.079, -96.804], [33.065, -96.804],
[33.058, -96.822], [33.065, -96.840], [33.079, -96.840],
],
},
{
id: 'SE-005',
date: '2025-12-10',
type: 'hail',
severity: 'trace',
maxHailSize: 0.8,
areaName: 'Allen / N Plano Border',
county: 'Collin',
estimatedHomes: 430,
description: 'Marble-sized hail, minimal visible damage. Worth a light canvassing pass on homes with 10+ year roofs in this zone.',
source: 'NWS',
polygon: [
[33.120, -96.658], [33.114, -96.643], [33.102, -96.643],
[33.096, -96.658], [33.102, -96.673], [33.114, -96.673],
],
},
{
id: 'SE-006',
date: '2025-11-05',
type: 'hail',
severity: 'significant',
maxHailSize: 1.6,
areaName: 'S Plano / Haggard Park Area',
county: 'Collin',
estimatedHomes: 810,
description: 'Half-dollar hail combined with strong gusts. Shingle bruising confirmed across multiple streets. This zone responded well to canvassing in Q4.',
source: 'NOAA',
polygon: [
[33.047, -96.773], [33.040, -96.755], [33.026, -96.755],
[33.019, -96.773], [33.026, -96.791], [33.040, -96.791],
],
},
{
id: 'SE-007',
date: '2025-09-18',
type: 'hail',
severity: 'moderate',
maxHailSize: 1.1,
areaName: 'Frisco / N Plano',
county: 'Collin',
estimatedHomes: 530,
description: 'Storm cell crossed from Frisco into north Plano. Roofs 10 years or older in this zone are likely showing impact marks.',
source: 'NOAA',
polygon: [
[33.138, -96.782], [33.130, -96.762], [33.116, -96.762],
[33.108, -96.782], [33.116, -96.802], [33.130, -96.802],
],
},
];