'use client'; import { useRouter } from 'next/navigation'; import { Trophy, Users, Search, Crown, } from 'lucide-react'; import Button from '@/components/ui/Button'; import Input from '@/components/ui/Input'; import Card from '@/components/ui/Card'; import Heading from '@/components/ui/Heading'; import { FeaturedDriverCard } from '@/components/drivers/FeaturedDriverCard'; import { SkillDistribution } from '@/components/drivers/SkillDistribution'; import { CategoryDistribution } from '@/components/drivers/CategoryDistribution'; import { LeaderboardPreview } from '@/components/drivers/LeaderboardPreview'; import { RecentActivity } from '@/components/drivers/RecentActivity'; import { useDriverSearch } from '@/lib/hooks/useDriverSearch'; import type { DriverLeaderboardViewModel } from '@/lib/view-models/DriverLeaderboardViewModel'; interface DriversTemplateProps { data: DriverLeaderboardViewModel | null; } export function DriversTemplate({ data }: DriversTemplateProps) { const drivers = data?.drivers || []; const totalRaces = data?.totalRaces || 0; const totalWins = data?.totalWins || 0; const activeCount = data?.activeCount || 0; const isLoading = false; const router = useRouter(); const { searchQuery, setSearchQuery, filteredDrivers } = useDriverSearch(drivers); const handleDriverClick = (driverId: string) => { router.push(`/drivers/${driverId}`); }; // Featured drivers (top 4) const featuredDrivers = filteredDrivers.slice(0, 4); if (isLoading) { return (

Loading drivers...

); } return (
{/* Hero Section */}
{/* Background decoration */}
Drivers

Meet the racers who make every lap count. From rookies to champions, track their journey and see who's dominating the grid.

{/* Quick Stats */}
{drivers.length} drivers
{activeCount} active
{totalWins.toLocaleString()} total wins
{totalRaces.toLocaleString()} races
{/* CTA */}

See full driver rankings

{/* Search */}
setSearchQuery(e.target.value)} className="pl-11" />
{/* Featured Drivers */} {!searchQuery && (

Featured Drivers

Top performers on the grid

{featuredDrivers.map((driver, index) => ( handleDriverClick(driver.id)} /> ))}
)} {/* Active Drivers */} {!searchQuery && } {/* Skill Distribution */} {!searchQuery && } {/* Category Distribution */} {!searchQuery && } {/* Leaderboard Preview */} {/* Empty State */} {filteredDrivers.length === 0 && (

No drivers found matching "{searchQuery}"

)}
); }