"use client"; import { useEffect, useState } from "react"; import dynamic from "next/dynamic"; import Link from "next/link"; import { useNodes } from "@/lib/useNodes"; import { useActiveCalls } from "@/lib/useCalls"; import { useActiveIncidents } from "@/lib/useIncidents"; import type { IncidentRecord } from "@/lib/types"; const MapView = dynamic(() => import("@/components/MapView"), { ssr: false }); const TYPE_COLORS: Record = { fire: "border-red-800 bg-red-950 text-red-300", police: "border-blue-800 bg-blue-950 text-blue-300", ems: "border-yellow-800 bg-yellow-950 text-yellow-300", accident: "border-orange-800 bg-orange-950 text-orange-300", other: "border-gray-700 bg-gray-900 text-gray-300", }; function IncidentCard({ incident }: { incident: IncidentRecord }) { const cls = TYPE_COLORS[incident.type ?? "other"] ?? TYPE_COLORS.other; return (
{incident.type ?? "other"} {incident.call_ids.length} call{incident.call_ids.length !== 1 ? "s" : ""}

{incident.title ?? "Incident"}

{incident.location && (

{incident.location}

)} {!incident.location_coords && (

location not geocoded yet

)} ); } export default function MapPage() { const { nodes, loading } = useNodes(); const activeCalls = useActiveCalls(); const incidents = useActiveIncidents(); const [kiosk, setKiosk] = useState(false); const [lastUpdated, setLastUpdated] = useState(null); // Track when data last refreshed useEffect(() => { if (!loading) setLastUpdated(new Date()); }, [nodes, activeCalls, incidents, loading]); // Kiosk mode: full-viewport fixed overlay sits above the sticky nav (z-40 → z-50) if (kiosk) { return (
); } return (

Map

{loading ? (
Loading map…
) : (
)} {incidents.length > 0 && (

Active Incidents ({incidents.length})

{incidents.map((inc) => ( ))}
)}
); }