Add a featured event as a hero option

Front page → Feature gains "Featured event" (migration 033): the
event's card beside the headline, with its photo or colour, dates or
schedule, place, tagline, action buttons and a link to its page,
under a "Featured event" badge, over either backdrop.

Front page → Featured event pins one. Blank uses the countdown's
event, and a pinned event that's over or unpublished falls back to
it, so the hero and the countdown never disagree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 20:58:37 -05:00
parent 29202f2eb1
commit d6477b6d30
7 changed files with 187 additions and 11 deletions

View file

@ -20,9 +20,13 @@
video a featured video under a "Featured video" badge.
Never autoplays: an embed waits for play, a file
shows the browser's player
event an event's card under a "Featured event" badge:
its photo, dates, place and buttons. The API picks
the event (pinned, else the countdown's)
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
to brand, a feature with no link set (or no event to show) 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.
@ -33,11 +37,16 @@
import { useEffect, useState, type CSSProperties } from 'react'
import { Link } from 'react-router-dom'
import HomeLink from './HomeLink.tsx'
import DoveMark from '../../../components/DoveMark.tsx'
import PlatformIcon from '../../../components/PlatformIcon.tsx'
import { livestreamEmbedUrl, videoSource, type VideoSource } from '../../../lib/embeds.ts'
import { heroPhoto } from '../../../lib/media.ts'
import type { Hero, HeroBackdrop, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
import { eventBackground, heroPhoto } from '../../../lib/media.ts'
import { eventHref } from '../../../lib/hrefs.ts'
import { seriesLabel } from '../../../lib/eventSeries.ts'
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
const DEEP = '#04262e'
@ -54,9 +63,11 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
? 'livestream'
: hero?.feature === 'video' && hero.video
? 'video'
: 'none'
: hero?.feature === 'event' && hero.event
? 'event'
: 'none'
// Both features share a layout: words left, player right.
// Every feature shares a layout: words left, feature right.
const beside = feature !== 'none'
return (
@ -87,6 +98,12 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
<VideoFrame source={video} url={hero.video.url} title={hero.video.title} />
</div>
)}
{feature === 'event' && hero?.event && (
<div className="lg:col-span-7">
<EventPanel event={hero.event} />
</div>
)}
</div>
</section>
)
@ -111,6 +128,11 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
</span>
)}
</p>
) : feature === 'event' ? (
<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 event
</p>
) : 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>
@ -413,3 +435,71 @@ function VideoFrame({
</div>
)
}
/* ── Featured event ──────────────────────────────────────────── */
/* The event's own card for the hero: its background photo (or its
colour), then what, when and where, then its buttons and a way
to its page. The first action link is the filled button, since
it's usually Register. */
function EventPanel({ event }: { event: HeroEvent }) {
const color = event.color || '#138ba0'
const photo = eventBackground(event.card_image)
const when = seriesLabel(event.series, event.starts_on) ?? event.date_label
const where = event.is_online && !event.location_label ? 'Online' : event.location_label
return (
<div
className="overflow-hidden rounded-3xl border border-white/15 bg-white/10 text-white shadow-2xl backdrop-blur"
style={{ boxShadow: `0 30px 80px -20px ${color}66` }}
>
{photo ? (
<img src={photo} alt="" className="aspect-[16/7] w-full object-cover" />
) : (
<div
aria-hidden="true"
className="aspect-[16/7] w-full"
style={{ background: `linear-gradient(135deg, ${color}, #04262e)` }}
/>
)}
<div className="space-y-4 p-8">
<div>
<h2 className="font-display text-3xl font-extrabold leading-tight md:text-4xl">
<Link to={eventHref(event.id)} className="hover:underline">
{event.title}
</Link>
</h2>
{event.theme && <p className="mt-1 text-lg font-semibold text-[#9fe7d0]">"{event.theme}"</p>}
</div>
{(when || where) && (
<p className="text-lg text-white/85">{[when, where].filter(Boolean).join(' · ')}</p>
)}
{event.tagline && <p className="text-white/70">{event.tagline}</p>}
<div className="flex flex-wrap gap-3 pt-2">
{event.links.map((link, index) => (
<HomeLink
key={link.url}
url={link.url}
className={`inline-flex items-center gap-2 rounded-full px-6 py-3 font-semibold transition-transform hover:scale-105 ${
index === 0 ? 'text-[#04262e]' : 'border border-white/35 text-white hover:bg-white/10'
}`}
style={index === 0 ? { background: 'linear-gradient(120deg, #9fe7d0, #5ce7ff)' } : undefined}
>
<PlatformIcon platform={link.platform} />
{link.label}
</HomeLink>
))}
<Link
to={eventHref(event.id)}
className="rounded-full border border-white/35 px-6 py-3 font-semibold text-white transition-colors hover:bg-white/10"
>
Event details →
</Link>
</div>
</div>
</div>
)
}