diff --git a/src/components/kanban/KanbanCard.jsx b/src/components/kanban/KanbanCard.jsx index 3276c1a..b3906b8 100644 --- a/src/components/kanban/KanbanCard.jsx +++ b/src/components/kanban/KanbanCard.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { useDraggable } from '@dnd-kit/core'; import { CSS } from '@dnd-kit/utilities'; -import { MapPin, User, Clock } from 'lucide-react'; +import { MapPin, User, Clock, CloudLightning } from 'lucide-react'; function getInitials(name) { return (name || '').split(' ').map(w => w[0]).join('').slice(0, 2).toUpperCase(); @@ -93,9 +93,17 @@ export function KanbanCardDisplay({ lead, columnColor, isOverlay = false, onClic {lead.assignedAgentName ?? 'Unassigned'} -
- - {days}d +
+ {lead.stormSource && ( + + + Storm + + )} +
+ + {days}d +
diff --git a/src/pages/CreateLeadPage.jsx b/src/pages/CreateLeadPage.jsx index 0834fd9..2f5f737 100644 --- a/src/pages/CreateLeadPage.jsx +++ b/src/pages/CreateLeadPage.jsx @@ -1,6 +1,6 @@ import React, { useState, useRef, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useLocation } from 'react-router-dom'; import { useTheme } from '../context/ThemeContext'; import { useAuth } from '../context/AuthContext'; import { useMockStore } from '../data/mockStore'; @@ -8,7 +8,7 @@ import { toast } from 'sonner'; import { useRegisterAddress } from '../hooks/useHailRecon'; import { User, MapPin, Briefcase, Shield, Users, - ChevronLeft, Zap, FileText, Save, AlertCircle, + ChevronLeft, Zap, FileText, Save, AlertCircle, CloudLightning, X, } from 'lucide-react'; import LeadSectionWrapper from '../components/leads/LeadSectionWrapper'; import LeadJobSection from '../components/leads/LeadJobSection'; @@ -113,8 +113,13 @@ export default function CreateLeadPage() { const registerAddress = useRegisterAddress(); const isDark = theme === 'dark'; const navigate = useNavigate(); + const location = useLocation(); const [validationError, setValidationError] = useState(''); + // Storm zone context — passed from StormIntelPage via router state + const stormSource = location.state?.stormSource ?? null; + const [stormBannerDismissed, setStormBannerDismissed] = useState(false); + const [isQuickCapture, setIsQuickCapture] = useState(true); const [openSections, setOpenSections] = useState({ contact: true, @@ -123,7 +128,24 @@ export default function CreateLeadPage() { insurance: false, assignment: false, }); - const [formData, setFormData] = useState(INITIAL_FORM); + + // Pre-fill form when arriving from Storm Intel + const [formData, setFormData] = useState(() => { + if (!stormSource) return INITIAL_FORM; + const urgency = (stormSource.severity === 'severe' || stormSource.severity === 'significant') ? 'high' : 'standard'; + const stormDate = stormSource.date + ? new Date(stormSource.date).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) + : ''; + return { + ...INITIAL_FORM, + city: 'Plano', + state: 'TX', + leadSource: 'Door Knock', + urgency, + notes: `Storm zone canvass — ${stormSource.areaName}.${stormSource.maxHailSize ? ` ${stormSource.maxHailSize}" hail` : ''}${stormDate ? ` on ${stormDate}` : ''}.`, + stormSource, + }; + }); const progressBarRef = useRef(null); @@ -400,6 +422,52 @@ export default function CreateLeadPage() { + {/* --- Storm zone banner --- */} + + {stormSource && !stormBannerDismissed && ( + +
+
+ +
+
+

+ Storm Zone Lead +

+

+ {stormSource.areaName} + {stormSource.maxHailSize && ( + + {stormSource.maxHailSize}" hail + + )} +

+

+ Lead source, urgency, and notes pre-filled from storm data. + {(stormSource.severity === 'severe' || stormSource.severity === 'significant') && ( + Urgency set to High. + )} +

+
+ +
+
+ )} +
+ {/* --- Sections --- */}
diff --git a/src/pages/LeadsListPage.jsx b/src/pages/LeadsListPage.jsx index d8e2f72..4bceea3 100644 --- a/src/pages/LeadsListPage.jsx +++ b/src/pages/LeadsListPage.jsx @@ -8,7 +8,7 @@ import PermissionGate from '../components/PermissionGate'; import { Plus, Search, MapPin, Phone, Zap, FileText, Clock, User, ChevronRight, Filter, Lock, - DoorOpen, MessageSquare, + DoorOpen, MessageSquare, CloudLightning, } from 'lucide-react'; // --------------------------------------------------------------------------- @@ -130,6 +130,12 @@ function LeadCard({ lead, index }) { {lead.referralNote} )} + {lead.stormSource && ( + + + Storm Zone + + )}
diff --git a/src/pages/StormIntelPage.jsx b/src/pages/StormIntelPage.jsx index 0459886..d7287b6 100644 --- a/src/pages/StormIntelPage.jsx +++ b/src/pages/StormIntelPage.jsx @@ -254,7 +254,17 @@ const StormDetailDrawer = ({ storm, open, onClose, onFlyTo }) => { const dateLabel = new Date(storm.date).toLocaleDateString('en-US', { weekday: 'short', month: 'long', day: 'numeric', year: 'numeric' }); const handleCreateLead = () => { - navigate('/emp/fa/leads/new'); + navigate('/emp/fa/leads/new', { + state: { + stormSource: { + id: storm.id, + date: storm.date, + areaName: storm.areaName, + maxHailSize: storm.maxHailSize, + severity: storm.severity, + }, + }, + }); }; const handleViewInDispatch = () => {