import React, { useState } from 'react'; import { useMockStore } from '../../data/mockStore'; import { UserPlus, Flame, CalendarX, FileSignature, AlertCircle, ArrowRight } from 'lucide-react'; import { ActionDetailDrawer } from './ActionDetailDrawer'; export const ActionCenterWidget = () => { const { properties, meetings } = useMockStore(); const [selectedView, setSelectedView] = useState(null); // 'UNASSIGNED', 'HOT', 'RESCHEDULE', 'SIGNATURE', or null // Helper: Logic to filter counts const unassignedLeads = properties.filter(p => !p.assignedAgentId && p.canvassingStatus === 'Lead'); // Last contact check: older than 24h or null const timeThreshold = new Date(Date.now() - 86400000); const hotLeads = properties.filter(p => p.canvassingStatus === 'Hot Lead' && (!p.lastContactDate || new Date(p.lastContactDate) < timeThreshold) ); const rescheduleMeets = meetings.filter(m => m.status === 'Cancelled' || m.status === 'Missed' ); const pendingSignatures = properties.filter(p => p.pendingSignature); const totalUrgent = unassignedLeads.length + hotLeads.length + rescheduleMeets.length + pendingSignatures.length; const cards = [ { id: 'UNASSIGNED', title: 'Unassigned Leads', count: unassignedLeads.length, icon: UserPlus, color: 'text-blue-600 dark:text-blue-400', bg: 'bg-blue-50 dark:bg-blue-900/20', border: 'border-blue-200 dark:border-blue-800' }, { id: 'HOT', title: 'Hot Leads Inactive', count: hotLeads.length, icon: Flame, color: 'text-orange-600 dark:text-orange-400', bg: 'bg-orange-50 dark:bg-orange-900/20', border: 'border-orange-200 dark:border-orange-800' }, { id: 'RESCHEDULE', title: 'Need Reschedule', count: rescheduleMeets.length, icon: CalendarX, color: 'text-rose-600 dark:text-rose-400', bg: 'bg-rose-50 dark:bg-rose-900/20', border: 'border-rose-200 dark:border-rose-800' }, { id: 'SIGNATURE', title: 'Pending Signatures', count: pendingSignatures.length, icon: FileSignature, color: 'text-purple-600 dark:text-purple-400', bg: 'bg-purple-50 dark:bg-purple-900/20', border: 'border-purple-200 dark:border-purple-800' } ]; return (