import { Link } from '@tanstack/react-router' import { ChevronRight } from 'lucide-react' import type { WeekendContext } from '../../types' import { RacePreviewPage } from '../../pages/RacePreviewPage' import { ChampionshipRoundStrip, CountdownDisplay, Flag, SessionRail, railNodes } from './shared' import { meetingIdentity } from '../../lib/weekendContext' /** * PreSessionView folds the race preview surface into the Weekend home so there is * no separate Preview destination. It reuses the existing preview page content and * frames it with the next-session countdown and compact season navigation. It also * backs the /preview alias, so saved preview links resolve here instead of looping. */ export function PreSessionView({ context, now }: { context: WeekendContext; now: Date }) { const meeting = meetingIdentity(context.next_meeting ?? context.focus_meeting) const next = context.next_session?.session const nextStart = next?.date_start ?? meeting?.date_start const nodes = railNodes( context.previous_completed_session, context.active_session, context.next_session, ) return (
Pre-session
{meeting && (

{meeting.meeting_name}

{next?.session_name ?? 'Next session'}
Live timing
)} {nodes.length > 0 && }
) }