'use client'; import { BarChart3 } from 'lucide-react'; import type { DriverLeaderboardItemViewModel } from '@/lib/view-models/DriverLeaderboardItemViewModel'; const CATEGORIES = [ { id: 'beginner', label: 'Beginner', color: 'text-green-400', bgColor: 'bg-green-400/10', borderColor: 'border-green-400/30' }, { id: 'intermediate', label: 'Intermediate', color: 'text-primary-blue', bgColor: 'bg-primary-blue/10', borderColor: 'border-primary-blue/30' }, { id: 'advanced', label: 'Advanced', color: 'text-purple-400', bgColor: 'bg-purple-400/10', borderColor: 'border-purple-400/30' }, { id: 'pro', label: 'Pro', color: 'text-yellow-400', bgColor: 'bg-yellow-400/10', borderColor: 'border-yellow-400/30' }, { id: 'endurance', label: 'Endurance', color: 'text-orange-400', bgColor: 'bg-orange-400/10', borderColor: 'border-orange-400/30' }, { id: 'sprint', label: 'Sprint', color: 'text-red-400', bgColor: 'bg-red-400/10', borderColor: 'border-red-400/30' }, ]; interface CategoryDistributionProps { drivers: DriverLeaderboardItemViewModel[]; } export function CategoryDistribution({ drivers }: CategoryDistributionProps) { const distribution = CATEGORIES.map((category) => ({ ...category, count: drivers.filter((d) => d.category === category.id).length, percentage: drivers.length > 0 ? Math.round((drivers.filter((d) => d.category === category.id).length / drivers.length) * 100) : 0, })); return (
Driver population by category
{category.label}
{category.percentage}% of drivers