feat(#73): Adaptive Weekend shell and responsive navigation

Implemented by claude via .agents/dev dispatch.
This commit is contained in:
2026-07-12 18:09:43 -04:00
parent ba55945b6f
commit 06223d992f
18 changed files with 1932 additions and 732 deletions

View File

@@ -15,6 +15,7 @@ import type {
Session,
TrackOutline,
Weekend,
WeekendContext,
} from './types'
export async function fetchRaceHub(sessionKey: number): Promise<RaceHub> {
@@ -114,6 +115,24 @@ export async function fetchWeekend(meetingKey: number): Promise<Weekend> {
return res.json()
}
// fetchWeekendContext consumes the canonical /api/v1/weekend-context endpoint
// (sibling backend story #72). It resolves to null when the endpoint is not yet
// available (404 / server without the handler) so the Weekend page can fall back
// to client-side derivation from existing endpoints. Any other HTTP error throws.
export async function fetchWeekendContext(): Promise<WeekendContext | null> {
let res: Response
try {
res = await fetch('/api/v1/weekend-context')
} catch {
return null
}
if (res.status === 404) return null
if (!res.ok) {
throw new Error(`API ${res.status}: ${res.statusText}`)
}
return res.json()
}
export async function fetchChampionshipHub(year?: number): Promise<ChampionshipHub> {
const params = new URLSearchParams({ source: 'auto' })
if (year) params.set('year', year.toString())