From 7eeac6b22f97cd7ffe82f392ffd9f2867c6ffcaf Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Sat, 26 Sep 2026 18:29:40 -0500 Subject: [PATCH] Let the hero's photos or brand backdrop sit behind a stream or video MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hero_mode answered two questions with one value, so a livestream or featured video could only ever sit on the brand backdrop. It's now two settings: Background brand | photos Beside the words nothing | livestream | featured video Any background goes with any feature: the photo slideshow can run behind the stream, with its captions, progress bars and pause button as before. The fallbacks are unchanged: photos with none added shows brand, and a feature with no link set shows nothing beside the words. Migration 025 adds hero_backdrop and hero_feature, maps each row's hero_mode onto them (photos → photos + nothing, livestream/video → brand + that feature, brand → brand + nothing) and drops hero_mode. ADD/DROP COLUMN rather than a rebuild, so front_page's children and touch trigger are untouched. The API's hero sends `backdrop` and `feature` in place of `mode`. Co-Authored-By: Claude Opus 5.5 --- server/src/admin-schema.js | 5 +- .../migrations/025_hero_backdrop_feature.sql | 40 +++++++++++ server/src/routes/home.js | 3 +- src/lib/adminSchema.ts | 20 ++++-- src/lib/useFrontPage.ts | 9 ++- src/pages/sections/home/HeroStage.tsx | 67 ++++++++++--------- 6 files changed, 104 insertions(+), 40 deletions(-) create mode 100644 server/src/migrations/025_hero_backdrop_feature.sql diff --git a/server/src/admin-schema.js b/server/src/admin-schema.js index f292863..30c63f9 100644 --- a/server/src/admin-schema.js +++ b/server/src/admin-schema.js @@ -669,14 +669,15 @@ const frontPage = { concurrency: "updated_at", list: { - columns: ["id", "headline", "hero_mode", "updated_at"], + columns: ["id", "headline", "hero_backdrop", "hero_feature", "updated_at"], filters: [], search: [], order: "id", }, columns: [ - enumeration("hero_mode", ["brand", "photos", "livestream", "video"]), + enumeration("hero_backdrop", ["brand", "photos"]), + enumeration("hero_feature", ["none", "livestream", "video"]), text("eyebrow"), text("headline"), text("subhead"), diff --git a/server/src/migrations/025_hero_backdrop_feature.sql b/server/src/migrations/025_hero_backdrop_feature.sql new file mode 100644 index 0000000..c85e1ff --- /dev/null +++ b/server/src/migrations/025_hero_backdrop_feature.sql @@ -0,0 +1,40 @@ +-- ═══════════════════════════════════════════════════════════════ +-- 025 HERO: BACKDROP AND FEATURE ARE SEPARATE CHOICES +-- +-- hero_mode answered two questions with one value: what fills the +-- background (the brand animation or the photo slideshow) and what +-- sits beside the words (nothing, a livestream or a featured +-- video). A stream or a video could only ever sit on the brand +-- backdrop. Split, any backdrop goes with any feature. +-- +-- hero_backdrop 'brand' | 'photos' +-- hero_feature 'none' | 'livestream' | 'video' +-- +-- Today's modes map across exactly: photos → photos + none; +-- livestream and video → brand + that feature; brand → brand + +-- none. Photos mode still falls back to brand on the page when +-- there are no photos, as before. +-- +-- ADD COLUMN takes a constant DEFAULT and a CHECK, and DROP COLUMN +-- allows a column whose only constraint is its own CHECK, so no +-- rebuild: front_page's children and its touch trigger are never +-- touched. +-- +-- PRAGMA user_version; -- reads 24 before this file +-- ═══════════════════════════════════════════════════════════════ + +ALTER TABLE front_page ADD COLUMN hero_backdrop TEXT NOT NULL DEFAULT 'brand' + CHECK (hero_backdrop IN ('brand', 'photos')); + +ALTER TABLE front_page ADD COLUMN hero_feature TEXT NOT NULL DEFAULT 'none' + CHECK (hero_feature IN ('none', 'livestream', 'video')); + +UPDATE front_page + SET hero_backdrop = CASE hero_mode WHEN 'photos' THEN 'photos' ELSE 'brand' END, + hero_feature = CASE hero_mode + WHEN 'livestream' THEN 'livestream' + WHEN 'video' THEN 'video' + ELSE 'none' + END; + +ALTER TABLE front_page DROP COLUMN hero_mode; diff --git a/server/src/routes/home.js b/server/src/routes/home.js index 2f5da60..90e65ca 100644 --- a/server/src/routes/home.js +++ b/server/src/routes/home.js @@ -159,7 +159,8 @@ home.get("/front-page", (c) => { return json(c, { front_page: { hero: { - mode: page.hero_mode, + backdrop: page.hero_backdrop, + feature: page.hero_feature, eyebrow: page.eyebrow, headline: page.headline, subhead: page.subhead, diff --git a/src/lib/adminSchema.ts b/src/lib/adminSchema.ts index 10f685c..cbb4457 100644 --- a/src/lib/adminSchema.ts +++ b/src/lib/adminSchema.ts @@ -994,16 +994,26 @@ const frontPage = { note: "The first thing a visitor sees. Blank buttons don't render.", fields: [ { - path: "hero_mode", - label: "Mode", + path: "hero_backdrop", + label: "Background", widget: "select", options: [ - ["brand", "Brand — animated colour, no media"], + ["brand", "Brand — animated colour and the dove"], ["photos", "Photos — cycles through the photos below"], - ["livestream", "Livestream — embeds the stream with a LIVE badge"], - ["video", "Featured video — shows the video below, click to play"], ], blankLabel: "— brand —", + help: "Photos with none added shows the brand background", + }, + { + path: "hero_feature", + label: "Beside the words", + widget: "select", + options: [ + ["none", "Nothing — the words fill the hero"], + ["livestream", "Livestream — the stream, with a LIVE badge"], + ["video", "Featured video — click to play"], + ], + blankLabel: "— nothing —", help: "Switch to Livestream when you go live, and back when you're done", }, { path: "eyebrow", label: "Eyebrow", help: "Small line above the headline" }, diff --git a/src/lib/useFrontPage.ts b/src/lib/useFrontPage.ts index 6169ca5..475beea 100644 --- a/src/lib/useFrontPage.ts +++ b/src/lib/useFrontPage.ts @@ -13,7 +13,11 @@ import { useRecord, type Resource } from './useRecord.ts' import type { EventSeries } from './eventSeries.ts' -export type HeroMode = 'brand' | 'photos' | 'livestream' | 'video' +/** What fills the hero's background. */ +export type HeroBackdrop = 'brand' | 'photos' + +/** What sits beside the words, over the backdrop. */ +export type HeroFeature = 'none' | 'livestream' | 'video' /** The CHECK list on front_page_sections.section. */ export type FrontPageSectionKey = @@ -34,7 +38,8 @@ export type HeroSlide = { } export type Hero = { - mode: HeroMode + backdrop: HeroBackdrop + feature: HeroFeature eyebrow?: string | null headline: string subhead?: string | null diff --git a/src/pages/sections/home/HeroStage.tsx b/src/pages/sections/home/HeroStage.tsx index b344c7e..de71fdf 100644 --- a/src/pages/sections/home/HeroStage.tsx +++ b/src/pages/sections/home/HeroStage.tsx @@ -1,24 +1,30 @@ /* ═══════════════════════════════════════════════════════════════ HERO STAGE - The top of the front page, in whichever mode the admin set: + The top of the front page. Two choices the admin makes + separately, so any backdrop goes with any feature: + + Backdrop, what fills the background: brand drifting colour and slow concentric rings — many - circles, one centre — behind the words, with the - dove at that centre + circles, one centre — with the dove at that centre photos the hero photos, crossfading with a slow zoom, a progress bar per photo and a pause button (anything that moves on its own for more than five seconds needs one) - livestream the stream beside the words, with a LIVE badge - video a featured video beside the words, under a - "Featured video" badge. Never autoplays: an embed - waits for play, a file shows the browser's player - A mode that has nothing to show falls back to brand: photos with - no photos, or livestream/video with no link set. A link that - can't be framed still gets a "Watch live" or "Watch the video" - button, so switching the mode on is never a no-op. + Feature, what sits beside the words over that backdrop: + + none nothing; the words take the width + livestream the stream, with a LIVE badge above the headline + video a featured video under a "Featured video" badge. + Never autoplays: an embed waits for play, a file + shows the browser's player + + A choice with nothing to show falls back: photos with no photos + to brand, a feature with no link set to none. A link that can't + be framed still gets a "Watch live" or "Watch the video" button, + so switching a feature on is never a no-op. `hero` is null while the page config loads or when it failed; the stage still draws, empty, so the page doesn't jump when it @@ -31,7 +37,7 @@ import HomeLink from './HomeLink.tsx' import DoveMark from '../../../components/DoveMark.tsx' import { livestreamEmbedUrl, videoSource, type VideoSource } from '../../../lib/embeds.ts' import { heroPhoto } from '../../../lib/media.ts' -import type { Hero, HeroSlide } from '../../../lib/useFrontPage.ts' +import type { Hero, HeroBackdrop, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts' const DEEP = '#04262e' @@ -40,17 +46,18 @@ export default function HeroStage({ hero }: { hero: Hero | null }) { const embed = livestreamEmbedUrl(hero?.livestream?.url) const video = videoSource(hero?.video?.url) - const mode = - hero?.mode === 'photos' && slides.length > 0 - ? 'photos' - : hero?.mode === 'livestream' && hero.livestream - ? 'livestream' - : hero?.mode === 'video' && hero.video - ? 'video' - : 'brand' + const backdrop: HeroBackdrop = + hero?.backdrop === 'photos' && slides.length > 0 ? 'photos' : 'brand' - // Livestream and video share a layout: words left, player right. - const beside = mode === 'livestream' || mode === 'video' + const feature: HeroFeature = + hero?.feature === 'livestream' && hero.livestream + ? 'livestream' + : hero?.feature === 'video' && hero.video + ? 'video' + : 'none' + + // Both features share a layout: words left, player right. + const beside = feature !== 'none' return (
- {mode === 'photos' ? ( + {backdrop === 'photos' ? ( ) : ( @@ -66,16 +73,16 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
- {hero && } + {hero && }
- {mode === 'livestream' && hero?.livestream && ( + {feature === 'livestream' && hero?.livestream && (
)} - {mode === 'video' && hero?.video && ( + {feature === 'video' && hero?.video && (
@@ -87,10 +94,10 @@ export default function HeroStage({ hero }: { hero: Hero | null }) { /* ── The words ───────────────────────────────────────────────── */ -function Words({ hero, mode }: { hero: Hero; mode: 'brand' | 'photos' | 'livestream' | 'video' }) { +function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) { const words = hero.headline.split(/\s+/).filter(Boolean) - const live = mode === 'livestream' - const beside = live || mode === 'video' + const live = feature === 'livestream' + const beside = feature !== 'none' return (
@@ -104,7 +111,7 @@ function Words({ hero, mode }: { hero: Hero; mode: 'brand' | 'photos' | 'livestr )}

- ) : mode === 'video' ? ( + ) : feature === 'video' ? (

Featured video