import React from 'react' import { Activity, Calendar, CheckCircle, AlertTriangle, LineChart, PieChart, FileText } from 'lucide-react' import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/app/_components/ui/card" import { Separator } from "@/app/_components/ui/separator" import { cn } from "@/app/_lib/utils" import { getMonthName } from "@/app/_utils/common" import { SidebarSection } from "../components/sidebar-section" import { StatCard } from "../components/stat-card" import { CrimeTypeCard } from "../components/crime-type-card" interface SidebarStatisticsTabProps { crimeStats: any selectedMonth?: number | "all" selectedYear: number } export function SidebarStatisticsTab({ crimeStats, selectedMonth = "all", selectedYear }: SidebarStatisticsTabProps) { const topCategories = crimeStats.categoryCounts ? Object.entries(crimeStats.categoryCounts) .sort((a: any, b: any) => (b[1] as number) - (a[1] as number)) .slice(0, 4) .map(([type, count]: [string, unknown]) => { const countAsNumber = count as number; const percentage = Math.round(((countAsNumber) / crimeStats.totalIncidents) * 100) || 0 return { type, count: countAsNumber, percentage } }) : [] return ( <> Monthly Incidents {selectedYear}
{crimeStats.incidentsByMonth.map((count: number, i: number) => { const maxCount = Math.max(...crimeStats.incidentsByMonth) const height = maxCount > 0 ? (count / maxCount) * 100 : 0 return (
) })}
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
}>
} bgColor="bg-gradient-to-r from-blue-900/30 to-blue-800/20" /> c > 0).length || 1) ).toString()} change={selectedMonth !== 'all' ? `in ${getMonthName(Number(selectedMonth))}` : "per active month"} isPositive={false} icon={} bgColor="bg-gradient-to-r from-amber-900/30 to-amber-800/20" /> 50} icon={} bgColor="bg-gradient-to-r from-green-900/30 to-green-800/20" />
}>
{topCategories.length > 0 ? ( topCategories.map((category: any) => ( )) ) : (

No crime data available

Try selecting a different time period

)}
) }