"use client" import { useState, useEffect } from 'react'; import { Button } from '@/app/_components/ui/button'; import { AlertTriangle, Bell, ShieldAlert, Radio, RadioTower, Shield } from 'lucide-react'; import { cn } from '@/app/_lib/utils'; import { Badge } from '@/app/_components/ui/badge'; import { IIncidentLog } from '@/app/_utils/types/ews'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/app/_components/ui/tooltip"; interface PanicButtonDemoProps { onTriggerAlert: (priority: 'high' | 'medium' | 'low') => void; onResolveAllAlerts: () => void; activeIncidents: IIncidentLog[]; className?: string; onPanicTriggered?: () => void; // New callback for notifying parent about panic trigger } export default function PanicButtonDemo({ onTriggerAlert, onResolveAllAlerts, activeIncidents, className, onPanicTriggered }: PanicButtonDemoProps) { const [isTriggering, setIsTriggering] = useState(false); const [activeButton, setActiveButton] = useState(null); const handleTriggerPanic = (priority: 'high' | 'medium' | 'low') => { setIsTriggering(true); setActiveButton(priority); onTriggerAlert(priority); // Notify parent component that panic was triggered if (onPanicTriggered) { onPanicTriggered(); } // Reset animation setTimeout(() => { setIsTriggering(false); setActiveButton(null); }, 1000); }; return (
{/* High Priority Alert Button */}

Send High Priority Alert

{/* Medium Priority Alert Button */}

Send Medium Priority Alert

{/* Low Priority Alert Button */}

Send Low Priority Alert

{/* Resolve All Alerts Button (only shown when there are active incidents) */} {activeIncidents.length > 0 && (

Resolve All Active Alerts ({activeIncidents.length})

)}
); }