diff --git a/src/pages/EventPresent.tsx b/src/pages/EventPresent.tsx index 71dc296..35e382d 100644 --- a/src/pages/EventPresent.tsx +++ b/src/pages/EventPresent.tsx @@ -30,6 +30,11 @@ i
.) and ticks its items on and off (`hide`, l
..). A people block shows each one's role or title when the setup ticks it (`titles`,
.). + callout a callout block the setup picks for a slide of its + own (`lists`, q
.): its text centered + under its heading (the subheading above it in the + section, else the section's), out of the section's + text slide A schedule's slides, for each day picked, in order: overview the day's picked entries on one slide @@ -129,6 +134,7 @@ const KINDS = [ { 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 }, + { key: 'callout', label: 'Callouts', help: 'A callout picked for a slide of its own, centered under its heading', seconds: 12 }, ] as const type Kind = (typeof KINDS)[number]['key'] @@ -156,13 +162,17 @@ const eventKey = (s: number, b: number, at: number | EventPart) => /* 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 callout's pick in `lists`: a slide of its own. */ +const calloutKey = (s: number, b: number) => `q${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. */ + for an Overview slide or A slide per item, a callout picked for its + own slide), else null. */ const ownSlides = (block: ContentBlock, lists: Set, 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) + (block.type === 'list' && (lists.has(overviewKey(s, b)) || lists.has(itemsKey(s, b))) ? 'List' : null) ?? + (block.type === 'callout' && lists.has(calloutKey(s, b)) ? 'Callout' : null) /* Blocks that start a section. */ const STARTS_SECTION = new Set(['heading', 'tab']) @@ -382,6 +392,12 @@ function buildSlides(sections: Section[], schedules: Map 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 === 'callout' && seconds.callout && ownSlides(block, lists, s, b)) { + // Under the subheading above it in the section, else the section's heading. + const above = section.blocks.slice(0, b).reverse().find((other) => other.type === 'subheading') + const heading = (above && (above.present?.text || above.text)) || label + slides.push({ id: `q${at}`, kind: 'callout', seconds: seconds.callout, label, title: heading, blocks: [block] }) + } 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) { @@ -443,6 +459,8 @@ function slideName(slide: Slide): string { return slide.title ?? (slide.items ?? []).map((item) => item.text).join(', ') case 'item': return entry!.text + case 'callout': + return `${slide.title}: ${preview(slide.blocks?.[0]?.text, 40)}` default: return [slide.day?.name, entry!.time, entry!.text].filter(Boolean).join(' ยท ') } @@ -718,7 +736,8 @@ function Setup({

Sections

-

The page's parts, each starting at a Heading block.

+

The page's parts, each starting at a Heading block.

+ s)} off={skipped} onChange={setSkipped} className="mb-4" />
{sections.map((section, s) => { const on = !skipped.has(s) @@ -751,6 +770,15 @@ function Setup({ checked={lists.has(itemsKey(s, b))} onToggle={() => setLists(toggle(lists, itemsKey(s, b)))} /> + {own && ( + listKey(s, b, i))} + off={hidden} + onChange={setHidden} + enabled={on} + className="pl-7" + /> + )} {own && (
    {block.items.map((item, i) => ( @@ -768,6 +796,19 @@ function Setup({
) } + // A callout: a slide of its own, or the section's text. + if (block.type === 'callout' && block.text) { + return ( +
+ setLists(toggle(lists, calloutKey(s, b)))} + /> +
+ ) + } // A people block: their roles and titles, or not. if (block.type === 'people') { return ( @@ -791,6 +832,12 @@ function Setup({

Events: {preview(events.map(({ item }) => name(item)).join(', '), 60)}

+ eventKey(s, b, part))} + off={hidden} + onChange={setHidden} + enabled={on} + />
{EVENT_PARTS.map(([part, partLabel]) => ( ))}
+ eventKey(s, b, i))} + off={hidden} + onChange={setHidden} + enabled={on} + className="pl-7" + />
    {events.map(({ item, i }) => (
  • @@ -822,6 +876,9 @@ function Setup({ const { n, days } = schedule return (
    + {days.length > 1 && ( + key(n, d))} off={hidden} onChange={setHidden} enabled={on} /> + )} {days.map((day, d) => (
    setHidden(toggle(hidden, key(n, d)))} /> + key(n, d, e))} + off={hidden} + onChange={setHidden} + enabled={on && !hidden.has(key(n, d))} + className="mt-2 pl-7" + />
      {day.entries.map((entry, e) => (
    • @@ -841,6 +905,14 @@ function Setup({ onToggle={() => setHidden(toggle(hidden, key(n, d, e)))} /> {entry.kind === 'block' && entry.items?.length ? ( + <> + key(n, d, e, i))} + off={hidden} + onChange={setHidden} + enabled={on && !hidden.has(key(n, d)) && !hidden.has(key(n, d, e))} + className="mt-2 pl-7" + />
        {entry.items.map((item, i) => (
      • @@ -853,6 +925,7 @@ function Setup({
      • ))}
      + ) : null}
    • ))} @@ -947,6 +1020,42 @@ function Setup({ ) } +/* Select all and Deselect all for a list of the setup's checkboxes, + each ticked off while its key is in `off`. */ +function AllNone({ + keys, + off, + onChange, + enabled = true, + className = '', +}: { + keys: T[] + off: Set + onChange: (next: Set) => void + enabled?: boolean + className?: string +}) { + const set = (on: boolean) => { + const next = new Set(off) + for (const k of keys) { + if (on) next.delete(k) + else next.add(k) + } + onChange(next) + } + const button = 'text-link underline disabled:no-underline disabled:opacity-50' + return ( +
      + + +
      + ) +} + /* 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 @@ -1562,6 +1671,27 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) { ) } + if (slide.kind === 'callout') { + // The callout's tinted box, its text large, in the middle of the + // slide under its heading. + const block = slide.blocks![0] + return ( +
      + + {slide.title} + + + + +
      + ) + } + if (slide.kind === 'list') { const items = slide.items ?? [] return (