Present: a list's slides picked on the setup screen, not the block

- 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>
This commit is contained in:
Zaldimmar 2026-11-12 05:02:06 -06:00
parent ae06cd2b4f
commit c4bb685bc0
6 changed files with 70 additions and 68 deletions

View file

@ -16,13 +16,14 @@
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 with an Overview slide (098): its
list a list block picked for an Overview slide: its
items' text, centered
item then, with A slide per item, each item: its text
the heading, its detail under it, centered
A list without either is part of its section's text. The setup
ticks a list's overview (`hide` l<section>.<block>) and its items
(l<section>.<block>.<item>) on and off.
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
@ -102,6 +103,7 @@ import {
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'
@ -130,13 +132,16 @@ const OWN_SLIDES = new Map([
['map', 'Map'],
['events', 'Events'],
])
/* What the setup calls a block with slides of its own (a list with
an Overview slide or A slide per item, 098), else null. */
const ownSlides = (block: ContentBlock): string | null =>
/* 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' && (block.present?.list_overview || block.present?.list_items) ? 'List' : null)
/* A list's overview's key in `hide`, and an item's (`i`). */
const listKey = (s: number, b: number, i?: number) => `l${s}.${b}${i == null ? '' : `.${i}`}`
(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'])
@ -235,11 +240,12 @@ function readSettings(params: URLSearchParams) {
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'>
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. */
@ -332,12 +338,12 @@ function mapSlides(slides: Slide[], block: ContentBlock, at: string, label: stri
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 } = picks
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) => !ownSlides(block))
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 })
@ -347,12 +353,12 @@ function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>
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)) {
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 && block.present?.list_overview && items.length && !hidden.has(listKey(s, b))) {
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 && block.present?.list_items) {
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 })
}
}
@ -510,6 +516,7 @@ export default function EventPresent() {
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)
}}
@ -543,8 +550,9 @@ function Setup({
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 }), order)
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) => {
@ -680,7 +688,7 @@ function Setup({
<div className="space-y-6">
{sections.map((section, s) => {
const on = !skipped.has(s)
const kinds = [...new Set(section.blocks.map((block) => ownSlides(block) ?? 'Text'))]
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>
@ -690,31 +698,39 @@ function Setup({
<span className="text-xs text-muted">{kinds.join(', ')}</span>
</label>
{section.blocks.map((block, b) => {
// A list with slides: its overview, then its items.
if (block.type === 'list' && ownSlides(block)) {
// 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">
{block.present?.list_overview && (
<PickEntry
label="List overview"
strong
enabled={on}
checked={!hidden.has(listKey(s, b))}
onToggle={() => setHidden(toggle(hidden, listKey(s, b)))}
/>
<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>
)}
<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>
)
}
@ -829,7 +845,7 @@ function Setup({
<button
type="button"
disabled={count === 0}
onClick={() => onPlay({ skipped, hidden, seconds, screen, only, order, theme })}
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) }}
>