"use client" import { Popup } from "react-map-gl/mapbox" import { Badge } from "@/app/_components/ui/badge" import { Card } from "@/app/_components/ui/card" import { Separator } from "@/app/_components/ui/separator" import { Button } from "@/app/_components/ui/button" import { MapPin, AlertTriangle, Calendar, Clock, Tag, Bookmark, FileText, Navigation, X } from "lucide-react" interface CrimePopupProps { longitude: number latitude: number onClose: () => void crime: { id: string district?: string category?: string type?: string description?: string status?: string address?: string timestamp?: Date latitude?: number longitude?: number } } export default function CrimePopup({ longitude, latitude, onClose, crime }: CrimePopupProps) { const formatDate = (date?: Date) => { if (!date) return "Unknown date" return new Date(date).toLocaleDateString() } const formatTime = (date?: Date) => { if (!date) return "Unknown time" return new Date(date).toLocaleTimeString() } const getStatusBadge = (status?: string) => { if (!status) return Unknown const statusLower = status.toLowerCase() if (statusLower.includes("resolv") || statusLower.includes("closed")) { return Resolved } if (statusLower.includes("progress") || statusLower.includes("invest")) { return In Progress } if (statusLower.includes("open") || statusLower.includes("new")) { return Open } return {status} } // Determine border color based on status const getBorderColor = (status?: string) => { if (!status) return "border-l-gray-400" const statusLower = status.toLowerCase() if (statusLower.includes("resolv") || statusLower.includes("closed")) { return "border-l-emerald-600" } if (statusLower.includes("progress") || statusLower.includes("invest")) { return "border-l-amber-500" } if (statusLower.includes("open") || statusLower.includes("new")) { return "border-l-blue-600" } return "border-l-gray-400" } return (
{/* Custom close button */}

{crime.category || "Unknown Incident"}

{getStatusBadge(crime.status)}
{crime.description && (

{crime.description}

)} {/* Improved section headers */}
{crime.district && (

District

{crime.district}

)} {crime.address && (

Location

{crime.address}

)} {crime.timestamp && ( <>

Date

{formatDate(crime.timestamp)}

Time

{formatTime(crime.timestamp)}

)} {crime.type && (

Type

{crime.type}

)}

Coordinates: {latitude.toFixed(6)}, {longitude.toFixed(6)}

ID: {crime.id}

) }