Present: the whole event page, in sections at its headings

The presentation (now EventPresent) cuts the event's page into
sections at its Heading blocks: a section's text on one slide, then
its schedules' slides, a map block's map and each location lit up,
and an events block's grid and each event. One Present button on the
event page replaces the schedule's. Setup lists the sections, each
schedule's days and entries under its own; the address keys are now
skip and hide, numbered by schedule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-11-09 03:41:21 -06:00
parent 818d648e91
commit df8052c75e
9 changed files with 635 additions and 260 deletions

View file

@ -35,7 +35,8 @@ import { mediaUrl } from '../lib/media.ts'
import { eventTypeLabel } from '../lib/eventTypes.ts'
import { occurrenceLabel, seriesLabel, seriesTimes, upcomingOccurrences } from '../lib/eventSeries.ts'
import { capitalize } from '../lib/text.ts'
import { accentText, readableOn, BRAND } from '../lib/color.ts'
import { accentText, readableOn, withAlpha, BRAND } from '../lib/color.ts'
import { Presentation } from '@phosphor-icons/react'
const BODY = 'var(--color-muted)'
@ -109,7 +110,22 @@ export default function EventDetail() {
)}
<div className="max-w-3xl">
<ContentBlocks blocks={event.blocks} accent={accent} presentAt={`/events/${encodeURIComponent(event.id)}/present`} />
{/* The page as a slideshow for a screen (EventPresent.tsx). */}
{event.blocks.length > 0 && (
<div className="mb-6 flex justify-end">
<Link
to={`/events/${encodeURIComponent(event.id)}/present`}
target="_blank"
className="btn inline-flex items-center gap-2 border px-4 py-2 text-sm transition-colors hover:bg-tint"
style={{ borderColor: withAlpha(accent, 33), color: accentText(accent) }}
>
<Presentation aria-hidden="true" weight="bold" className="h-4 w-4" />
Present
<span className="sr-only">(opens in a new tab)</span>
</Link>
</div>
)}
<ContentBlocks blocks={event.blocks} accent={accent} />
</div>
{event.links.length > 0 && (

View file

@ -1,4 +1,4 @@
/* The schedule presentation's motion (SchedulePresent.tsx). The
/* The event presentation's motion (EventPresent.tsx). The
reduced motion rule in index.css stops all of it. */
.present-in {

View file

@ -1,16 +1,23 @@
/* ═══════════════════════════════════════════════════════════════
SCHEDULE PRESENTATION: /events/:id/present?block=<n>
EVENT PRESENTATION: /events/:id/present
An event's schedule block as an endless slideshow for a screen
(digital signage), opened from the block's Present button. Outside
the site's Layout: no header, footer or backdrop.
An event page's content blocks as an endless slideshow for a
screen (digital signage), opened from the page's Present button.
Outside the site's Layout: no header, footer or backdrop.
First a setup screen: which days and entries, and how many seconds
each kind of slide stays up (0 leaves that kind out). Play writes
the choices into the address, so a signage device can bookmark it
and start the same way every time (`play=1` skips the setup).
The page is cut into sections at its Heading blocks (the blocks
before the first are a section under the event's title). Each
section, in order, gives:
section its text blocks (everything but the kinds below) on
one slide under its heading, scrolling if long
schedule each schedule block's slides (below)
venue each map block (088): the map with its locations
place then the map once per marked location, it lit up
cards each events block (088): its events on one slide
event then each event alone: picture, title, card text
and its person host
The slides, for each day picked, in order:
A schedule's slides, for each day picked, in order:
overview the day's picked entries on one slide
spotlight one entry: its person beside title, time and place
block a block entry (086) and its sub-items on one slide,
@ -21,10 +28,20 @@
tag after the days: each of the schedule's tags (087)
and everything it's on, under each day's name
A heading (086) is only a line on the overview; a break gets no
spotlight. A slide with more than the screen holds waits half its
seconds, scrolls to the end at "Scroll" seconds a screenful
(`screen=`), then waits the other half. "Only entries tagged" (`only=<key>`) cuts every slide
to what one tag is on, eg. for a screen outside the youth room.
spotlight. "Only entries tagged" (`only=<key>`) cuts every
schedule slide to what one tag is on, eg. for a screen outside the
youth room.
First a setup screen: which sections, days and entries, and how
many seconds each kind of slide stays up (0 leaves that kind out).
Play writes the choices into the address, so a signage device can
bookmark it and start the same way every time (`play=1` skips the
setup): `skip` the sections left out, by number; `hide` the days
(schedule.day), entries (schedule.day.entry) and sub-items
(schedule.day.entry.item) left out, a schedule numbered among the
page's schedules. A slide with more than the screen holds waits
half its seconds, scrolls to the end at "Scroll" seconds a
screenful (`screen=`), then waits the other half.
Keys while playing: arrows step, Space pauses, Escape leaves full
screen (the browser's), S goes back to the setup.
@ -47,54 +64,99 @@ import {
withTag,
type Day,
} from '../components/ScheduleBlock.tsx'
import ContentBlocks, { eventLine } from '../components/ContentBlocks.tsx'
import { LocationNumber, MapPicture, isMarked, locationNumber } from '../components/MapBlock.tsx'
import { Paragraphs } from '../components/InlineText.tsx'
import { useEvent, type ContentBlockItem, type ScheduleTag } from '../lib/useContent.ts'
import {
useEvent,
type ContentBlock,
type ContentBlockItem,
type ScheduleTag,
type Venue,
type VenueLocation,
} from '../lib/useContent.ts'
import { mediaUrl } from '../lib/media.ts'
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
import { documentTitle } from '../lib/site.ts'
import './SchedulePresent.css'
import './EventPresent.css'
/* Each kind of slide, its address key and seconds when unset. */
const KINDS = [
{ key: 'overview', label: 'Day overview', help: 'The whole day on one slide', seconds: 20 },
{ key: 'spotlight', label: 'Entry spotlight', help: 'One entry at a time, with its person', seconds: 12 },
{ key: 'block', label: 'Blocks', help: 'A block and the things in it, before each gets a spotlight', seconds: 15 },
{ key: 'graphic', label: 'Graphics', help: "An entry's graphic, full screen", seconds: 10 },
{ key: 'map', label: 'Map images', help: "An entry's own map, full screen", seconds: 10 },
{ key: 'tag', label: 'Tag slides', help: "Each tag and everything it's on, after the days", seconds: 15 },
{ key: 'section', label: 'Sections', help: "A section's text under its heading", seconds: 20 },
{ key: 'overview', label: 'Day overview', help: 'A schedule day on one slide', seconds: 20 },
{ key: 'spotlight', label: 'Entry spotlight', help: 'One schedule entry at a time, with its person', seconds: 12 },
{ key: 'block', label: 'Blocks', help: 'A schedule block and the things in it, before each gets a spotlight', seconds: 15 },
{ key: 'graphic', label: 'Graphics', help: "A schedule entry's graphic, full screen", seconds: 10 },
{ key: 'map', label: 'Map images', help: "A schedule entry's own map, full screen", seconds: 10 },
{ key: 'tag', label: 'Tag slides', help: "Each schedule tag and everything it's on, after the days", seconds: 15 },
{ key: 'venue', label: 'Maps', help: "A map block: the venue's map with its locations", seconds: 15 },
{ key: 'place', label: 'Map locations', help: 'The map again for each location, it lit up', seconds: 8 },
{ key: 'cards', label: 'Event lists', help: "An events block's events on one slide", seconds: 15 },
{ key: 'event', label: 'Event spotlight', help: 'Each event of an events block alone', seconds: 12 },
] as const
type Kind = (typeof KINDS)[number]['key']
/* Blocks with slides of their own, not a section's text, as the
setup screen names them. */
const OWN_SLIDES = new Map([
['schedule', 'Schedule'],
['map', 'Map'],
['events', 'Events'],
])
/* Blocks that start a section. */
const STARTS_SECTION = new Set(['heading', 'tab'])
/* Seconds a long slide takes to scroll one screenful, when unset. */
const PER_SCREEN = 8
/* An overview with more entries than this goes to two columns. */
const ONE_COLUMN = 8
/* How long the controls stay up after the pointer last moved (ms). */
const CONTROLS_FOR = 2500
/* A section's text is drawn at the page's size, zoomed to a screen
this many pixels wide or more. */
const TEXT_WIDTH = 1000
/* `parent` is a sub-item's block; a tag slide has its `tag` and the
`days` it gathers from. */
/* `label` is the top bar's right side: the day, else the section.
The rest is what each kind draws. */
type Slide = {
kind: Kind
seconds: number
day: Day
label: string
day?: Day
entry?: ContentBlockItem
parent?: ContentBlockItem
tag?: ScheduleTag
days?: Day[]
tags?: ScheduleTag[]
blocks?: ContentBlock[]
venue?: Venue
location?: VenueLocation
items?: ContentBlockItem[]
}
/* An entry's key in the address: day index, a dot, entry index, and
for a sub-item another dot and its index. */
const entryKey = (...at: number[]) => at.join('.')
/* A part of the page: a heading and the blocks under it. */
type Section = { title: string; blocks: ContentBlock[] }
/* A schedule block, numbered among the page's, with its days. */
type Schedule = { n: number; days: Day[]; tags: ScheduleTag[] }
function sectionsOf(blocks: ContentBlock[], title: string): Section[] {
const sections: Section[] = [{ title, blocks: [] }]
for (const block of blocks) {
if (STARTS_SECTION.has(block.type)) sections.push({ title: block.text || title, blocks: [] })
else sections[sections.length - 1].blocks.push(block)
}
return sections.filter((section) => section.blocks.length)
}
/* A day's, entry's or sub-item's key in the address: the schedule's
number, the day's, then the entry's and sub-item's, dotted. */
const key = (...at: number[]) => at.join('.')
/* Lines on an overview: entries and sub-items. */
const lineCount = (entries: ContentBlockItem[]) =>
entries.reduce((n, entry) => n + 1 + (entry.kind === 'block' ? (entry.items?.length ?? 0) : 0), 0)
const list = (value: string | null) => (value ? value.split(',').filter(Boolean) : null)
function readSettings(params: URLSearchParams, days: Day[]) {
const pickedDays = list(params.get('days'))?.map(Number) ?? days.map((_, i) => i)
const hidden = new Set(list(params.get('hide')) ?? [])
function readSettings(params: URLSearchParams) {
const seconds = Object.fromEntries(
KINDS.map((kind) => {
const value = Number(params.get(kind.key) ?? kind.seconds)
@ -103,51 +165,48 @@ function readSettings(params: URLSearchParams, days: Day[]) {
) as Record<Kind, number>
const screen = Number(params.get('screen') ?? PER_SCREEN)
return {
pickedDays: new Set(pickedDays),
hidden,
skipped: new Set((list(params.get('skip')) ?? []).map(Number)),
hidden: new Set(list(params.get('hide')) ?? []),
seconds,
screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN,
only: params.get('only') || null,
}
}
type Settings = ReturnType<typeof readSettings>
type Picks = Pick<Settings, 'skipped' | 'hidden' | 'seconds' | 'only'>
function buildSlides(
days: Day[],
tags: ScheduleTag[],
{ pickedDays, hidden, seconds, only }: Pick<Settings, 'pickedDays' | 'hidden' | 'seconds' | 'only'>,
): Slide[] {
const slides: Slide[] = []
function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden, seconds, only }: Picks) {
const kept: Day[] = []
days.forEach((all, d) => {
if (!pickedDays.has(d)) return
if (hidden.has(key(n, d))) return
let entries = all.entries.flatMap((entry, e) => {
if (hidden.has(entryKey(d, e))) return []
if (hidden.has(key(n, d, e))) return []
if (entry.kind !== 'block') return [entry]
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(entryKey(d, e, i))) }]
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(key(n, d, e, i))) }]
})
if (only) entries = withTag(entries, only)
if (entries.length === 0) return
kept.push({ name: all.name, entries })
const day = { ...all, entries }
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, day })
const at = { day, label: day.name, tags }
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, ...at })
const media = (entry: ContentBlockItem, parent?: ContentBlockItem) => {
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, day, entry, parent })
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, day, entry, parent })
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, ...at, entry, parent })
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, ...at, entry, parent })
}
for (const entry of entries) {
if (entry.kind === 'heading') continue
if (entry.kind === 'block') {
if (seconds.block) slides.push({ kind: 'block', seconds: seconds.block, day, entry })
if (seconds.block) slides.push({ kind: 'block', seconds: seconds.block, ...at, entry })
media(entry)
for (const item of entry.items ?? []) {
if (seconds.spotlight) slides.push({ kind: 'spotlight', seconds: seconds.spotlight, day, entry: item, parent: entry })
if (seconds.spotlight) slides.push({ kind: 'spotlight', seconds: seconds.spotlight, ...at, entry: item, parent: entry })
media(item, entry)
}
continue
}
if (seconds.spotlight && entry.kind !== 'break') slides.push({ kind: 'spotlight', seconds: seconds.spotlight, day, entry })
if (seconds.spotlight && entry.kind !== 'break') slides.push({ kind: 'spotlight', seconds: seconds.spotlight, ...at, entry })
media(entry)
}
})
@ -156,24 +215,59 @@ function buildSlides(
for (const tag of tags) {
if (only && tag.key !== only) continue
const tagDays = daysWithTag(kept, tag.key)
if (tagDays.length) slides.push({ kind: 'tag', seconds: seconds.tag, day: { name: '', entries: [] }, tag, days: tagDays })
if (tagDays.length) slides.push({ kind: 'tag', seconds: seconds.tag, label: tag.name, tag, days: tagDays, tags })
}
}
}
function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>, picks: Picks): Slide[] {
const { skipped, seconds } = picks
const slides: Slide[] = []
sections.forEach((section, s) => {
if (skipped.has(s)) return
const label = section.title
const text = section.blocks.filter((block) => !OWN_SLIDES.has(block.type))
if (seconds.section && text.length) slides.push({ kind: 'section', seconds: seconds.section, label, blocks: text })
for (const block of section.blocks) {
const schedule = schedules.get(block)
if (schedule) scheduleSlides(slides, schedule, picks)
if (block.type === 'map' && block.venue) {
const venue = block.venue
if (seconds.venue) slides.push({ kind: 'venue', seconds: seconds.venue, label, venue })
if (seconds.place && venue.map_image) {
for (const location of venue.locations.filter(isMarked)) {
slides.push({ kind: 'place', seconds: seconds.place, label, venue, location })
}
}
}
if (block.type === 'events') {
const items = (block.items ?? []).filter((item) => item.event)
if (seconds.cards && items.length) slides.push({ kind: 'cards', seconds: seconds.cards, label, items })
if (seconds.event) for (const entry of items) slides.push({ kind: 'event', seconds: seconds.event, label, entry })
}
}
})
return slides
}
export default function SchedulePresent() {
export default function EventPresent() {
const { id } = useParams()
const [params, setParams] = useSearchParams()
const { data: event, loading, error, notFound, reload } = useEvent(id)
const blockIndex = Number(params.get('block') ?? 0)
const schedule = event?.blocks?.filter((block) => block.type === 'schedule')[blockIndex]
const days = useMemo(() => groupByDay(schedule?.items ?? []), [schedule])
const tags = schedule?.tags ?? []
const sections = useMemo(() => (event ? sectionsOf(event.blocks ?? [], event.title) : []), [event])
const schedules = useMemo(() => {
const out = new Map<ContentBlock, Schedule>()
for (const block of event?.blocks ?? []) {
if (block.type !== 'schedule') continue
const days = groupByDay(block.items ?? [])
if (days.length) out.set(block, { n: out.size, days, tags: block.tags ?? [] })
}
return out
}, [event])
useEffect(() => {
if (event) document.title = documentTitle(`${event.title}: schedule`)
if (event) document.title = documentTitle(`${event.title}: present`)
}, [event])
if (!event) {
@ -193,10 +287,10 @@ export default function SchedulePresent() {
const accent = event.color || BRAND
const back = `/events/${encodeURIComponent(event.id)}`
if (!schedule || days.length === 0) {
if (sections.length === 0) {
return (
<main className="min-h-screen bg-surface p-8">
<p className="notice">This event has no schedule to present.</p>
<p className="notice">This event has nothing on its page to present.</p>
<a href={back} className="mt-4 inline-block text-link underline">
Back to {event.title}
</a>
@ -204,22 +298,20 @@ export default function SchedulePresent() {
)
}
const settings = readSettings(params, days)
const settings = readSettings(params)
if (params.get('play') === '1') {
return (
<ScheduleTags.Provider value={tags}>
<Player
title={event.title}
accent={accent}
slides={buildSlides(days, tags, settings)}
screen={settings.screen}
onSetup={() => {
const next = new URLSearchParams(params)
next.delete('play')
setParams(next)
}}
/>
</ScheduleTags.Provider>
<Player
title={event.title}
accent={accent}
slides={buildSlides(sections, schedules, settings)}
screen={settings.screen}
onSetup={() => {
const next = new URLSearchParams(params)
next.delete('play')
setParams(next)
}}
/>
)
}
return (
@ -227,14 +319,14 @@ export default function SchedulePresent() {
title={event.title}
back={back}
accent={accent}
days={days}
tags={tags}
sections={sections}
schedules={schedules}
settings={settings}
onPlay={(next) => {
// Full screen needs the click itself, so it's asked for here.
document.documentElement.requestFullscreen?.().catch(() => {})
const out = new URLSearchParams({ block: String(blockIndex) })
if (next.pickedDays.size < days.length) out.set('days', [...next.pickedDays].sort((a, b) => a - b).join(','))
const out = new URLSearchParams()
if (next.skipped.size) out.set('skip', [...next.skipped].sort((a, b) => a - b).join(','))
if (next.hidden.size) out.set('hide', [...next.hidden].join(','))
for (const kind of KINDS) out.set(kind.key, String(next.seconds[kind.key]))
out.set('screen', String(next.screen))
@ -253,25 +345,26 @@ function Setup({
title,
back,
accent,
days,
tags,
sections,
schedules,
settings,
onPlay,
}: {
title: string
back: string
accent: string
days: Day[]
tags: ScheduleTag[]
sections: Section[]
schedules: Map<ContentBlock, Schedule>
settings: Settings
onPlay: (settings: Settings) => void
}) {
const [pickedDays, setPickedDays] = useState(settings.pickedDays)
const [skipped, setSkipped] = useState(settings.skipped)
const [hidden, setHidden] = useState(settings.hidden)
const [seconds, setSeconds] = useState(settings.seconds)
const [only, setOnly] = useState(settings.only)
const [screen, setScreen] = useState(settings.screen)
const count = buildSlides(days, tags, { pickedDays, hidden, seconds, only }).length
const count = buildSlides(sections, schedules, { skipped, hidden, seconds, only }).length
const tags = [...schedules.values()].flatMap((schedule) => schedule.tags)
const toggle = <T,>(set: Set<T>, value: T) => {
const next = new Set(set)
@ -285,7 +378,7 @@ function Setup({
<div className="h-2" style={{ background: accent }} />
<div className="mx-auto max-w-4xl space-y-10 px-6 py-12">
<header>
<p className="text-sm font-semibold text-muted">Present the schedule</p>
<p className="text-sm font-semibold text-muted">Present the page</p>
<h1 className="text-4xl font-bold" style={{ color: accentText(accent) }}>
{title}
</h1>
@ -349,7 +442,9 @@ function Setup({
<label className="flex flex-wrap items-center gap-4 bg-raised p-4 shadow-sm">
<span className="flex-1">
<span className="block font-semibold text-ink">Only entries tagged</span>
<span className="text-sm text-muted">Every slide shows only what this tag is on, eg. for one room's screen</span>
<span className="text-sm text-muted">
Every schedule slide shows only what this tag is on, eg. for one room's screen
</span>
</span>
<select
value={only ?? ''}
@ -368,43 +463,69 @@ function Setup({
)}
<section>
<h2 className="mb-4 text-2xl font-bold text-ink">Days and entries</h2>
<h2 className="mb-4 text-2xl font-bold text-ink">Sections</h2>
<p className="mb-4 text-sm text-muted">The page's parts, each starting at a Heading block.</p>
<div className="space-y-6">
{days.map((day, d) => (
<fieldset key={d} className="bg-raised p-4 shadow-sm">
<legend className="sr-only">{day.name || 'Schedule'}</legend>
<label className="flex items-center gap-3 font-bold text-ink">
<input type="checkbox" checked={pickedDays.has(d)} onChange={() => setPickedDays(toggle(pickedDays, d))} />
{day.name || 'Schedule'}
</label>
<ul className="mt-3 space-y-2 pl-7">
{day.entries.map((entry, e) => (
<li key={e}>
<PickEntry
entry={entry}
enabled={pickedDays.has(d)}
checked={!hidden.has(entryKey(d, e))}
onToggle={() => setHidden(toggle(hidden, entryKey(d, e)))}
/>
{entry.kind === 'block' && entry.items?.length ? (
<ul className="mt-2 space-y-2 pl-7">
{entry.items.map((item, i) => (
<li key={i}>
<PickEntry
entry={item}
enabled={pickedDays.has(d) && !hidden.has(entryKey(d, e))}
checked={!hidden.has(entryKey(d, e, i))}
onToggle={() => setHidden(toggle(hidden, entryKey(d, e, i)))}
/>
</li>
))}
</ul>
) : null}
</li>
))}
</ul>
</fieldset>
))}
{sections.map((section, s) => {
const on = !skipped.has(s)
const kinds = [...new Set(section.blocks.map((block) => (OWN_SLIDES.get(block.type) ?? 'Text')))]
return (
<fieldset key={s} className="bg-raised p-4 shadow-sm">
<legend className="sr-only">{section.title}</legend>
<label className="flex items-baseline gap-3">
<input type="checkbox" checked={on} onChange={() => setSkipped(toggle(skipped, s))} />
<span className="font-bold text-ink">{section.title}</span>
<span className="text-xs text-muted">{kinds.join(', ')}</span>
</label>
{section.blocks.map((block, b) => {
const schedule = schedules.get(block)
if (!schedule) return null
const { n, days } = schedule
return (
<div key={b} className="mt-3 space-y-4 pl-7">
{days.map((day, d) => (
<div key={d}>
<PickEntry
label={day.name || 'Schedule'}
strong
enabled={on}
checked={!hidden.has(key(n, d))}
onToggle={() => setHidden(toggle(hidden, key(n, d)))}
/>
<ul className="mt-2 space-y-2 pl-7">
{day.entries.map((entry, e) => (
<li key={e}>
<PickEntry
entry={entry}
enabled={on && !hidden.has(key(n, d))}
checked={!hidden.has(key(n, d, e))}
onToggle={() => setHidden(toggle(hidden, key(n, d, e)))}
/>
{entry.kind === 'block' && entry.items?.length ? (
<ul className="mt-2 space-y-2 pl-7">
{entry.items.map((item, i) => (
<li key={i}>
<PickEntry
entry={item}
enabled={on && !hidden.has(key(n, d)) && !hidden.has(key(n, d, e))}
checked={!hidden.has(key(n, d, e, i))}
onToggle={() => setHidden(toggle(hidden, key(n, d, e, i)))}
/>
</li>
))}
</ul>
) : null}
</li>
))}
</ul>
</div>
))}
</div>
)
})}
</fieldset>
)
})}
</div>
</section>
@ -412,7 +533,7 @@ function Setup({
<button
type="button"
disabled={count === 0}
onClick={() => onPlay({ pickedDays, hidden, seconds, screen, only })}
onClick={() => onPlay({ skipped, hidden, seconds, screen, only })}
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
style={{ background: accent, color: readableOn(accent) }}
>
@ -431,32 +552,37 @@ function Setup({
)
}
/* One entry's checkbox on the setup screen, its kind beside it. */
/* One checkbox on the setup screen: a schedule entry (its time and
kind beside it) or a day (`label`, `strong`). */
const KIND_NOTE = { block: 'Block', break: 'Break', heading: 'Heading' } as const
function PickEntry({
entry,
label,
strong = false,
enabled,
checked,
onToggle,
}: {
entry: ContentBlockItem
entry?: ContentBlockItem
label?: string
strong?: boolean
enabled: boolean
checked: boolean
onToggle: () => void
}) {
const note = entry.kind && entry.kind !== 'entry' ? KIND_NOTE[entry.kind] : null
const note = entry?.kind && entry.kind !== 'entry' ? KIND_NOTE[entry.kind] : null
return (
<label className={`flex items-baseline gap-3 ${enabled ? '' : 'opacity-50'}`}>
<input type="checkbox" disabled={!enabled} checked={checked} onChange={onToggle} />
<span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>
<span className={entry.kind === 'heading' ? 'font-semibold' : ''}>
{entry.featured && (
{entry && <span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>}
<span className={strong || entry?.kind === 'heading' ? 'font-semibold text-ink' : ''}>
{entry?.featured && (
<span className="mr-1 text-link">
<FeaturedStar />
</span>
)}
{entry.text}
{entry ? entry.text : label}
</span>
{note && <span className="text-xs text-muted">{note}</span>}
</label>
@ -557,7 +683,7 @@ function Player({
<div className="h-3 shrink-0" style={{ background: accent }} />
<div className="flex shrink-0 items-baseline justify-between gap-6 px-[4vw] pt-[2vh] text-[clamp(1rem,1.6vw,2rem)] text-muted">
<span className="font-semibold">{title}</span>
<span>{slide.day.name}</span>
<span>{slide.label === title ? '' : slide.label}</span>
</div>
{/* Keyed by index, so every slide's entrance animation plays. */}
@ -565,7 +691,9 @@ function Player({
<SlideTime.Provider
value={{ wait: slide.seconds / 2, screen, paused, scrolls: (s) => setScroll({ index, seconds: s }) }}
>
<SlideView slide={slide} accent={accent} />
<ScheduleTags.Provider value={slide.tags ?? []}>
<SlideView slide={slide} accent={accent} />
</ScheduleTags.Provider>
</SlideTime.Provider>
</div>
@ -676,6 +804,40 @@ function Scroll({ center = false, className = '', children }: {
)
}
/* A slide's big title. */
function SlideTitle({ children, color }: { children: ReactNode; color: string }) {
return (
<Rise>
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color }}>
{children}
</h1>
</Rise>
)
}
/* A picture's width over its height, once it has loaded (0 before). */
function useRatio(src: string | null) {
const [ratio, setRatio] = useState(0)
useEffect(() => {
if (!src) return
const img = new Image()
img.onload = () => setRatio(img.naturalWidth / (img.naturalHeight || 1))
img.src = src
}, [src])
return ratio
}
/* A venue's map at the most the slide holds: as wide as it can be
without being taller than `vh` of the screen. */
function SlideMap({ venue, accent, active, vh }: { venue: Venue; accent: string; active: string | null; vh: number }) {
const ratio = useRatio(mediaUrl(venue.map_image))
return (
<div style={{ width: ratio ? `min(100%, ${ratio * vh}vh)` : '100%' }}>
<MapPicture venue={venue} accent={accent} active={active} big />
</div>
)
}
/* An overview's rows: each entry, a block's sub-items under it.
`start` is the first row's place in the slide's entrance. */
function OverviewEntries({ entries, accent, start = 1 }: { entries: ContentBlockItem[]; accent: string; start?: number }) {
@ -755,16 +917,178 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
const tags = useContext(ScheduleTags)
const color = accentText(accent)
if (slide.kind === 'section') {
// The page's own blocks, zoomed up from the page's size. The
// zoom is inside Scroll, so it measures what the screen shows.
const zoom = Math.max(1, window.innerWidth / TEXT_WIDTH)
return (
<div className="flex h-full flex-col">
<SlideTitle color={color}>{slide.label}</SlideTitle>
<Rise order={1} className="flex min-h-0 flex-1 flex-col">
<Scroll>
<div style={{ zoom }}>
<ContentBlocks blocks={slide.blocks} accent={accent} />
</div>
</Scroll>
</Rise>
</div>
)
}
if (slide.kind === 'venue') {
const venue = slide.venue!
return (
<div className="flex h-full gap-[4vw]">
{venue.map_image && (
<Rise className="min-w-0 flex-[2]">
<SlideMap venue={venue} accent={accent} active={null} vh={78} />
</Rise>
)}
<div className="flex min-w-0 flex-1 flex-col">
<SlideTitle color={color}>{venue.name}</SlideTitle>
<Scroll>
<ol className="space-y-[1.5vh]">
{venue.locations.map((location, i) => (
<li key={location.key}>
<Rise order={i + 1} from="right" className="flex items-start gap-[1vw]">
<LocationNumber n={locationNumber(venue, location)} accent={accent} className="h-[2.6vw] w-[2.6vw] text-[1.3vw]" />
<span>
<span className="block text-[clamp(1.1rem,2vw,2.6rem)] font-bold leading-tight text-ink">{location.name}</span>
{location.detail && (
<span className="block text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{location.detail}</span>
)}
</span>
</Rise>
</li>
))}
</ol>
</Scroll>
</div>
</div>
)
}
if (slide.kind === 'place') {
const venue = slide.venue!
const location = slide.location!
return (
<div className="flex h-full items-center gap-[4vw]">
<Rise className="min-w-0 flex-[2]">
<SlideMap venue={venue} accent={accent} active={location.key} vh={78} />
</Rise>
<div className="min-w-0 flex-1">
<Rise from="right">
<LocationNumber n={locationNumber(venue, location)} accent={accent} className="h-[6vw] w-[6vw] text-[3vw]" />
</Rise>
<Rise order={1} from="right">
<h1 className="mt-[2vh] text-[clamp(2.4rem,5vw,6.5rem)] font-bold leading-[1.05] text-ink">{location.name}</h1>
</Rise>
{location.detail && (
<Rise order={2} from="right">
<p className="mt-[1.5vh] text-[clamp(1.1rem,2.2vw,2.8rem)] text-muted">{location.detail}</p>
</Rise>
)}
<Rise order={3} from="right">
<p className="mt-[3vh] text-[clamp(1rem,1.8vw,2.2rem)] font-semibold" style={{ color }}>
{venue.name}
</p>
</Rise>
</div>
</div>
)
}
if (slide.kind === 'cards') {
const items = slide.items ?? []
return (
<div className="flex h-full flex-col">
<SlideTitle color={color}>{slide.label}</SlideTitle>
<Scroll>
<ul className={`grid gap-[2vw] ${items.length > 4 ? 'grid-cols-3' : 'grid-cols-2'}`}>
{items.map((item, i) => {
const image = mediaUrl(item.event!.image)
return (
<li key={i}>
<Rise order={i + 1} className="h-full bg-raised shadow-md">
{image && <img src={image} alt="" className="aspect-video w-full object-cover" />}
<div className="p-[1.5vw]">
{eventLine(item.event!) && (
<p className="text-[clamp(0.9rem,1.4vw,1.8rem)] font-semibold capitalize" style={{ color }}>
{eventLine(item.event!)}
</p>
)}
<p className="text-[clamp(1.2rem,2.2vw,2.8rem)] font-bold leading-tight text-ink">
{item.text || item.event!.title}
</p>
{item.person && (
<p className="mt-[0.5vh] text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{item.person.name}</p>
)}
</div>
</Rise>
</li>
)
})}
</ul>
</Scroll>
</div>
)
}
const entry = slide.entry!
if (slide.kind === 'event') {
const event = entry.event!
const image = mediaUrl(event.image)
const blurb = entry.detail || event.blurb
return (
<div className="flex h-full items-center gap-[5vw]">
{image && (
<Rise from="left" className="w-[42vw] shrink-0">
<img src={image} alt="" className="aspect-video w-full object-cover shadow-lg" />
</Rise>
)}
<Scroll center className="min-w-0 self-stretch">
{eventLine(event) && (
<Rise from="right">
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold capitalize" style={{ color }}>
{eventLine(event)}
</p>
</Rise>
)}
<Rise order={1} from="right">
<h1 className="mt-[1vh] text-[clamp(2.4rem,5vw,6.5rem)] font-bold leading-[1.05] text-ink">
{entry.text || event.title}
</h1>
</Rise>
{blurb && (
<Rise order={2} from="right">
<div className="mt-[3vh] space-y-3 text-[clamp(1rem,1.8vw,2.2rem)] leading-snug text-muted">
<Paragraphs text={blurb} accent={accent} />
</div>
</Rise>
)}
{entry.person && (
<Rise order={3} from="right" className="mt-[3vh] flex items-center gap-[1.5vw]">
<Avatar person={entry.person} size="h-[6vw] w-[6vw] text-[1.6vw]" />
<span>
<span className="block text-[clamp(1.1rem,2vw,2.6rem)] font-bold text-ink">{entry.person.name}</span>
{entry.person.tagline && (
<span className="block text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{entry.person.tagline}</span>
)}
</span>
</Rise>
)}
</Scroll>
</div>
)
}
if (slide.kind === 'overview') {
const entries = slide.day.entries
const entries = slide.day!.entries
const two = lineCount(entries) > ONE_COLUMN
return (
<div className="flex h-full flex-col">
<Rise>
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color }}>
{slide.day.name || 'Schedule'}
</h1>
</Rise>
<SlideTitle color={color}>{slide.day!.name || 'Schedule'}</SlideTitle>
<Scroll>
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
<OverviewEntries entries={entries} accent={accent} />
@ -782,11 +1106,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
let order = 1
return (
<div className="flex h-full flex-col">
<Rise>
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color: accentText(tagColor) }}>
{tag.name}
</h1>
</Rise>
<SlideTitle color={accentText(tagColor)}>{tag.name}</SlideTitle>
<Scroll>
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
{tagDays.map((day, d) => {
@ -811,15 +1131,13 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
)
}
const entry = slide.entry!
if (slide.kind === 'block') {
const items = entry.items ?? []
return (
<div className="flex h-full flex-col">
<Rise>
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
{[slide.day.name, entry.time].filter(Boolean).join(' · ')}
{[slide.day!.name, entry.time].filter(Boolean).join(' · ')}
</p>
</Rise>
<Rise order={1}>
@ -915,7 +1233,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
<Scroll center className="min-w-0 self-stretch">
<Rise from="right">
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
{[slide.day.name, slide.parent?.text, entry.time].filter(Boolean).join(' · ')}
{[slide.day!.name, slide.parent?.text, entry.time].filter(Boolean).join(' · ')}
</p>
</Rise>
<Rise order={1} from="right">