interface RecentSession { id: string; date: string; type: string; track: string; duration: number; players: number; } interface RecentSessionsProps { sessions: RecentSession[]; } export function RecentSessions({ sessions }: RecentSessionsProps) { const formatDuration = (minutes: number) => { const hours = Math.floor(minutes / 60); const mins = minutes % 60; return hours > 0 ? `${hours}h ${mins}m` : `${mins}m`; }; const formatDate = (dateString: string) => { return new Date(dateString).toLocaleDateString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }); }; if (sessions.length === 0) { return (
| Date | Type | Track | Duration | Players |
|---|---|---|---|---|
| {formatDate(session.date)} | {session.type === 'R' ? 'Race' : session.type === 'Q' ? 'Qualify' : 'Practice'} | {session.track} | {formatDuration(session.duration)} | {session.players} |