From e324422f322c5460680a0996df68fd55cc37e970 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Fri, 2 Oct 2026 16:03:54 -0500 Subject: [PATCH] Events: a 16:9 event photo apart from the card background - New Event photo and Photo description (migration 061), shown whole at the top of the event's page, as the front page's featured event, on featured cards, in newsletter picks and as the share preview. - The front page's featured event box is 16:9 (was 16:7). - Card background is only the faded background of the event's card. - Each event's photo starts as its card background, so nothing changes on screen until it's replaced. Co-Authored-By: Claude Opus 5.5 --- server/src/admin-schema/events.js | 2 ++ server/src/migrations/061_event_photo.sql | 20 ++++++++++++++++++++ server/src/pageMeta.js | 2 +- server/src/routes/content.js | 2 ++ server/src/routes/home.js | 5 +++-- server/src/seed-showcase.js | 2 ++ server/src/shape.js | 8 ++++---- src/components/FeaturedCards.tsx | 2 +- src/lib/adminSchema/events.ts | 16 +++++++++++++++- src/lib/useContent.ts | 5 ++++- src/lib/useFrontPage.ts | 3 ++- src/pages/EventDetail.tsx | 9 +++++++++ src/pages/admin/AdminNewsletter.tsx | 2 +- src/pages/sections/home/HeroStage.tsx | 6 +++--- 14 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 server/src/migrations/061_event_photo.sql diff --git a/server/src/admin-schema/events.js b/server/src/admin-schema/events.js index 6274dfb..396f5c3 100644 --- a/server/src/admin-schema/events.js +++ b/server/src/admin-schema/events.js @@ -61,6 +61,8 @@ export const events = { text("event_logo"), text("color"), text("card_image"), + text("photo"), + text("photo_alt"), bool("is_published"), bool("is_listed"), bool("in_timeline"), diff --git a/server/src/migrations/061_event_photo.sql b/server/src/migrations/061_event_photo.sql new file mode 100644 index 0000000..66f02a9 --- /dev/null +++ b/server/src/migrations/061_event_photo.sql @@ -0,0 +1,20 @@ +-- ═══════════════════════════════════════════════════════════════ +-- 061 EVENTS: EVENT PHOTO +-- +-- An event's own 16:9 photo, shown whole: at the top of its page, as +-- the front page's featured event, on featured cards, in newsletter +-- picks and as its page's share preview. photo_alt says what it +-- shows, for screen readers (blank: decoration). +-- +-- card_image (029) goes back to being only the faded background of +-- the event's card, which crops it to the card's shape. Until now it +-- did both jobs, so each event's photo starts as its card +-- background, to keep the front page and previews as they were. +-- +-- v_events selects e.*, so it carries the new columns as it is. +-- ═══════════════════════════════════════════════════════════════ + +ALTER TABLE events ADD COLUMN photo TEXT; +ALTER TABLE events ADD COLUMN photo_alt TEXT; + +UPDATE events SET photo = card_image WHERE card_image IS NOT NULL; diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js index f91ac5a..792f98b 100644 --- a/server/src/pageMeta.js +++ b/server/src/pageMeta.js @@ -199,7 +199,7 @@ function eventMeta(site, db, id, meta) { const when = [row.date_label, row.location_label].filter(Boolean).join(" · "); const image = - imageUrl(site, row.card_image, "eventBackground") ?? + imageUrl(site, row.photo, "eventPhoto") ?? imageUrl(site, row.event_logo, "eventLogo") ?? imageUrl(site, row.effective_org_logo, "organization") ?? meta.image; diff --git a/server/src/routes/content.js b/server/src/routes/content.js index bbe9bb7..4ec6e7e 100644 --- a/server/src/routes/content.js +++ b/server/src/routes/content.js @@ -150,6 +150,8 @@ function shapeEvent(row, links, cardBlocks, hosts = []) { event_logo: row.event_logo, color: row.effective_color, card_image: row.card_image, + photo: row.photo, + photo_alt: row.photo_alt, hosts: hosts.map(shapeHost), diff --git a/server/src/routes/home.js b/server/src/routes/home.js index 467523e..5a8ab80 100644 --- a/server/src/routes/home.js +++ b/server/src/routes/home.js @@ -87,14 +87,15 @@ function statValue(db, row) { } /* The countdown's fields plus what the hero's event card also draws: - its tagline, place, card background and buttons. */ + its tagline, place, photo and buttons. */ function shapeHeroEvent(db, row) { if (!row) return null; const { actions } = splitLinks(loadLinks(db, "event", [row.id]).get(row.id) ?? []); return { ...shapeCountdown(row), tagline: row.tagline, - card_image: row.card_image, + photo: row.photo, + photo_alt: row.photo_alt, org_logo: row.effective_org_logo, links: actions, }; diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js index 550f6f9..6b66af4 100644 --- a/server/src/seed-showcase.js +++ b/server/src/seed-showcase.js @@ -369,6 +369,8 @@ tx(db, () => { event_logo: IMAGE, color: "#d62976", card_image: IMAGE, + photo: IMAGE, + photo_alt: "The showcase test image", is_published: 1, is_listed: LISTED, in_timeline: LISTED, diff --git a/server/src/shape.js b/server/src/shape.js index 4a23395..751bea9 100644 --- a/server/src/shape.js +++ b/server/src/shape.js @@ -203,7 +203,7 @@ export function shapeSeries(row) { `image` is { file, kind }, like the timeline's logo: the record tables keep bare filenames in different public/ directories, and logoForKind in media.ts knows which is which. The kinds are - the ref kinds, plus 'event-background' and 'featured' (the + the ref kinds, plus 'event-photo' and 'featured' (the card's own image). An unpublished record's card is dropped; an unlisted one's stays, since featuring it is attaching it by hand. @@ -213,11 +213,11 @@ const FEATURED_REFS = { event: { sql: (marks) => `SELECT id, title, tagline AS blurb, date_label AS eyebrow, - card_image, event_logo + photo, event_logo FROM events WHERE is_published = 1 AND id IN (${marks})`, image: (row) => - row.card_image - ? { file: row.card_image, kind: "event-background" } + row.photo + ? { file: row.photo, kind: "event-photo" } : row.event_logo ? { file: row.event_logo, kind: "event" } : null, diff --git a/src/components/FeaturedCards.tsx b/src/components/FeaturedCards.tsx index 708052a..9476633 100644 --- a/src/components/FeaturedCards.tsx +++ b/src/components/FeaturedCards.tsx @@ -35,7 +35,7 @@ import { useSmallImage } from '../lib/useSmallImage.ts' /* Image kinds that are photographs, drawn edge to edge. Anything else is a logo, drawn whole. */ -const PHOTO_KINDS = new Set(['event-background', 'featured', 'person']) +const PHOTO_KINDS = new Set(['event-photo', 'featured', 'person']) function hrefFor(card: FeaturedCard): string | null { if (card.kind === 'record' && card.ref) { diff --git a/src/lib/adminSchema/events.ts b/src/lib/adminSchema/events.ts index 5d31d7e..397a49c 100644 --- a/src/lib/adminSchema/events.ts +++ b/src/lib/adminSchema/events.ts @@ -147,13 +147,27 @@ export const events = { { path: "event_logo", label: "Event logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true }, { path: "org_logo", label: "Org logo override", widget: "image", folder: "logos", resolve: mediaUrl, full: true }, { path: "color", label: "Color", widget: "color" }, + { + path: "photo", + label: "Event photo", + widget: "image", + resolve: mediaUrl, + full: true, + help: "16:9, eg. 1920 x 1080, shown whole: at the top of the event's page, as the front page's featured event, on featured cards, in the newsletter and when the page is shared.", + }, + { + path: "photo_alt", + label: "Photo description", + full: true, + help: "What the photo shows, for people who can't see it, eg. Campers around the fire at the 2025 retreat. Default: none (read as decoration).", + }, { path: "card_image", label: "Card background", widget: "image", resolve: mediaUrl, full: true, - help: "A photo behind the event's card, faded so the text stays readable.", + help: "Only behind the event's card, faded so the text stays readable and cropped to the card's shape (about square). Keep the subject centered and leave words out.", }, ], }, diff --git a/src/lib/useContent.ts b/src/lib/useContent.ts index 4707bec..a053b49 100644 --- a/src/lib/useContent.ts +++ b/src/lib/useContent.ts @@ -133,8 +133,11 @@ export type EventRecord = { org_logo?: string | null event_logo?: string | null color?: string | null - /** Behind the card. See 029_event_card_image.sql. */ + /** Behind the card only, cropped. See 029_event_card_image.sql. */ card_image?: string | null + /** The event's own 16:9 photo, shown whole. See 061_event_photo.sql. */ + photo?: string | null + photo_alt?: string | null /* In billing order. The first is the one `color` and `org_logo` fell back to when the event set neither. */ hosts: EventHost[] diff --git a/src/lib/useFrontPage.ts b/src/lib/useFrontPage.ts index f568e72..0605a76 100644 --- a/src/lib/useFrontPage.ts +++ b/src/lib/useFrontPage.ts @@ -111,7 +111,8 @@ export type FeaturedCard = { /** The countdown's event plus what the hero's event card draws. */ export type HeroEvent = CountdownEvent & { tagline?: string | null - card_image?: string | null + photo?: string | null + photo_alt?: string | null org_logo?: string | null links: Link[] } diff --git a/src/pages/EventDetail.tsx b/src/pages/EventDetail.tsx index a237a35..18972f9 100644 --- a/src/pages/EventDetail.tsx +++ b/src/pages/EventDetail.tsx @@ -98,6 +98,15 @@ export default function EventDetail() {
+ {/* The event's own 16:9 photo (not the card's background). */} + {event.photo && ( + {event.photo_alt + )} + {event.description.map((paragraph, index) => (

{paragraph} diff --git a/src/pages/admin/AdminNewsletter.tsx b/src/pages/admin/AdminNewsletter.tsx index 02b8804..5d83216 100644 --- a/src/pages/admin/AdminNewsletter.tsx +++ b/src/pages/admin/AdminNewsletter.tsx @@ -361,7 +361,7 @@ export default function AdminNewsletter() { .filter(Boolean) .join(', '), text: event.tagline ?? event.description?.[0] ?? null, - image: imageFor(event.card_image), + image: imageFor(event.photo), href: siteUrl(eventHref(event.id)), cta: PICK_DEFAULTS.events.cta, }) diff --git a/src/pages/sections/home/HeroStage.tsx b/src/pages/sections/home/HeroStage.tsx index 957feab..7ca877b 100644 --- a/src/pages/sections/home/HeroStage.tsx +++ b/src/pages/sections/home/HeroStage.tsx @@ -463,7 +463,7 @@ function VideoFrame({ it's usually Register. */ function EventPanel({ event }: { event: HeroEvent }) { const color = event.color || 'var(--color-action)' - const photo = mediaUrl(event.card_image) + const photo = mediaUrl(event.photo) const when = seriesLabel(event.series, event.starts_on) ?? event.date_label const where = event.is_online && !event.location_label ? 'Online' : event.location_label @@ -473,11 +473,11 @@ function EventPanel({ event }: { event: HeroEvent }) { style={{ boxShadow: '0 24px 48px -24px rgba(0, 16, 17, 0.6)' }} > {photo ? ( - + {event.photo_alt ) : (