/* ═══════════════════════════════════════════════════════════════ FRONT PAGE DATA GET /front-page, as routes/home.js shapes it: the hero, the visible sections in order, counted stats, paths with actions, and the countdown's event. Edited in the admin under Front page. No fallback content. If the request fails the page says so — a plausible default home page would hide a broken server behind something that looks fine. ═══════════════════════════════════════════════════════════════ */ import { useRecord, type Resource } from './useRecord.ts' import type { EventSeries } from './eventSeries.ts' export type HeroMode = 'brand' | 'photos' | 'livestream' /** The CHECK list on front_page_sections.section. */ export type FrontPageSectionKey = | 'countdown' | 'retreats' | 'calendar' | 'stats' | 'timeline' | 'connect' export type HeroButton = { label: string; url: string } export type HeroSlide = { media: string alt?: string | null caption?: string | null link_url?: string | null } export type Hero = { mode: HeroMode eyebrow?: string | null headline: string subhead?: string | null primary: HeroButton | null secondary: HeroButton | null slide_seconds: number slides: HeroSlide[] livestream: { url: string; title?: string | null } | null } export type FrontPageSection = { section: FrontPageSectionKey /** Null → the section's own heading. */ title?: string | null blurb?: string | null } export type FrontPageStat = { label: string /** Already counted or typed; never null — the API drops those. */ value: string suffix?: string | null note?: string | null } export type PathAction = { label: string; description?: string | null; url: string } export type FrontPagePath = { label: string icon?: string | null blurb?: string | null actions: PathAction[] } export type CountdownEvent = { id: string title: string theme?: string | null starts_on?: string | null ends_on?: string | null date_label?: string | null location_label?: string | null is_online: boolean color?: string | null event_logo?: string | null series: EventSeries | null } export type FrontPage = { hero: Hero sections: FrontPageSection[] stats: FrontPageStat[] paths: FrontPagePath[] countdown: CountdownEvent | null } export const useFrontPage = (): Resource => useRecord('/front-page', 'front_page')