'use client'; import { routes } from '@/lib/routing/RouteConfig'; import { Card } from '@/ui/Card'; import { Icon } from '@/ui/Icon'; import { Link } from '@/ui/Link'; import { Stack } from '@/ui/primitives/Stack'; import { Text } from '@/ui/Text'; import { ChevronRight } from 'lucide-react'; interface RaceResultCardProps { raceId: string; track: string; car: string; scheduledAt: string | Date; position: number; startPosition: number; incidents: number; leagueName?: string; showLeague?: boolean; onClick?: () => void; } export function RaceResultCard({ raceId, track, car, scheduledAt, position, startPosition, incidents, leagueName, showLeague = true, onClick, }: RaceResultCardProps) { const getPositionStyles = (pos: number) => { if (pos === 1) return { color: 'text-warning-amber', bg: 'bg-warning-amber', bgOpacity: 0.2 }; if (pos === 2) return { color: 'text-gray-300', bg: 'bg-gray-400', bgOpacity: 0.2 }; if (pos === 3) return { color: 'text-amber-600', bg: 'bg-amber-600', bgOpacity: 0.2 }; return { color: 'text-gray-400', bg: 'bg-base-black', bgOpacity: 0.5 }; }; const positionStyles = getPositionStyles(position); return ( P{position} {track} {car} {new Date(scheduledAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', })} {showLeague && leagueName && ( {leagueName} )} Started P{startPosition} 2 ? 'text-error-red' : 'text-gray-500'}> {incidents}x incidents {position < startPosition && ( <> +{startPosition - position} positions )} ); }