"use client" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" interface DetectionChartProps { potholes: number signboards: number isLoading?: boolean } export function DetectionChart({ potholes, signboards, isLoading }: DetectionChartProps) { const total = potholes + signboards const potholePercent = total > 0 ? (potholes / total) * 100 : 50 const signboardPercent = total > 0 ? (signboards / total) * 100 : 50 return ( Detection Distribution {isLoading ? (
) : total === 0 ? (
No detections yet
) : (
{/* Donut Chart */}
{/* Background circle */} {/* Potholes arc */} {/* Signboards arc */}

{total}

Total

{/* Legend */}
Potholes

{potholes}

{potholePercent.toFixed(0)}%

Signboards

{signboards}

{signboardPercent.toFixed(0)}%

)} ) }