Replace the front page with an admin-driven home
The home page is rebuilt from scratch and configured from a new Front page tab in the admin, backed by migration 017 and served by GET /api/front-page. Hero: brand, photos (crossfading slideshow with progress and pause) or livestream (YouTube/Facebook/Vimeo embed with a LIVE badge), switched by hand. After it, bands the admin can reorder, retitle or hide: a countdown to the next event (series-aware), the National Retreats carousel, a numbers band (typed in or counted from the database), a horizontal rail of featured timeline entries, and a "Find your way in" pathfinder replacing the old connect section. The CRUD engine gains a `singleton` flag: the entity has one row, made by its migration, and create and delete are refused. The list screen opens that row and the editor drops the slug, back link and delete. shapeSeries moves to shape.js so /front-page can share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b4b013209b
commit
6a69084de2
25 changed files with 2299 additions and 494 deletions
89
src/lib/useFrontPage.ts
Normal file
89
src/lib/useFrontPage.ts
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
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' | '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<FrontPage> =>
|
||||
useRecord<FrontPage>('/front-page', 'front_page')
|
||||
Loading…
Add table
Add a link
Reference in a new issue