Let the hero's photos or brand backdrop sit behind a stream or video

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 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-26 18:29:40 -05:00
parent 5b9c8f7391
commit 7eeac6b22f
6 changed files with 104 additions and 40 deletions

View file

@ -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"),

View file

@ -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;

View file

@ -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,

View file

@ -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" },

View file

@ -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

View file

@ -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 (
<section
@ -58,7 +65,7 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
className="relative isolate flex min-h-[92vh] items-center overflow-hidden pt-24 pb-16"
style={{ background: DEEP }}
>
{mode === 'photos' ? (
{backdrop === 'photos' ? (
<PhotoBackdrop slides={slides} seconds={hero?.slide_seconds ?? 7} />
) : (
<BrandBackdrop />
@ -66,16 +73,16 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
<div className="relative z-10 mx-auto grid w-full max-w-7xl items-center gap-12 px-6 lg:grid-cols-12">
<div className={beside ? 'lg:col-span-5' : 'lg:col-span-8'}>
{hero && <Words hero={hero} mode={mode} />}
{hero && <Words hero={hero} feature={feature} />}
</div>
{mode === 'livestream' && hero?.livestream && (
{feature === 'livestream' && hero?.livestream && (
<div className="lg:col-span-7">
<LiveFrame src={embed} url={hero.livestream.url} title={hero.livestream.title} />
</div>
)}
{mode === 'video' && hero?.video && (
{feature === 'video' && hero?.video && (
<div className="lg:col-span-7">
<VideoFrame source={video} url={hero.video.url} title={hero.video.title} />
</div>
@ -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 (
<div className="text-white">
@ -104,7 +111,7 @@ function Words({ hero, mode }: { hero: Hero; mode: 'brand' | 'photos' | 'livestr
</span>
)}
</p>
) : mode === 'video' ? (
) : feature === 'video' ? (
<p className="mb-6 inline-flex items-center gap-3 rounded-full bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
<span className="text-[#9fe7d0]" aria-hidden="true">▶</span>
Featured video