import { Link } from '@tanstack/react-router' import { ChevronRight, Flag as FlagIcon } from 'lucide-react' import type { WeekendContext } from '../../types' import { BriefingStrip, ChampionshipImpactCard, CountdownDisplay, EventPodium, Flag, SeasonNavStrip, } from './shared' import { parseScheduleTime } from '../../lib/schedule' const EYEBROW: Record = { between_races: 'Between races', post_weekend: 'Post-weekend', season_complete: 'Season complete', } function formatSessionLine(name: string | undefined, start: string | undefined): string { if (!name) return 'Schedule to be confirmed' const date = start ? parseScheduleTime(start) : null if (!date) return name const when = date.toLocaleString('en-GB', { weekday: 'long', hour: '2-digit', minute: '2-digit', hour12: false, }) return `${name} ยท ${when}` } export function BetweenRacesView({ context, now }: { context: WeekendContext; now: Date }) { const { last_event, next_event, championship_impact, season_rounds, briefing } = context const eyebrow = EYEBROW[context.state] ?? 'Between races' return (
{eyebrow}
{last_event && (

{last_event.meeting_name}

What decided it? {last_event.story &&

{last_event.story}

} Explore Race Story
)} {next_event ? (

{next_event.meeting_name}

Next event
Next session {formatSessionLine(next_event.next_session_name, next_event.next_session_start)}
Prepare for {next_event.meeting_name.replace(/ Grand Prix$/i, '')}
) : (

That's a wrap

Off-season

The {context.season} calendar is complete. Explore the season's races or revisit the championship battle while the next schedule is confirmed.

Explore the season
)}
{championship_impact && } {season_rounds && season_rounds.length > 0 && }
{briefing && briefing.length > 0 && }
) }