import { CountryFlagDisplay } from '@/lib/display-objects/CountryFlagDisplay'; import { Box } from './Box'; import { Image } from './Image'; import { Stack } from './Stack'; import { Surface } from './Surface'; import { Text } from './Text'; interface ResultEntry { position: number; driverId: string; driverName: string; driverAvatar: string; country: string; car: string; laps: number; time: string; fastestLap: string; points: number; incidents: number; isCurrentUser: boolean; } interface RaceResultRowProps { result: ResultEntry; points: number; } export function RaceResultRow({ result, points }: RaceResultRowProps) { const { isCurrentUser, position, driverAvatar, driverName, country, car, laps, incidents, time, fastestLap } = result; const getPositionColor = (pos: number) => { if (pos === 1) return { bg: 'bg-yellow-500/20', color: 'text-yellow-400' }; if (pos === 2) return { bg: 'bg-gray-400/20', color: 'text-gray-300' }; if (pos === 3) return { bg: 'bg-amber-600/20', color: 'text-amber-600' }; return { bg: 'bg-iron-gray/50', color: 'text-gray-500' }; }; const posConfig = getPositionColor(position); return ( {/* Position */} {position} {/* Avatar */} {driverName} {CountryFlagDisplay.fromCountryCode(country).toString()} {/* Driver Info */} {driverName} {isCurrentUser && ( YOU )} {car} Laps: {laps} Incidents: {incidents} {/* Times */} {time} FL: {fastestLap} {/* Points */} PTS {points} ); }