Present: slide order, presentation settings, blocks drawn for a screen
- Setup's Order list: drag or move any slide; saved in the address - A heading-only section titles the slides after it, no slide of its own - Event Presentation settings (095): background image and color, dim, frame, accent, text color, logo - Blocks: Presentation text and Leave out of the presentation; map blocks get a slide per section, map only, no details, location slides - Presented, links are plain text, people a row of round photos and names, organizations their logos Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a79559d290
commit
7e21a0dd40
16 changed files with 652 additions and 68 deletions
|
|
@ -43,11 +43,24 @@
|
|||
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,
|
||||
organizations as their logos.
|
||||
|
||||
Keys while playing: arrows step, Space pauses, Escape leaves full
|
||||
screen (the browser's), S goes back to the setup.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowsOut, CaretLeft, CaretRight, Gear, Pause, Play } from '@phosphor-icons/react'
|
||||
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'
|
||||
|
||||
|
|
@ -67,10 +80,13 @@ import {
|
|||
import ContentBlocks, { eventLine } from '../components/ContentBlocks.tsx'
|
||||
import { LocationNumber, MapPicture, isMarked, locationNumber } from '../components/MapBlock.tsx'
|
||||
import { Paragraphs } from '../components/InlineText.tsx'
|
||||
import Logo from '../components/Logo.tsx'
|
||||
import { Presenting } from '../lib/presenting.ts'
|
||||
import {
|
||||
useEvent,
|
||||
type ContentBlock,
|
||||
type ContentBlockItem,
|
||||
type EventPresentLook,
|
||||
type ScheduleTag,
|
||||
type Venue,
|
||||
type VenueLocation,
|
||||
|
|
@ -105,6 +121,11 @@ const OWN_SLIDES = new Map([
|
|||
])
|
||||
/* 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
|
||||
|
||||
/* Seconds a long slide takes to scroll one screenful, when unset. */
|
||||
const PER_SCREEN = 8
|
||||
|
|
@ -119,7 +140,11 @@ 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
|
||||
|
|
@ -132,18 +157,28 @@ type Slide = {
|
|||
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 and the blocks under it. */
|
||||
type Section = { title: string; blocks: ContentBlock[] }
|
||||
/* 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, blocks: [] }]
|
||||
const sections: Section[] = [{ title, headed: false, 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)
|
||||
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)
|
||||
}
|
||||
|
|
@ -170,43 +205,58 @@ function readSettings(params: URLSearchParams) {
|
|||
seconds,
|
||||
screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN,
|
||||
only: params.get('only') || null,
|
||||
order: list(params.get('order')),
|
||||
}
|
||||
}
|
||||
type Settings = ReturnType<typeof readSettings>
|
||||
type Picks = Pick<Settings, 'skipped' | 'hidden' | 'seconds' | 'only'>
|
||||
|
||||
/* 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 = all.entries.flatMap((entry, e) => {
|
||||
let entries: ContentBlockItem[] = all.entries.flatMap((entry, e) => {
|
||||
if (hidden.has(key(n, d, e))) return []
|
||||
if (entry.kind !== 'block') return [entry]
|
||||
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(key(n, d, e, i))) }]
|
||||
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({ kind: 'overview', seconds: seconds.overview, ...at })
|
||||
if (seconds.overview) slides.push({ id: `o${key(n, d)}`, kind: 'overview', seconds: seconds.overview, ...at })
|
||||
|
||||
const media = (entry: ContentBlockItem, parent?: ContentBlockItem) => {
|
||||
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 })
|
||||
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({ kind: 'block', seconds: seconds.block, ...at, entry })
|
||||
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({ kind: 'spotlight', seconds: seconds.spotlight, ...at, entry: item, parent: entry })
|
||||
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({ kind: 'spotlight', seconds: seconds.spotlight, ...at, entry })
|
||||
if (seconds.spotlight && entry.kind !== 'break') {
|
||||
slides.push({ id: `s${keyOf(entry)}`, kind: 'spotlight', seconds: seconds.spotlight, ...at, entry })
|
||||
}
|
||||
media(entry)
|
||||
}
|
||||
})
|
||||
|
|
@ -215,11 +265,41 @@ function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden,
|
|||
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, label: tag.name, tag, days: tagDays, tags })
|
||||
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>; 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 } = picks
|
||||
const slides: Slide[] = []
|
||||
|
|
@ -227,29 +307,66 @@ function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>
|
|||
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) {
|
||||
// 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) {
|
||||
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 === 'map' && block.venue) mapSlides(slides, block, at, label, title, seconds)
|
||||
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 })
|
||||
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
|
||||
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()
|
||||
|
|
@ -284,7 +401,8 @@ export default function EventPresent() {
|
|||
)
|
||||
}
|
||||
|
||||
const accent = event.color || BRAND
|
||||
const look = event.present
|
||||
const accent = look?.accent || event.color || BRAND
|
||||
const back = `/events/${encodeURIComponent(event.id)}`
|
||||
|
||||
if (sections.length === 0) {
|
||||
|
|
@ -304,7 +422,8 @@ export default function EventPresent() {
|
|||
<Player
|
||||
title={event.title}
|
||||
accent={accent}
|
||||
slides={buildSlides(sections, schedules, settings)}
|
||||
look={look}
|
||||
slides={ordered(buildSlides(sections, schedules, settings), settings.order)}
|
||||
screen={settings.screen}
|
||||
onSetup={() => {
|
||||
const next = new URLSearchParams(params)
|
||||
|
|
@ -332,6 +451,7 @@ export default function EventPresent() {
|
|||
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(','))
|
||||
out.set('play', '1')
|
||||
setParams(out)
|
||||
}}
|
||||
|
|
@ -363,7 +483,18 @@ function Setup({
|
|||
const [seconds, setSeconds] = useState(settings.seconds)
|
||||
const [only, setOnly] = useState(settings.only)
|
||||
const [screen, setScreen] = useState(settings.screen)
|
||||
const count = buildSlides(sections, schedules, { skipped, hidden, seconds, only }).length
|
||||
const [order, setOrder] = useState(settings.order)
|
||||
const [dragging, setDragging] = useState<number | null>(null)
|
||||
const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only }), 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) => {
|
||||
|
|
@ -529,11 +660,67 @@ function Setup({
|
|||
</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 })}
|
||||
onClick={() => onPlay({ skipped, hidden, seconds, screen, only, order })}
|
||||
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
|
||||
style={{ background: accent, color: readableOn(accent) }}
|
||||
>
|
||||
|
|
@ -591,15 +778,39 @@ function PickEntry({
|
|||
|
||||
/* ── 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
|
||||
|
|
@ -675,16 +886,35 @@ function Player({
|
|||
}
|
||||
|
||||
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
|
||||
return (
|
||||
<main
|
||||
onMouseMove={wake}
|
||||
className={`present relative flex h-screen flex-col overflow-hidden bg-surface text-body ${controls ? '' : 'cursor-none'}`}
|
||||
style={lookTokens(look)}
|
||||
className={`present relative isolate flex h-screen flex-col overflow-hidden bg-surface text-body ${controls ? '' : 'cursor-none'}`}
|
||||
>
|
||||
<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.label === title ? '' : slide.label}</span>
|
||||
</div>
|
||||
{/* The background image, the background color over it at Dim. */}
|
||||
{background && (
|
||||
<div aria-hidden="true" className="absolute inset-0 -z-10 bg-cover bg-center" 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]">
|
||||
|
|
@ -692,19 +922,35 @@ function Player({
|
|||
value={{ wait: slide.seconds / 2, screen, paused, scrolls: (s) => setScroll({ index, seconds: s }) }}
|
||||
>
|
||||
<ScheduleTags.Provider value={slide.tags ?? []}>
|
||||
<SlideView slide={slide} accent={accent} />
|
||||
<Presenting.Provider value={true}>
|
||||
<SlideView slide={slide} accent={accent} />
|
||||
</Presenting.Provider>
|
||||
</ScheduleTags.Provider>
|
||||
</SlideTime.Provider>
|
||||
</div>
|
||||
|
||||
{/* How long this slide has left. */}
|
||||
<div className="h-1.5 shrink-0" style={{ background: `color-mix(in srgb, ${accent} 20%, transparent)` }}>
|
||||
{frame !== 'none' && (
|
||||
<div
|
||||
key={`${index}-${paused}`}
|
||||
className={paused ? 'h-full w-0' : 'present-timer h-full'}
|
||||
style={{ background: accent, animationDuration: `${seconds}s` }}
|
||||
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 && (
|
||||
<Logo
|
||||
src={mediaUrl(look.logo)}
|
||||
className={`pointer-events-none absolute right-[3vw] h-[8vh] w-auto max-w-[16vw] object-contain ${
|
||||
frame === 'border' ? 'bottom-[4vh]' : 'bottom-[3vh]'
|
||||
}`}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={`absolute bottom-6 left-1/2 flex -translate-x-1/2 items-center gap-3 transition-opacity duration-300 ${
|
||||
|
|
@ -829,11 +1075,18 @@ function useRatio(src: string | null) {
|
|||
|
||||
/* 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 }) {
|
||||
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} big />
|
||||
<MapPicture venue={venue} accent={accent} active={active} only={only && new Set(only)} big />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -937,24 +1190,38 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
|
||||
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} />
|
||||
<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}>{venue.name}</SlideTitle>
|
||||
<SlideTitle color={color}>{heading}</SlideTitle>
|
||||
<Scroll>
|
||||
<ol className="space-y-[1.5vh]">
|
||||
{venue.locations.map((location, i) => (
|
||||
{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 && (
|
||||
{location.detail && !slide.noDetails && (
|
||||
<span className="block text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{location.detail}</span>
|
||||
)}
|
||||
</span>
|
||||
|
|
@ -983,7 +1250,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
<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 && (
|
||||
{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>
|
||||
|
|
@ -1002,7 +1269,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
const items = slide.items ?? []
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
<SlideTitle color={color}>{slide.label}</SlideTitle>
|
||||
<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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue