- Setup: Overview slide and A slide per item per list (`lists`), its items ticked on and off when either is picked - The block's two fields and 098's columns go (100) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1741 lines
71 KiB
TypeScript
1741 lines
71 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
EVENT PRESENTATION: /events/:id/present
|
|
|
|
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.
|
|
|
|
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, its person
|
|
host and its own page's blocks (else its card text)
|
|
list a list block picked for an Overview slide: its
|
|
items' text, centered
|
|
item then, picked for A slide per item, each item: its
|
|
text the heading, its detail under it, centered
|
|
A list picked for neither is part of its section's text. The
|
|
setup picks them per list (`lists`, o<section>.<block> and
|
|
i<section>.<block>) and ticks its items on and off (`hide`,
|
|
l<section>.<block>.<item>).
|
|
|
|
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,
|
|
in place of its spotlight; then each sub-item gets
|
|
the spotlight, graphic and map slides an entry does
|
|
graphic an entry's graphic, full screen
|
|
map an entry's own map image (069), full screen
|
|
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. "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.
|
|
|
|
A section with only a heading (and subheadings or dividers) before
|
|
its map, schedule or events gets no text slide: its heading titles
|
|
the slides that follow. The setup's Order list moves any slide
|
|
(`order`, slide ids, see buildSlides); a slide it doesn't name
|
|
stays after the one it follows by default.
|
|
|
|
The event's Presentation settings (095) give the slides their
|
|
background, frame, colors and logo (lookTokens, Player); a block's
|
|
give its Presentation text, leave it out, and say how a map is
|
|
shown. The blocks themselves are drawn for a screen (Presenting):
|
|
links as their text, people as round photos and names,
|
|
their logos. In the dark theme the event's dark settings (096)
|
|
take the place of any they set (lookFor); the setup's Theme
|
|
(`theme=light|dark`) holds a screen in one theme while it plays.
|
|
|
|
Keys while playing: arrows step, Space pauses, Escape leaves full
|
|
screen (the browser's), S goes back to the setup.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import { ArrowDown, ArrowUp, ArrowsOut, CaretLeft, CaretRight, DotsSixVertical, Gear, Pause, Play } from '@phosphor-icons/react'
|
|
import { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react'
|
|
import { useParams, useSearchParams } from 'react-router-dom'
|
|
|
|
import PageState from '../components/PageState.tsx'
|
|
import {
|
|
Avatar,
|
|
FeaturedStar,
|
|
ScheduleTags,
|
|
TagChips,
|
|
daysWithTag,
|
|
featuredStyle,
|
|
groupByDay,
|
|
mapAlt,
|
|
withTag,
|
|
type Day,
|
|
} from '../components/ScheduleBlock.tsx'
|
|
import ContentBlocks, { eventLine } from '../components/ContentBlocks.tsx'
|
|
import { LocationNumber, MapPicture, isMarked, locationNumber } from '../components/MapBlock.tsx'
|
|
import { Inline, Paragraphs } from '../components/InlineText.tsx'
|
|
import { Presenting } from '../lib/presenting.ts'
|
|
import {
|
|
useEvent,
|
|
type ContentBlock,
|
|
type ContentBlockItem,
|
|
type EventPresentLook,
|
|
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 { preview } from '../lib/text.ts'
|
|
import { useDarkTheme } from '../lib/darkTheme.ts'
|
|
import './EventPresent.css'
|
|
|
|
/* Each kind of slide, its address key and seconds when unset. */
|
|
const KINDS = [
|
|
{ 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 },
|
|
{ key: 'list', label: 'List overview', help: "A list block's items on one slide, without their detail", seconds: 12 },
|
|
{ key: 'item', label: 'List items', help: 'Each list item alone, its detail under it', seconds: 10 },
|
|
] 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'],
|
|
])
|
|
/* A list's picks in `lists`: its Overview slide, A slide per item. */
|
|
const overviewKey = (s: number, b: number) => `o${s}.${b}`
|
|
const itemsKey = (s: number, b: number) => `i${s}.${b}`
|
|
/* A list item's key in `hide`. */
|
|
const listKey = (s: number, b: number, i: number) => `l${s}.${b}.${i}`
|
|
/* What the setup calls a block with slides of its own (a list picked
|
|
for an Overview slide or A slide per item), else null. */
|
|
const ownSlides = (block: ContentBlock, lists: Set<string>, s: number, b: number): string | null =>
|
|
OWN_SLIDES.get(block.type) ??
|
|
(block.type === 'list' && (lists.has(overviewKey(s, b)) || lists.has(itemsKey(s, b))) ? 'List' : null)
|
|
|
|
/* Blocks that start a section. */
|
|
const STARTS_SECTION = new Set(['heading', 'tab'])
|
|
/* Text that alone makes no section slide: the heading titles what
|
|
follows instead. */
|
|
const FILLER = new Set(['subheading', 'divider'])
|
|
/* Percent of the background color over the background image, unset. */
|
|
const DIM = 60
|
|
/* The themes a screen can be held in (`theme`). */
|
|
const THEMES = ['light', 'dark'] as const
|
|
|
|
/* The event's look in the theme shown: in the dark one, its dark
|
|
settings (096) over the light ones. */
|
|
function lookFor(look: EventPresentLook | undefined, dark: boolean): EventPresentLook | undefined {
|
|
if (!look || !dark || !look.dark) return look
|
|
const picked = Object.entries(look.dark).filter(([, value]) => value != null && value !== '')
|
|
return { ...look, ...Object.fromEntries(picked) }
|
|
}
|
|
|
|
/* 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
|
|
|
|
/* `label` is the top bar's right side: the day, else the section.
|
|
The rest is what each kind draws. */
|
|
type Slide = {
|
|
/* Where it comes from, for the Order list (buildSlides). */
|
|
id: string
|
|
kind: Kind
|
|
/* A map's or event list's title, when not the label. */
|
|
title?: string
|
|
seconds: number
|
|
label: string
|
|
day?: Day
|
|
entry?: ContentBlockItem
|
|
parent?: ContentBlockItem
|
|
tag?: ScheduleTag
|
|
days?: Day[]
|
|
tags?: ScheduleTag[]
|
|
blocks?: ContentBlock[]
|
|
venue?: Venue
|
|
location?: VenueLocation
|
|
items?: ContentBlockItem[]
|
|
/* A map: the locations shown, by key (all when unset), and its
|
|
block's Map only and No location details (095). */
|
|
only?: string[]
|
|
noList?: boolean
|
|
noDetails?: boolean
|
|
}
|
|
|
|
/* A part of the page: a heading (`headed`, else the event's title)
|
|
and the blocks under it. */
|
|
type Section = { title: string; headed: boolean; blocks: ContentBlock[] }
|
|
/* A schedule block, numbered among the page's, with its days. */
|
|
type Schedule = { n: number; days: Day[]; tags: ScheduleTag[] }
|
|
|
|
/* Blocks left out of the presentation (095) are dropped; a left out
|
|
heading still starts its section, under the event's title. */
|
|
function sectionsOf(blocks: ContentBlock[], title: string): Section[] {
|
|
const sections: Section[] = [{ title, headed: false, blocks: [] }]
|
|
for (const block of blocks) {
|
|
if (STARTS_SECTION.has(block.type)) {
|
|
const heading = block.present?.hide ? '' : block.present?.text || block.text
|
|
sections.push({ title: heading || title, headed: Boolean(heading), blocks: [] })
|
|
} else if (!block.present?.hide) 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) {
|
|
const seconds = Object.fromEntries(
|
|
KINDS.map((kind) => {
|
|
const value = Number(params.get(kind.key) ?? kind.seconds)
|
|
return [kind.key, Number.isFinite(value) && value > 0 ? value : 0]
|
|
}),
|
|
) as Record<Kind, number>
|
|
const screen = Number(params.get('screen') ?? PER_SCREEN)
|
|
return {
|
|
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,
|
|
order: list(params.get('order')),
|
|
lists: new Set(list(params.get('lists')) ?? []),
|
|
theme: THEMES.find((theme) => theme === params.get('theme')) ?? null,
|
|
}
|
|
}
|
|
type Settings = ReturnType<typeof readSettings>
|
|
type Picks = Pick<Settings, 'skipped' | 'hidden' | 'seconds' | 'only' | 'lists'>
|
|
|
|
/* An entry or sub-item with its key (key()), carried through the
|
|
picks and the tag filter, which copy blocks. */
|
|
type Keyed = ContentBlockItem & { slideKey: string }
|
|
const keyOf = (entry: ContentBlockItem) => (entry as Keyed).slideKey
|
|
|
|
function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden, seconds, only }: Picks) {
|
|
const kept: Day[] = []
|
|
days.forEach((all, d) => {
|
|
if (hidden.has(key(n, d))) return
|
|
let entries: ContentBlockItem[] = all.entries.flatMap((entry, e) => {
|
|
if (hidden.has(key(n, d, e))) return []
|
|
const slideKey = key(n, d, e)
|
|
if (entry.kind !== 'block') return [{ ...entry, slideKey }]
|
|
const items = (entry.items ?? []).flatMap((item, i) =>
|
|
hidden.has(key(n, d, e, i)) ? [] : [{ ...item, slideKey: key(n, d, e, i) }],
|
|
)
|
|
return [{ ...entry, slideKey, items }]
|
|
})
|
|
if (only) entries = withTag(entries, only)
|
|
if (entries.length === 0) return
|
|
kept.push({ name: all.name, entries })
|
|
const day = { ...all, entries }
|
|
const at = { day, label: day.name, tags }
|
|
if (seconds.overview) slides.push({ id: `o${key(n, d)}`, kind: 'overview', seconds: seconds.overview, ...at })
|
|
|
|
const media = (entry: ContentBlockItem, parent?: ContentBlockItem) => {
|
|
const k = keyOf(entry)
|
|
if (seconds.graphic && entry.media) slides.push({ id: `g${k}`, kind: 'graphic', seconds: seconds.graphic, ...at, entry, parent })
|
|
if (seconds.map && entry.map_image) slides.push({ id: `m${k}`, 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({ id: `k${keyOf(entry)}`, kind: 'block', seconds: seconds.block, ...at, entry })
|
|
media(entry)
|
|
for (const item of entry.items ?? []) {
|
|
if (seconds.spotlight) {
|
|
slides.push({ id: `s${keyOf(item)}`, kind: 'spotlight', seconds: seconds.spotlight, ...at, entry: item, parent: entry })
|
|
}
|
|
media(item, entry)
|
|
}
|
|
continue
|
|
}
|
|
if (seconds.spotlight && entry.kind !== 'break') {
|
|
slides.push({ id: `s${keyOf(entry)}`, kind: 'spotlight', seconds: seconds.spotlight, ...at, entry })
|
|
}
|
|
media(entry)
|
|
}
|
|
})
|
|
|
|
if (seconds.tag) {
|
|
for (const tag of tags) {
|
|
if (only && tag.key !== only) continue
|
|
const tagDays = daysWithTag(kept, tag.key)
|
|
if (tagDays.length) slides.push({ id: `x${n}.${tag.key}`, kind: 'tag', seconds: seconds.tag, label: tag.name, tag, days: tagDays, tags })
|
|
}
|
|
}
|
|
}
|
|
|
|
/* A map block's slides: the map (once per section with A slide per
|
|
section), then each location picked for a slide of its own (095).
|
|
`title` is the heading folded in, if any. */
|
|
function mapSlides(slides: Slide[], block: ContentBlock, at: string, label: string, title: string | null, seconds: Picks['seconds']) {
|
|
const venue = block.venue!
|
|
const present = block.present
|
|
const shown = { noList: present?.map_no_list, noDetails: present?.map_no_details }
|
|
if (seconds.venue) {
|
|
const parts = present?.map_split ? (block.map_sections ?? []) : []
|
|
if (parts.length) {
|
|
parts.forEach((part, i) => {
|
|
slides.push({ id: `v${at}.${i}`, kind: 'venue', seconds: seconds.venue, label, venue, title: part.name, only: part.keys, ...shown })
|
|
})
|
|
} else {
|
|
slides.push({ id: `v${at}`, kind: 'venue', seconds: seconds.venue, label, venue, title: title ?? venue.name, ...shown })
|
|
}
|
|
}
|
|
if (!seconds.place || !venue.map_image || present?.places === 'none') return
|
|
const picked = present?.places === 'picked' ? new Set(present.place_keys) : null
|
|
for (const location of venue.locations.filter(isMarked)) {
|
|
if (picked && !picked.has(location.key)) continue
|
|
slides.push({ id: `p${at}.${location.key}`, kind: 'place', seconds: seconds.place, label, venue, location, ...shown })
|
|
}
|
|
}
|
|
|
|
/* Each slide's id says where it comes from, so a saved order still
|
|
finds it: t<section> a section's text; v and p a map and its
|
|
locations, c and e an events list and its events, by
|
|
<section>.<block>; l and i a list's overview and items (listKey);
|
|
o, k, s, g and m a schedule's overview, block, spotlight, graphic
|
|
and map image, and x its tag slides, by key(). */
|
|
function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>, picks: Picks): Slide[] {
|
|
const { skipped, seconds, hidden, lists } = picks
|
|
const slides: Slide[] = []
|
|
sections.forEach((section, s) => {
|
|
if (skipped.has(s)) return
|
|
const label = section.title
|
|
const text = section.blocks.filter((block, b) => !ownSlides(block, lists, s, b))
|
|
// Nothing but a heading: it titles the slides that follow.
|
|
const own = text.some((block) => !FILLER.has(block.type))
|
|
if (seconds.section && own) slides.push({ id: `t${s}`, kind: 'section', seconds: seconds.section, label, blocks: text })
|
|
const title = section.headed && !own ? label : null
|
|
section.blocks.forEach((block, b) => {
|
|
const at = `${s}.${b}`
|
|
const schedule = schedules.get(block)
|
|
if (schedule) scheduleSlides(slides, schedule, picks)
|
|
if (block.type === 'map' && block.venue) mapSlides(slides, block, at, label, title, seconds)
|
|
if (block.type === 'list' && ownSlides(block, lists, s, b)) {
|
|
const items = (block.items ?? []).flatMap((item, i) => (hidden.has(listKey(s, b, i)) ? [] : [{ item, i }]))
|
|
if (seconds.list && lists.has(overviewKey(s, b)) && items.length) {
|
|
slides.push({ id: `l${at}`, kind: 'list', seconds: seconds.list, label, title: title ?? undefined, items: items.map(({ item }) => item) })
|
|
}
|
|
if (seconds.item && lists.has(itemsKey(s, b))) {
|
|
for (const { item, i } of items) slides.push({ id: `i${at}.${i}`, kind: 'item', seconds: seconds.item, label, entry: item })
|
|
}
|
|
}
|
|
if (block.type === 'events') {
|
|
const items = (block.items ?? []).filter((item) => item.event)
|
|
if (seconds.cards && items.length) slides.push({ id: `c${at}`, kind: 'cards', seconds: seconds.cards, label, items })
|
|
if (seconds.event) {
|
|
items.forEach((entry, i) => slides.push({ id: `e${at}.${i}`, kind: 'event', seconds: seconds.event, label, entry }))
|
|
}
|
|
}
|
|
})
|
|
})
|
|
return slides
|
|
}
|
|
|
|
/* The slides in the Order list's order: one it doesn't name stays
|
|
right after the slide it follows by default. */
|
|
function ordered(slides: Slide[], order: string[] | null): Slide[] {
|
|
if (!order?.length) return slides
|
|
const rank = new Map(order.map((id, i) => [id, i]))
|
|
let last = -1
|
|
return slides
|
|
.map((slide, i) => {
|
|
const at = rank.get(slide.id)
|
|
if (at != null) last = at
|
|
return { slide, i, at: at ?? last + 0.5 }
|
|
})
|
|
.sort((a, b) => a.at - b.at || a.i - b.i)
|
|
.map(({ slide }) => slide)
|
|
}
|
|
|
|
/* A slide's line in the Order list. */
|
|
function slideName(slide: Slide): string {
|
|
const entry = slide.entry
|
|
switch (slide.kind) {
|
|
case 'section':
|
|
case 'cards':
|
|
return slide.label
|
|
case 'overview':
|
|
return slide.day?.name || 'Schedule'
|
|
case 'tag':
|
|
return slide.tag!.name
|
|
case 'venue':
|
|
return slide.title ?? slide.venue!.name
|
|
case 'place':
|
|
return slide.location!.name
|
|
case 'event':
|
|
return entry!.text || entry!.event!.title
|
|
case 'list':
|
|
return slide.title ?? (slide.items ?? []).map((item) => item.text).join(', ')
|
|
case 'item':
|
|
return entry!.text
|
|
default:
|
|
return [slide.day?.name, entry!.time, entry!.text].filter(Boolean).join(' · ')
|
|
}
|
|
}
|
|
const KIND_LABEL = new Map<string, string>(KINDS.map((kind) => [kind.key, kind.label]))
|
|
|
|
export default function EventPresent() {
|
|
const { id } = useParams()
|
|
const [params, setParams] = useSearchParams()
|
|
const { data: event, loading, error, notFound, reload } = useEvent(id)
|
|
|
|
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}: present`)
|
|
}, [event])
|
|
|
|
// The setup's Theme, while playing; the device's again after.
|
|
const held = params.get('play') === '1' ? params.get('theme') : null
|
|
useEffect(() => {
|
|
if (held !== 'light' && held !== 'dark') return
|
|
const root = document.documentElement
|
|
const was = root.dataset.theme
|
|
root.dataset.theme = held
|
|
return () => {
|
|
if (was) root.dataset.theme = was
|
|
}
|
|
}, [held])
|
|
const dark = useDarkTheme()
|
|
|
|
if (!event) {
|
|
return (
|
|
<PageState
|
|
loading={loading}
|
|
error={error}
|
|
notFound={notFound}
|
|
onRetry={reload}
|
|
noun="retreat"
|
|
backTo="/retreats"
|
|
backLabel="All retreats"
|
|
/>
|
|
)
|
|
}
|
|
|
|
const look = lookFor(event.present, dark)
|
|
const accent = look?.accent || event.color || BRAND
|
|
const back = `/events/${encodeURIComponent(event.id)}`
|
|
|
|
if (sections.length === 0) {
|
|
return (
|
|
<main className="min-h-screen bg-surface p-8">
|
|
<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>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
const settings = readSettings(params)
|
|
if (params.get('play') === '1') {
|
|
return (
|
|
<Player
|
|
title={event.title}
|
|
accent={accent}
|
|
look={look}
|
|
slides={ordered(buildSlides(sections, schedules, settings), settings.order)}
|
|
screen={settings.screen}
|
|
onSetup={() => {
|
|
const next = new URLSearchParams(params)
|
|
next.delete('play')
|
|
setParams(next)
|
|
}}
|
|
/>
|
|
)
|
|
}
|
|
return (
|
|
<Setup
|
|
title={event.title}
|
|
back={back}
|
|
accent={accent}
|
|
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()
|
|
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))
|
|
// Not 'tag': that's the tag slides' seconds.
|
|
if (next.only) out.set('only', next.only)
|
|
if (next.order?.length) out.set('order', next.order.join(','))
|
|
if (next.theme) out.set('theme', next.theme)
|
|
if (next.lists.size) out.set('lists', [...next.lists].join(','))
|
|
out.set('play', '1')
|
|
setParams(out)
|
|
}}
|
|
/>
|
|
)
|
|
}
|
|
|
|
/* ── Setup ──────────────────────────────────────────────────── */
|
|
|
|
function Setup({
|
|
title,
|
|
back,
|
|
accent,
|
|
sections,
|
|
schedules,
|
|
settings,
|
|
onPlay,
|
|
}: {
|
|
title: string
|
|
back: string
|
|
accent: string
|
|
sections: Section[]
|
|
schedules: Map<ContentBlock, Schedule>
|
|
settings: Settings
|
|
onPlay: (settings: Settings) => void
|
|
}) {
|
|
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 [order, setOrder] = useState(settings.order)
|
|
const [theme, setTheme] = useState(settings.theme)
|
|
const [lists, setLists] = useState(settings.lists)
|
|
const [dragging, setDragging] = useState<number | null>(null)
|
|
const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only, lists }), order)
|
|
const count = slides.length
|
|
// Moves a slide in the list, which then names every slide shown.
|
|
const move = (from: number, to: number) => {
|
|
if (to < 0 || to >= slides.length || from === to) return
|
|
const ids = slides.map((slide) => slide.id)
|
|
const [id] = ids.splice(from, 1)
|
|
ids.splice(to, 0, id)
|
|
setOrder(ids)
|
|
}
|
|
const tags = [...schedules.values()].flatMap((schedule) => schedule.tags)
|
|
|
|
const toggle = <T,>(set: Set<T>, value: T) => {
|
|
const next = new Set(set)
|
|
if (next.has(value)) next.delete(value)
|
|
else next.add(value)
|
|
return next
|
|
}
|
|
|
|
return (
|
|
<main className="min-h-screen bg-surface text-body">
|
|
<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 page</p>
|
|
<h1 className="text-4xl font-bold" style={{ color: accentText(accent) }}>
|
|
{title}
|
|
</h1>
|
|
<p className="mt-2 text-muted">
|
|
Pick what to show and for how long, then Play. It loops until you stop it. Bookmark the address after
|
|
pressing Play to start a screen the same way next time.
|
|
</p>
|
|
</header>
|
|
|
|
<section>
|
|
<h2 className="mb-4 text-2xl font-bold text-ink">Slides</h2>
|
|
<div className="grid gap-4 sm:grid-cols-2">
|
|
{KINDS.map((kind) => (
|
|
<label key={kind.key} className="flex items-center gap-4 bg-raised p-4 shadow-sm">
|
|
<span className="flex-1">
|
|
<span className="block font-semibold text-ink">{kind.label}</span>
|
|
<span className="text-sm text-muted">{kind.help}</span>
|
|
</span>
|
|
<input
|
|
type="number"
|
|
min={0}
|
|
max={600}
|
|
value={seconds[kind.key]}
|
|
onChange={(e) => setSeconds({ ...seconds, [kind.key]: Math.max(0, Number(e.target.value) || 0) })}
|
|
className="w-20 border border-muted/25 bg-surface px-2 py-1 text-right"
|
|
aria-describedby={`${kind.key}-unit`}
|
|
/>
|
|
<span id={`${kind.key}-unit`} className="text-sm text-muted">
|
|
sec
|
|
</span>
|
|
</label>
|
|
))}
|
|
<label className="flex items-center gap-4 bg-raised p-4 shadow-sm">
|
|
<span className="flex-1">
|
|
<span className="block font-semibold text-ink">Scroll</span>
|
|
<span className="text-sm text-muted">
|
|
Seconds to scroll one screenful, on a slide with more than fits. It waits half its own seconds at
|
|
the top and half at the end. Default: {PER_SCREEN}
|
|
</span>
|
|
</span>
|
|
<input
|
|
type="number"
|
|
min={1}
|
|
max={120}
|
|
value={screen}
|
|
onChange={(e) => setScreen(Math.max(1, Number(e.target.value) || PER_SCREEN))}
|
|
className="w-20 border border-muted/25 bg-surface px-2 py-1 text-right"
|
|
aria-describedby="screen-unit"
|
|
/>
|
|
<span id="screen-unit" className="text-sm text-muted">
|
|
sec
|
|
</span>
|
|
</label>
|
|
</div>
|
|
<p className="mt-2 text-sm text-muted">0 leaves that kind of slide out.</p>
|
|
</section>
|
|
|
|
<section>
|
|
<h2 className="mb-4 text-2xl font-bold text-ink">Theme</h2>
|
|
<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">Light or dark</span>
|
|
<span className="text-sm text-muted">
|
|
The slides in this theme whatever the screen is set to. The event's Presentation, dark theme settings
|
|
apply in the dark one.
|
|
</span>
|
|
</span>
|
|
<select
|
|
value={theme ?? ''}
|
|
onChange={(e) => setTheme(THEMES.find((t) => t === e.target.value) ?? null)}
|
|
className="border border-muted/25 bg-surface px-2 py-1"
|
|
>
|
|
<option value="">Default: the screen's own</option>
|
|
<option value="light">Light</option>
|
|
<option value="dark">Dark</option>
|
|
</select>
|
|
</label>
|
|
</section>
|
|
|
|
{tags.length > 0 && (
|
|
<section>
|
|
<h2 className="mb-4 text-2xl font-bold text-ink">Tags</h2>
|
|
<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 schedule slide shows only what this tag is on, eg. for one room's screen
|
|
</span>
|
|
</span>
|
|
<select
|
|
value={only ?? ''}
|
|
onChange={(e) => setOnly(e.target.value || null)}
|
|
className="border border-muted/25 bg-surface px-2 py-1"
|
|
>
|
|
<option value="">Default: every entry</option>
|
|
{tags.map((tag) => (
|
|
<option key={tag.key} value={tag.key}>
|
|
{tag.name}
|
|
</option>
|
|
))}
|
|
</select>
|
|
</label>
|
|
</section>
|
|
)}
|
|
|
|
<section>
|
|
<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">
|
|
{sections.map((section, s) => {
|
|
const on = !skipped.has(s)
|
|
const kinds = [...new Set(section.blocks.map((block, b) => ownSlides(block, lists, s, b) ?? '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) => {
|
|
// A list: its own slides if picked, then its items.
|
|
if (block.type === 'list' && block.items?.length) {
|
|
const own = ownSlides(block, lists, s, b)
|
|
const first = preview(block.items.map((item) => item.text).join(', '), 60)
|
|
return (
|
|
<div key={b} className="mt-3 space-y-2 pl-7">
|
|
<p className="text-sm text-muted">List: {first}</p>
|
|
<PickEntry
|
|
label="Overview slide: every item's text, centered"
|
|
enabled={on}
|
|
checked={lists.has(overviewKey(s, b))}
|
|
onToggle={() => setLists(toggle(lists, overviewKey(s, b)))}
|
|
/>
|
|
<PickEntry
|
|
label="A slide per item: its text, its detail under it"
|
|
enabled={on}
|
|
checked={lists.has(itemsKey(s, b))}
|
|
onToggle={() => setLists(toggle(lists, itemsKey(s, b)))}
|
|
/>
|
|
{own && (
|
|
<ul className="space-y-2 pl-7">
|
|
{block.items.map((item, i) => (
|
|
<li key={i}>
|
|
<PickEntry
|
|
label={item.text}
|
|
enabled={on}
|
|
checked={!hidden.has(listKey(s, b, i))}
|
|
onToggle={() => setHidden(toggle(hidden, listKey(s, b, i)))}
|
|
/>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
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>
|
|
|
|
{slides.length > 1 && (
|
|
<section>
|
|
<div className="mb-4 flex flex-wrap items-baseline gap-4">
|
|
<h2 className="text-2xl font-bold text-ink">Order</h2>
|
|
{order && (
|
|
<button type="button" onClick={() => setOrder(null)} className="text-sm text-link underline">
|
|
Back to the page's order
|
|
</button>
|
|
)}
|
|
</div>
|
|
<p className="mb-4 text-sm text-muted">
|
|
Drag a slide, or move it with its arrows. A slide picked again later goes back after the one it follows on
|
|
the page.
|
|
</p>
|
|
<ol className="max-h-[36rem] space-y-1 overflow-y-auto">
|
|
{slides.map((slide, i) => (
|
|
<li
|
|
key={slide.id}
|
|
draggable
|
|
onDragStart={() => setDragging(i)}
|
|
onDragOver={(e) => e.preventDefault()}
|
|
onDrop={() => {
|
|
if (dragging != null) move(dragging, i)
|
|
setDragging(null)
|
|
}}
|
|
onDragEnd={() => setDragging(null)}
|
|
className={`flex cursor-grab items-center gap-3 bg-raised px-3 py-2 shadow-sm ${dragging === i ? 'opacity-50' : ''}`}
|
|
>
|
|
<DotsSixVertical aria-hidden="true" weight="bold" className="h-4 w-4 shrink-0 text-muted" />
|
|
<span className="w-8 shrink-0 text-right text-sm text-muted">{i + 1}</span>
|
|
<span className="min-w-0 flex-1 truncate text-ink">{slideName(slide)}</span>
|
|
<span className="shrink-0 text-xs text-muted">{KIND_LABEL.get(slide.kind)}</span>
|
|
<button
|
|
type="button"
|
|
onClick={() => move(i, i - 1)}
|
|
disabled={i === 0}
|
|
aria-label={`Move ${slideName(slide)} up`}
|
|
className="p-1 text-muted hover:text-ink disabled:opacity-30"
|
|
>
|
|
<ArrowUp aria-hidden="true" weight="bold" className="h-4 w-4" />
|
|
</button>
|
|
<button
|
|
type="button"
|
|
onClick={() => move(i, i + 1)}
|
|
disabled={i === slides.length - 1}
|
|
aria-label={`Move ${slideName(slide)} down`}
|
|
className="p-1 text-muted hover:text-ink disabled:opacity-30"
|
|
>
|
|
<ArrowDown aria-hidden="true" weight="bold" className="h-4 w-4" />
|
|
</button>
|
|
</li>
|
|
))}
|
|
</ol>
|
|
</section>
|
|
)}
|
|
|
|
<div className="flex flex-wrap items-center gap-4">
|
|
<button
|
|
type="button"
|
|
disabled={count === 0}
|
|
onClick={() => onPlay({ skipped, hidden, seconds, screen, only, order, theme, lists })}
|
|
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
|
|
style={{ background: accent, color: readableOn(accent) }}
|
|
>
|
|
<Play aria-hidden="true" weight="fill" className="h-5 w-5" />
|
|
Play
|
|
</button>
|
|
<span className="text-sm text-muted">
|
|
{count === 0 ? 'Nothing picked to show.' : `${count} slide${count === 1 ? '' : 's'} in the loop`}
|
|
</span>
|
|
<a href={back} className="ml-auto text-sm text-link underline">
|
|
Back to the event
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
/* 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
|
|
label?: string
|
|
strong?: boolean
|
|
enabled: boolean
|
|
checked: boolean
|
|
onToggle: () => void
|
|
}) {
|
|
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} />
|
|
{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 ? entry.text : label}
|
|
</span>
|
|
{note && <span className="text-xs text-muted">{note}</span>}
|
|
</label>
|
|
)
|
|
}
|
|
|
|
/* ── Player ─────────────────────────────────────────────────── */
|
|
|
|
/* The event's Presentation colors (095) as the site's color tokens,
|
|
so every slide's text-ink, bg-raised and so on take them. */
|
|
function lookTokens(look?: EventPresentLook): CSSProperties | undefined {
|
|
const bg = look?.background_color
|
|
const ink = look?.text_color || (bg ? readableOn(bg) : null)
|
|
if (!bg && !ink) return undefined
|
|
const ground = bg ?? 'var(--color-surface)'
|
|
return {
|
|
...(bg ? { '--color-surface': bg } : {}),
|
|
...(ink
|
|
? {
|
|
'--color-ink': ink,
|
|
'--color-body': ink,
|
|
'--color-muted': `color-mix(in srgb, ${ink} 75%, ${ground})`,
|
|
'--color-raised': `color-mix(in srgb, ${ink} 8%, ${ground})`,
|
|
'--color-tint': `color-mix(in srgb, ${ink} 14%, ${ground})`,
|
|
'--color-tint-soft': `color-mix(in srgb, ${ink} 6%, ${ground})`,
|
|
}
|
|
: {}),
|
|
} as CSSProperties
|
|
}
|
|
|
|
function Player({
|
|
title,
|
|
accent,
|
|
look,
|
|
slides,
|
|
screen,
|
|
onSetup,
|
|
}: {
|
|
title: string
|
|
accent: string
|
|
look?: EventPresentLook
|
|
slides: Slide[]
|
|
screen: number
|
|
onSetup: () => void
|
|
}) {
|
|
const [index, setIndex] = useState(0)
|
|
// Seconds this slide's scroll adds to it (Scroll), for its index.
|
|
const [scroll, setScroll] = useState({ index: -1, seconds: 0 })
|
|
const [paused, setPaused] = useState(false)
|
|
const [controls, setControls] = useState(true)
|
|
const hideTimer = useRef(0)
|
|
const slide = slides[index % Math.max(slides.length, 1)]
|
|
const step = (by: number) => setIndex((i) => (i + by + slides.length) % slides.length)
|
|
const seconds = (slide?.seconds ?? 0) + (scroll.index === index ? scroll.seconds : 0)
|
|
|
|
// The next slide when this one's time is up.
|
|
useEffect(() => {
|
|
if (paused || !slide) return
|
|
const timer = window.setTimeout(() => step(1), seconds * 1000)
|
|
return () => window.clearTimeout(timer)
|
|
}, [index, paused, seconds, slides.length])
|
|
|
|
useEffect(() => {
|
|
const onKey = (e: KeyboardEvent) => {
|
|
if (e.key === 'ArrowRight') step(1)
|
|
else if (e.key === 'ArrowLeft') step(-1)
|
|
else if (e.key === ' ') setPaused((p) => !p)
|
|
else if (e.key === 's' || e.key === 'S') onSetup()
|
|
else return
|
|
e.preventDefault()
|
|
}
|
|
window.addEventListener('keydown', onKey)
|
|
return () => window.removeEventListener('keydown', onKey)
|
|
})
|
|
|
|
// Keeps a signage screen from going to sleep, where the browser can.
|
|
useEffect(() => {
|
|
let lock: { release: () => Promise<void> } | null = null
|
|
const ask = () => {
|
|
if (document.visibilityState !== 'visible') return
|
|
;(navigator as any).wakeLock
|
|
?.request('screen')
|
|
.then((l: typeof lock) => (lock = l))
|
|
.catch(() => {})
|
|
}
|
|
ask()
|
|
document.addEventListener('visibilitychange', ask)
|
|
return () => {
|
|
document.removeEventListener('visibilitychange', ask)
|
|
lock?.release().catch(() => {})
|
|
}
|
|
}, [])
|
|
|
|
// The controls show while the pointer moves, then get out of the way.
|
|
const wake = () => {
|
|
setControls(true)
|
|
window.clearTimeout(hideTimer.current)
|
|
hideTimer.current = window.setTimeout(() => setControls(false), CONTROLS_FOR)
|
|
}
|
|
useEffect(() => {
|
|
wake()
|
|
return () => window.clearTimeout(hideTimer.current)
|
|
}, [])
|
|
|
|
if (!slide) {
|
|
return (
|
|
<main className="flex min-h-screen flex-col items-center justify-center gap-4 bg-surface">
|
|
<p className="notice">Nothing picked to show.</p>
|
|
<button type="button" onClick={onSetup} className="btn border border-muted/25 px-5 py-2">
|
|
Back to setup
|
|
</button>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
const control = 'btn flex h-12 w-12 items-center justify-center bg-raised text-ink shadow-md'
|
|
const frame = look?.frame ?? null
|
|
const background = mediaUrl(look?.background)
|
|
const label = slide.label === title || slide.label === slide.title ? '' : slide.label
|
|
// Room clear at each edge, eg. inside a frame picture (097).
|
|
const inset = look?.inset
|
|
return (
|
|
<main
|
|
onMouseMove={wake}
|
|
style={{
|
|
...lookTokens(look),
|
|
...(inset ? { padding: `${inset.top}vh ${inset.right}vw ${inset.bottom}vh ${inset.left}vw` } : {}),
|
|
}}
|
|
className={`present relative isolate flex h-screen flex-col overflow-hidden bg-surface text-body ${controls ? '' : 'cursor-none'}`}
|
|
>
|
|
{/* The background image, the background color over it at Dim. */}
|
|
{background && (
|
|
<div
|
|
aria-hidden="true"
|
|
// Stretched with an inset, so a frame in it meets the inset.
|
|
className={`absolute inset-0 -z-10 bg-center ${inset ? 'bg-[length:100%_100%]' : 'bg-cover'}`}
|
|
style={{ backgroundImage: `url("${background}")` }}
|
|
>
|
|
<div className="absolute inset-0 bg-surface" style={{ opacity: (look?.dim ?? DIM) / 100 }} />
|
|
</div>
|
|
)}
|
|
{frame === 'border' && (
|
|
<div aria-hidden="true" className="pointer-events-none absolute inset-0 z-10" style={{ border: `1vw solid ${accent}` }} />
|
|
)}
|
|
{frame == null && <div className="h-3 shrink-0" style={{ background: accent }} />}
|
|
{frame !== 'none' && (
|
|
<div
|
|
className={`flex shrink-0 items-baseline justify-between gap-6 px-[4vw] text-[clamp(1rem,1.6vw,2rem)] text-muted ${
|
|
frame === 'border' ? 'pt-[4vh]' : 'pt-[2vh]'
|
|
}`}
|
|
>
|
|
<span className="font-semibold">{title}</span>
|
|
<span>{label}</span>
|
|
</div>
|
|
)}
|
|
|
|
{/* Keyed by index, so every slide's entrance animation plays. */}
|
|
<div key={index} className="min-h-0 flex-1 px-[4vw] py-[3vh]">
|
|
<SlideTime.Provider
|
|
value={{ wait: slide.seconds / 2, screen, paused, scrolls: (s) => setScroll({ index, seconds: s }) }}
|
|
>
|
|
<ScheduleTags.Provider value={slide.tags ?? []}>
|
|
<Presenting.Provider value={true}>
|
|
<SlideView slide={slide} accent={accent} />
|
|
</Presenting.Provider>
|
|
</ScheduleTags.Provider>
|
|
</SlideTime.Provider>
|
|
</div>
|
|
|
|
{/* How long this slide has left. */}
|
|
{frame !== 'none' && (
|
|
<div
|
|
className={`h-1.5 shrink-0 ${frame === 'border' ? 'mx-[1vw] mb-[1vw]' : ''}`}
|
|
style={{ background: `color-mix(in srgb, ${accent} 20%, transparent)` }}
|
|
>
|
|
<div
|
|
key={`${index}-${paused}`}
|
|
className={paused ? 'h-full w-0' : 'present-timer h-full'}
|
|
style={{ background: accent, animationDuration: `${seconds}s` }}
|
|
/>
|
|
</div>
|
|
)}
|
|
|
|
{look?.logo && (
|
|
// In the screen's corner, not inset: it sits on the frame.
|
|
<span
|
|
className={`pointer-events-none absolute right-[3vw] ${frame === 'border' ? 'bottom-[4vh]' : 'bottom-[3vh]'}`}
|
|
>
|
|
{/* A plain img, not Logo: no dark mode plate (the dark
|
|
theme has its own logo, 096) and the full file, not the
|
|
640px copy. Hides itself if it fails to load. */}
|
|
<img
|
|
src={mediaUrl(look.logo) ?? ''}
|
|
alt=""
|
|
onError={(e) => (e.currentTarget.style.display = 'none')}
|
|
className="block h-[8vh] w-auto max-w-[16vw] object-contain"
|
|
/>
|
|
</span>
|
|
)}
|
|
|
|
<div
|
|
className={`absolute bottom-6 left-1/2 flex -translate-x-1/2 items-center gap-3 transition-opacity duration-300 ${
|
|
controls ? 'opacity-100' : 'pointer-events-none opacity-0'
|
|
}`}
|
|
>
|
|
<button type="button" onClick={() => step(-1)} className={control} aria-label="Previous slide">
|
|
<CaretLeft weight="bold" className="h-5 w-5" aria-hidden="true" />
|
|
</button>
|
|
<button type="button" onClick={() => setPaused((p) => !p)} className={control} aria-label={paused ? 'Play' : 'Pause'}>
|
|
{paused ? (
|
|
<Play weight="fill" className="h-5 w-5" aria-hidden="true" />
|
|
) : (
|
|
<Pause weight="bold" className="h-5 w-5" aria-hidden="true" />
|
|
)}
|
|
</button>
|
|
<button type="button" onClick={() => step(1)} className={control} aria-label="Next slide">
|
|
<CaretRight weight="bold" className="h-5 w-5" aria-hidden="true" />
|
|
</button>
|
|
<span className="bg-raised px-3 py-2 text-sm text-muted shadow-md">
|
|
{index + 1} / {slides.length}
|
|
</span>
|
|
<button
|
|
type="button"
|
|
onClick={() => document.documentElement.requestFullscreen?.().catch(() => {})}
|
|
className={control}
|
|
aria-label="Full screen"
|
|
>
|
|
<ArrowsOut weight="bold" className="h-5 w-5" aria-hidden="true" />
|
|
</button>
|
|
<button type="button" onClick={onSetup} className={control} aria-label="Back to setup">
|
|
<Gear weight="bold" className="h-5 w-5" aria-hidden="true" />
|
|
</button>
|
|
</div>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
/* ── Slides ─────────────────────────────────────────────────── */
|
|
|
|
/* Fades and rises in after `order` steps, so a slide's parts arrive
|
|
one after another. */
|
|
function Rise({ order = 0, from = 'below', className = '', children }: {
|
|
order?: number
|
|
from?: 'below' | 'left' | 'right'
|
|
className?: string
|
|
children: ReactNode
|
|
}) {
|
|
return (
|
|
<div className={`present-in present-from-${from} ${className}`} style={{ animationDelay: `${order * 120}ms` }}>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
/* What a slide's Scroll needs from the Player: the wait at each end
|
|
(half the slide's seconds), seconds a screenful, whether it's
|
|
paused, and where to say how many seconds its scroll adds. */
|
|
const SlideTime = createContext({ wait: 0, screen: PER_SCREEN, paused: false, scrolls: (_seconds: number) => {} })
|
|
|
|
/* A slide's part that may not fit: when its content is taller than
|
|
the room it has, it waits, scrolls to the end at the Player's
|
|
seconds a screenful (making the slide that much longer), then waits
|
|
again. `center` puts short content in the middle (and still starts
|
|
long content at the top). */
|
|
function Scroll({ center = false, className = '', children }: {
|
|
center?: boolean
|
|
className?: string
|
|
children: ReactNode
|
|
}) {
|
|
const { wait, screen, paused, scrolls } = useContext(SlideTime)
|
|
const box = useRef<HTMLDivElement>(null)
|
|
const [scrollFor, setScrollFor] = useState({ by: 0, seconds: 0 })
|
|
useLayoutEffect(() => {
|
|
const outer = box.current
|
|
const inner = outer?.firstElementChild as HTMLElement | null
|
|
if (!outer || !inner) return
|
|
const by = Math.max(0, inner.offsetHeight - outer.clientHeight)
|
|
if (!by) return
|
|
const seconds = (by / (outer.clientHeight || 1)) * screen
|
|
setScrollFor({ by, seconds })
|
|
scrolls(seconds)
|
|
}, [])
|
|
const { by, seconds } = scrollFor
|
|
const style = {
|
|
'--present-scroll': `-${by}px`,
|
|
animationDuration: `${seconds}s`,
|
|
animationDelay: `${wait}s`,
|
|
animationPlayState: paused ? 'paused' : 'running',
|
|
} as CSSProperties
|
|
return (
|
|
<div ref={box} className={`min-h-0 flex-1 overflow-hidden ${center ? 'flex flex-col' : ''} ${className}`}>
|
|
<div className={`${center ? 'my-auto' : ''} ${by ? 'present-scroll' : ''}`} style={by ? style : undefined}>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
/* 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, only }: {
|
|
venue: Venue
|
|
accent: string
|
|
active: string | null
|
|
vh: number
|
|
/** Marks only these locations' keys; all when unset. */
|
|
only?: string[]
|
|
}) {
|
|
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} only={only && new Set(only)} 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 }) {
|
|
return (
|
|
<>
|
|
{entries.map((entry, i) => (
|
|
<li key={i} className="even:bg-tint-soft/60" style={entry.featured ? featuredStyle(accent) : undefined}>
|
|
<Rise order={start + i} from="left">
|
|
<OverviewLine entry={entry} accent={accent} />
|
|
{entry.kind === 'block' && entry.items?.length ? (
|
|
<ul className="ml-[14vw] pb-[1vh]">
|
|
{entry.items.map((item, j) => (
|
|
<li key={j} style={item.featured ? featuredStyle(accent) : undefined}>
|
|
<OverviewLine entry={item} accent={accent} sub />
|
|
</li>
|
|
))}
|
|
</ul>
|
|
) : null}
|
|
</Rise>
|
|
</li>
|
|
))}
|
|
</>
|
|
)
|
|
}
|
|
|
|
/* One line of the day overview: an entry, or (`sub`) one of a
|
|
block's sub-items under it. A heading is a label; a break is
|
|
quieter. */
|
|
function OverviewLine({ entry, accent, sub = false }: { entry: ContentBlockItem; accent: string; sub?: boolean }) {
|
|
const tags = useContext(ScheduleTags)
|
|
const color = accentText(accent)
|
|
if (entry.kind === 'heading') {
|
|
return (
|
|
<p
|
|
className="px-[1vw] pt-[2vh] pb-[0.6vh] text-[clamp(0.9rem,1.5vw,2rem)] font-bold uppercase tracking-wide"
|
|
style={{ color }}
|
|
>
|
|
{entry.text}
|
|
</p>
|
|
)
|
|
}
|
|
const quiet = entry.kind === 'break'
|
|
return (
|
|
<div className={`flex items-baseline gap-[2vw] px-[1vw] ${sub ? 'py-[0.6vh]' : 'border-b border-brand/15 py-[1.2vh]'}`}>
|
|
<span
|
|
className={`shrink-0 font-semibold ${sub ? 'w-[10vw] text-[clamp(0.9rem,1.4vw,1.9rem)]' : 'w-[12vw] text-[clamp(1rem,1.8vw,2.4rem)]'}`}
|
|
style={{ color: quiet ? undefined : color }}
|
|
>
|
|
{entry.time}
|
|
</span>
|
|
<span className="min-w-0 flex-1">
|
|
<span
|
|
className={`block leading-tight ${
|
|
quiet ? 'font-semibold text-muted' : 'font-bold text-ink'
|
|
} ${sub ? 'text-[clamp(1rem,1.9vw,2.4rem)]' : 'text-[clamp(1.2rem,2.4vw,3rem)]'}`}
|
|
>
|
|
{entry.featured && (
|
|
<span className="mr-[0.6vw]" style={{ color }}>
|
|
<FeaturedStar className="h-[0.8em] w-[0.8em]" />
|
|
</span>
|
|
)}
|
|
{entry.text}
|
|
</span>
|
|
{(entry.location || entry.person || entry.tags?.length) && (
|
|
<span className="mt-1 flex flex-wrap items-center gap-x-[1.5vw] gap-y-1 text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">
|
|
{entry.location && <span>{entry.location}</span>}
|
|
{entry.person && <span>{entry.person.name}</span>}
|
|
<TagChips keys={entry.tags} tags={tags} accent={accent} className="px-[0.6vw] py-[0.2vh] text-[0.8em]" />
|
|
</span>
|
|
)}
|
|
</span>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
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!
|
|
const only = slide.only
|
|
const locations = only ? venue.locations.filter((location) => only.includes(location.key)) : venue.locations
|
|
const heading = slide.title ?? venue.name
|
|
// Map only: the map under its title, as big as the slide holds.
|
|
if (slide.noList && venue.map_image) {
|
|
return (
|
|
<div className="flex h-full flex-col items-center">
|
|
<SlideTitle color={color}>{heading}</SlideTitle>
|
|
<Rise order={1} className="flex min-h-0 w-full flex-1 justify-center">
|
|
<SlideMap venue={venue} accent={accent} active={null} vh={68} only={only} />
|
|
</Rise>
|
|
</div>
|
|
)
|
|
}
|
|
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} only={only} />
|
|
</Rise>
|
|
)}
|
|
<div className="flex min-w-0 flex-1 flex-col">
|
|
<SlideTitle color={color}>{heading}</SlideTitle>
|
|
<Scroll>
|
|
<ol className="space-y-[1.5vh]">
|
|
{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 && !slide.noDetails && (
|
|
<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 && !slide.noDetails && (
|
|
<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.title ?? 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>
|
|
)
|
|
}
|
|
|
|
if (slide.kind === 'list') {
|
|
const items = slide.items ?? []
|
|
return (
|
|
<div className="flex h-full flex-col items-center text-center">
|
|
{slide.title && <SlideTitle color={color}>{slide.title}</SlideTitle>}
|
|
<Scroll center className="w-full">
|
|
<ul className="space-y-[2vh]">
|
|
{items.map((item, i) => (
|
|
<li key={i}>
|
|
<Rise order={i + 1}>
|
|
<span className="text-[clamp(1.4rem,3vw,4rem)] font-bold leading-tight text-ink">
|
|
<Inline text={item.text} accent={accent} />
|
|
</span>
|
|
</Rise>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</Scroll>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const entry = slide.entry!
|
|
|
|
if (slide.kind === 'item') {
|
|
return (
|
|
<div className="flex h-full flex-col text-center">
|
|
<Scroll center>
|
|
<Rise>
|
|
<h1 className="text-[clamp(2.4rem,5.5vw,7rem)] font-bold leading-[1.05]" style={{ color }}>
|
|
<Inline text={entry.text} accent={accent} />
|
|
</h1>
|
|
</Rise>
|
|
{entry.detail && (
|
|
<Rise order={1}>
|
|
<p className="mx-auto mt-[3vh] max-w-[70vw] text-[clamp(1.2rem,2.6vw,3.2rem)] leading-snug text-body">
|
|
{entry.detail}
|
|
</p>
|
|
</Rise>
|
|
)}
|
|
</Scroll>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (slide.kind === 'event') {
|
|
const event = entry.event!
|
|
const image = mediaUrl(event.image)
|
|
const blurb = entry.detail || event.blurb
|
|
// Its own page's blocks, when it has some, in place of its card
|
|
// text, zoomed for the column they're in.
|
|
const blocks = event.blocks?.length ? event.blocks : null
|
|
const zoom = Math.max(1, (window.innerWidth * 0.75) / TEXT_WIDTH)
|
|
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={!blocks} 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>
|
|
{entry.person && (
|
|
<Rise order={2} 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>
|
|
)}
|
|
{blocks ? (
|
|
<Rise order={3} from="right" className="mt-[3vh]">
|
|
<div style={{ zoom }}>
|
|
<ContentBlocks blocks={blocks} accent={event.color || accent} anchorPrefix={`${event.id}-`} />
|
|
</div>
|
|
</Rise>
|
|
) : (
|
|
blurb && (
|
|
<Rise order={3} 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>
|
|
)
|
|
)}
|
|
</Scroll>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (slide.kind === 'overview') {
|
|
const entries = slide.day!.entries
|
|
const two = lineCount(entries) > ONE_COLUMN
|
|
return (
|
|
<div className="flex h-full flex-col">
|
|
<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} />
|
|
</ul>
|
|
</Scroll>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (slide.kind === 'tag') {
|
|
const tag = slide.tag!
|
|
const tagDays = slide.days ?? []
|
|
const tagColor = tag.color || accent
|
|
const two = tagDays.reduce((n, day) => n + 1 + lineCount(day.entries), 0) > ONE_COLUMN
|
|
let order = 1
|
|
return (
|
|
<div className="flex h-full flex-col">
|
|
<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) => {
|
|
const start = order
|
|
order += day.entries.length + 1
|
|
return (
|
|
<li key={d}>
|
|
{day.name && (
|
|
<Rise order={start} from="left">
|
|
<p className="pt-[1.5vh] pb-[0.5vh] text-[clamp(1rem,1.8vw,2.4rem)] font-bold text-ink">{day.name}</p>
|
|
</Rise>
|
|
)}
|
|
<ul>
|
|
<OverviewEntries entries={day.entries} accent={accent} start={start + 1} />
|
|
</ul>
|
|
</li>
|
|
)
|
|
})}
|
|
</ul>
|
|
</Scroll>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
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(' · ')}
|
|
</p>
|
|
</Rise>
|
|
<Rise order={1}>
|
|
<h1 className="mt-[1vh] text-[clamp(2.4rem,5vw,6.5rem)] font-bold leading-[1.05] text-ink">
|
|
{entry.featured && (
|
|
<span className="mr-[1vw]" style={{ color }}>
|
|
<FeaturedStar className="h-[0.8em] w-[0.8em]" />
|
|
</span>
|
|
)}
|
|
{entry.text}
|
|
</h1>
|
|
</Rise>
|
|
{(entry.location || entry.person || entry.detail) && (
|
|
<Rise order={2}>
|
|
<p className="mt-[1vh] flex flex-wrap gap-x-[2vw] text-[clamp(1.1rem,2vw,2.6rem)] text-muted">
|
|
{[entry.location, entry.person?.name, entry.detail].filter(Boolean).map((part, i) => (
|
|
<span key={i}>{part}</span>
|
|
))}
|
|
</p>
|
|
</Rise>
|
|
)}
|
|
<Scroll className="mt-[4vh]">
|
|
<ul style={{ borderLeft: `0.4vw solid ${withAlpha(accent, 40)}` }}>
|
|
{items.map((item, i) => (
|
|
<li key={i} className="even:bg-tint-soft/60" style={item.featured ? featuredStyle(accent) : undefined}>
|
|
<Rise order={i + 3} from="left" className="flex items-center gap-[2vw] px-[2vw] py-[1.6vh]">
|
|
<span className="w-[14vw] shrink-0 text-[clamp(1rem,2vw,2.6rem)] font-semibold" style={{ color }}>
|
|
{item.time}
|
|
</span>
|
|
<span className="min-w-0 flex-1">
|
|
<span className="block text-[clamp(1.3rem,2.8vw,3.6rem)] font-bold leading-tight text-ink">
|
|
{item.featured && (
|
|
<span className="mr-[0.6vw]" style={{ color }}>
|
|
<FeaturedStar className="h-[0.8em] w-[0.8em]" />
|
|
</span>
|
|
)}
|
|
{item.text}
|
|
</span>
|
|
{(item.location || item.detail) && (
|
|
<span className="mt-1 block text-[clamp(0.9rem,1.6vw,2rem)] text-muted">
|
|
{[item.location, item.detail].filter(Boolean).join(' · ')}
|
|
</span>
|
|
)}
|
|
</span>
|
|
{item.person && (
|
|
<span className="flex shrink-0 items-center gap-[1vw] text-[clamp(0.9rem,1.6vw,2rem)] text-body">
|
|
<Avatar person={item.person} size="h-[5vw] w-[5vw] text-[1.4vw]" />
|
|
{item.person.name}
|
|
</span>
|
|
)}
|
|
</Rise>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</Scroll>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (slide.kind === 'graphic' || slide.kind === 'map') {
|
|
const src = mediaUrl(slide.kind === 'map' ? entry.map_image : entry.media)
|
|
const alt = slide.kind === 'map' ? mapAlt(entry) : (entry.media_alt ?? '')
|
|
return (
|
|
<div className="flex h-full flex-col gap-[2vh]">
|
|
<Rise className="min-h-0 flex-1">
|
|
<img src={src ?? ''} alt={alt} className="h-full w-full object-contain" />
|
|
</Rise>
|
|
<Rise order={2} className="flex items-baseline gap-[2vw] text-[clamp(1.2rem,2.2vw,2.8rem)]">
|
|
<span className="font-semibold" style={{ color }}>
|
|
{entry.time}
|
|
</span>
|
|
<span className="font-bold text-ink">{entry.text}</span>
|
|
{slide.kind === 'map' && (entry.map || entry.location) && (
|
|
<span className="text-muted">{entry.map || entry.location}</span>
|
|
)}
|
|
</Rise>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
// Spotlight: the person on the left, when there is one.
|
|
return (
|
|
<div className="flex h-full items-center gap-[5vw]">
|
|
{entry.person && (
|
|
<Rise from="left" className="flex w-[28vw] shrink-0 flex-col items-center text-center">
|
|
<Avatar person={entry.person} size="aspect-square w-full text-[4vw]" />
|
|
<p className="mt-[2vh] text-[clamp(1.4rem,2.6vw,3.2rem)] font-bold text-ink">{entry.person.name}</p>
|
|
{entry.person.tagline && (
|
|
<p className="text-[clamp(1rem,1.6vw,2rem)] text-muted">{entry.person.tagline}</p>
|
|
)}
|
|
</Rise>
|
|
)}
|
|
<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(' · ')}
|
|
</p>
|
|
</Rise>
|
|
<Rise order={1} from="right">
|
|
<h1 className="mt-[1vh] text-[clamp(2.4rem,5.5vw,7rem)] font-bold leading-[1.05] text-ink">
|
|
{entry.featured && (
|
|
<span className="mr-[1vw]" style={{ color }}>
|
|
<FeaturedStar className="h-[0.8em] w-[0.8em]" />
|
|
</span>
|
|
)}
|
|
{entry.text}
|
|
</h1>
|
|
</Rise>
|
|
{entry.tags?.length ? (
|
|
<Rise order={2} from="right">
|
|
<p className="mt-[2vh]">
|
|
<TagChips keys={entry.tags} tags={tags} accent={accent} className="px-[1vw] py-[0.4vh] text-[clamp(0.9rem,1.6vw,2rem)]" />
|
|
</p>
|
|
</Rise>
|
|
) : null}
|
|
{entry.location && (
|
|
<Rise order={2} from="right">
|
|
<p className="mt-[2vh] text-[clamp(1.2rem,2.4vw,3rem)] text-body">{entry.location}</p>
|
|
</Rise>
|
|
)}
|
|
{entry.detail && (
|
|
<Rise order={3} from="right">
|
|
<p className="mt-[1vh] text-[clamp(1rem,2vw,2.4rem)] text-muted">{entry.detail}</p>
|
|
</Rise>
|
|
)}
|
|
{entry.description && (
|
|
<Rise order={4} from="right">
|
|
<div className="mt-[3vh] space-y-3 text-[clamp(1rem,1.8vw,2.2rem)] leading-snug text-muted">
|
|
<Paragraphs text={entry.description} accent={accent} />
|
|
</div>
|
|
</Rise>
|
|
)}
|
|
</Scroll>
|
|
</div>
|
|
)
|
|
}
|