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 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-02 16:03:54 -05:00
parent b816203c0c
commit e324422f32
14 changed files with 69 additions and 15 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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