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

@ -190,9 +190,6 @@ export const blocksChild = (ownerKind) => ({
bool("present_map_no_details"), bool("present_map_no_details"),
enumeration("present_places", ["picked", "none"]), enumeration("present_places", ["picked", "none"]),
text("present_place_keys"), text("present_place_keys"),
// A list's own slides (098).
bool("present_list_overview"),
bool("present_list_items"),
], ],
children: [ children: [
{ {

View file

@ -0,0 +1,10 @@
-- ═══════════════════════════════════════════════════════════════
-- 100 A LIST'S SLIDES PICKED WHEN PRESENTING
--
-- A list block's Overview slide and A slide per item (098) are
-- picked on the Present setup screen (EventPresent.tsx, `lists` in
-- its address) rather than on the block, so 098's columns go.
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE content_blocks DROP COLUMN present_list_overview;
ALTER TABLE content_blocks DROP COLUMN present_list_items;

View file

@ -76,8 +76,6 @@ function presentOf(row) {
map_no_details: row.present_map_no_details === 1, map_no_details: row.present_map_no_details === 1,
places: row.present_places, places: row.present_places,
place_keys: row.present_place_keys ? row.present_place_keys.split(",").filter(Boolean) : [], place_keys: row.present_place_keys ? row.present_place_keys.split(",").filter(Boolean) : [],
list_overview: row.present_list_overview === 1,
list_items: row.present_list_items === 1,
}; };
return Object.values(present).some((value) => (Array.isArray(value) ? value.length : value)) ? present : null; return Object.values(present).some((value) => (Array.isArray(value) ? value.length : value)) ? present : null;
} }
@ -91,8 +89,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id, `SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id,
word_motion, word_direction, word_seconds, list_style, org_kind, word_motion, word_direction, word_seconds, list_style, org_kind,
present_show, present_text, present_map_split, present_map_no_list, present_show, present_text, present_map_split, present_map_no_list,
present_map_no_details, present_places, present_place_keys, present_map_no_details, present_places, present_place_keys
present_list_overview, present_list_items
FROM content_blocks FROM content_blocks
WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)}) WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)})
ORDER BY owner_id, sort_order`, ORDER BY owner_id, sort_order`,

View file

@ -556,20 +556,6 @@ export const PRESENT_BLOCK_FIELDS = [
when: { path: "present_places", value: "picked" }, when: { path: "present_places", value: "picked" },
emptyNote: "No locations yet: pick the block's Venue, and give it locations under Data → Venues.", emptyNote: "No locations yet: pick the block's Venue, and give it locations under Data → Venues.",
}, },
{
path: "present_list_overview",
label: "Overview slide",
widget: "checkbox",
help: "Presented: a slide of every item's text, without the detail, centered.",
when: { path: "type", value: "list" },
},
{
path: "present_list_items",
label: "A slide per item",
widget: "checkbox",
help: "Presented: each item alone, its text the heading and its detail under it, centered. With either of these the list leaves its section's text slide.",
when: { path: "type", value: "list" },
},
]; ];
export const blocksChild = { export const blocksChild = {

View file

@ -89,10 +89,6 @@ export type BlockPresent = {
/** A map: which locations get a slide; null every marked one. */ /** A map: which locations get a slide; null every marked one. */
places: 'picked' | 'none' | null places: 'picked' | 'none' | null
place_keys: string[] place_keys: string[]
/** A list: one slide of its items' text (098). */
list_overview: boolean
/** A list: a slide per item, its detail under its text (098). */
list_items: boolean
} }
/** An event's presentation look (095). */ /** An event's presentation look (095). */

View file

@ -16,13 +16,14 @@
cards each events block (088): its events on one slide cards each events block (088): its events on one slide
event then each event alone: picture, title, its person event then each event alone: picture, title, its person
host and its own page's blocks (else its card text) 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 items' text, centered
item then, with A slide per item, each item: its text item then, picked for A slide per item, each item: its
the heading, its detail under it, centered text the heading, its detail under it, centered
A list without either is part of its section's text. The setup A list picked for neither is part of its section's text. The
ticks a list's overview (`hide` l<section>.<block>) and its items setup picks them per list (`lists`, o<section>.<block> and
(l<section>.<block>.<item>) on and off. 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: A schedule's slides, for each day picked, in order:
overview the day's picked entries on one slide overview the day's picked entries on one slide
@ -102,6 +103,7 @@ import {
import { mediaUrl } from '../lib/media.ts' import { mediaUrl } from '../lib/media.ts'
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts' import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
import { documentTitle } from '../lib/site.ts' import { documentTitle } from '../lib/site.ts'
import { preview } from '../lib/text.ts'
import { useDarkTheme } from '../lib/darkTheme.ts' import { useDarkTheme } from '../lib/darkTheme.ts'
import './EventPresent.css' import './EventPresent.css'
@ -130,13 +132,16 @@ const OWN_SLIDES = new Map([
['map', 'Map'], ['map', 'Map'],
['events', 'Events'], ['events', 'Events'],
]) ])
/* What the setup calls a block with slides of its own (a list with /* A list's picks in `lists`: its Overview slide, A slide per item. */
an Overview slide or A slide per item, 098), else null. */ const overviewKey = (s: number, b: number) => `o${s}.${b}`
const ownSlides = (block: ContentBlock): string | null => 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) ?? OWN_SLIDES.get(block.type) ??
(block.type === 'list' && (block.present?.list_overview || block.present?.list_items) ? 'List' : null) (block.type === 'list' && (lists.has(overviewKey(s, b)) || lists.has(itemsKey(s, b))) ? '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}`}`
/* Blocks that start a section. */ /* Blocks that start a section. */
const STARTS_SECTION = new Set(['heading', 'tab']) const STARTS_SECTION = new Set(['heading', 'tab'])
@ -235,11 +240,12 @@ function readSettings(params: URLSearchParams) {
screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN, screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN,
only: params.get('only') || null, only: params.get('only') || null,
order: list(params.get('order')), order: list(params.get('order')),
lists: new Set(list(params.get('lists')) ?? []),
theme: THEMES.find((theme) => theme === params.get('theme')) ?? null, theme: THEMES.find((theme) => theme === params.get('theme')) ?? null,
} }
} }
type Settings = ReturnType<typeof readSettings> 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 /* An entry or sub-item with its key (key()), carried through the
picks and the tag filter, which copy blocks. */ 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 o, k, s, g and m a schedule's overview, block, spotlight, graphic
and map image, and x its tag slides, by key(). */ and map image, and x its tag slides, by key(). */
function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>, picks: Picks): Slide[] { 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[] = [] const slides: Slide[] = []
sections.forEach((section, s) => { sections.forEach((section, s) => {
if (skipped.has(s)) return if (skipped.has(s)) return
const label = section.title 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. // Nothing but a heading: it titles the slides that follow.
const own = text.some((block) => !FILLER.has(block.type)) 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 }) 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) const schedule = schedules.get(block)
if (schedule) scheduleSlides(slides, schedule, picks) if (schedule) scheduleSlides(slides, schedule, picks)
if (block.type === 'map' && block.venue) mapSlides(slides, block, at, label, title, seconds) 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 }])) 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) }) 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 }) 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.only) out.set('only', next.only)
if (next.order?.length) out.set('order', next.order.join(',')) if (next.order?.length) out.set('order', next.order.join(','))
if (next.theme) out.set('theme', next.theme) if (next.theme) out.set('theme', next.theme)
if (next.lists.size) out.set('lists', [...next.lists].join(','))
out.set('play', '1') out.set('play', '1')
setParams(out) setParams(out)
}} }}
@ -543,8 +550,9 @@ function Setup({
const [screen, setScreen] = useState(settings.screen) const [screen, setScreen] = useState(settings.screen)
const [order, setOrder] = useState(settings.order) const [order, setOrder] = useState(settings.order)
const [theme, setTheme] = useState(settings.theme) const [theme, setTheme] = useState(settings.theme)
const [lists, setLists] = useState(settings.lists)
const [dragging, setDragging] = useState<number | null>(null) 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 const count = slides.length
// Moves a slide in the list, which then names every slide shown. // Moves a slide in the list, which then names every slide shown.
const move = (from: number, to: number) => { const move = (from: number, to: number) => {
@ -680,7 +688,7 @@ function Setup({
<div className="space-y-6"> <div className="space-y-6">
{sections.map((section, s) => { {sections.map((section, s) => {
const on = !skipped.has(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 ( return (
<fieldset key={s} className="bg-raised p-4 shadow-sm"> <fieldset key={s} className="bg-raised p-4 shadow-sm">
<legend className="sr-only">{section.title}</legend> <legend className="sr-only">{section.title}</legend>
@ -690,31 +698,39 @@ function Setup({
<span className="text-xs text-muted">{kinds.join(', ')}</span> <span className="text-xs text-muted">{kinds.join(', ')}</span>
</label> </label>
{section.blocks.map((block, b) => { {section.blocks.map((block, b) => {
// A list with slides: its overview, then its items. // A list: its own slides if picked, then its items.
if (block.type === 'list' && ownSlides(block)) { 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 ( return (
<div key={b} className="mt-3 space-y-2 pl-7"> <div key={b} className="mt-3 space-y-2 pl-7">
{block.present?.list_overview && ( <p className="text-sm text-muted">List: {first}</p>
<PickEntry <PickEntry
label="List overview" label="Overview slide: every item's text, centered"
strong enabled={on}
enabled={on} checked={lists.has(overviewKey(s, b))}
checked={!hidden.has(listKey(s, b))} onToggle={() => setLists(toggle(lists, overviewKey(s, b)))}
onToggle={() => setHidden(toggle(hidden, listKey(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> </div>
) )
} }
@ -829,7 +845,7 @@ function Setup({
<button <button
type="button" type="button"
disabled={count === 0} 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" className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
style={{ background: accent, color: readableOn(accent) }} style={{ background: accent, color: readableOn(accent) }}
> >