From c4bb685bc04d935e721f7ef036c6dc87e5f147b3 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Thu, 12 Nov 2026 05:02:06 -0600 Subject: [PATCH] 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 --- server/src/admin-schema/columns.js | 3 - .../migrations/100_present_list_picked.sql | 10 ++ server/src/shape.js | 5 +- src/lib/adminSchema/shared.ts | 14 --- src/lib/useContent.ts | 4 - src/pages/EventPresent.tsx | 102 ++++++++++-------- 6 files changed, 70 insertions(+), 68 deletions(-) create mode 100644 server/src/migrations/100_present_list_picked.sql diff --git a/server/src/admin-schema/columns.js b/server/src/admin-schema/columns.js index ff4f3d1..5e00110 100644 --- a/server/src/admin-schema/columns.js +++ b/server/src/admin-schema/columns.js @@ -190,9 +190,6 @@ export const blocksChild = (ownerKind) => ({ bool("present_map_no_details"), enumeration("present_places", ["picked", "none"]), text("present_place_keys"), - // A list's own slides (098). - bool("present_list_overview"), - bool("present_list_items"), ], children: [ { diff --git a/server/src/migrations/100_present_list_picked.sql b/server/src/migrations/100_present_list_picked.sql new file mode 100644 index 0000000..8ee15da --- /dev/null +++ b/server/src/migrations/100_present_list_picked.sql @@ -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; diff --git a/server/src/shape.js b/server/src/shape.js index 8c49b89..a622323 100644 --- a/server/src/shape.js +++ b/server/src/shape.js @@ -76,8 +76,6 @@ function presentOf(row) { map_no_details: row.present_map_no_details === 1, places: row.present_places, 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; } @@ -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, word_motion, word_direction, word_seconds, list_style, org_kind, present_show, present_text, present_map_split, present_map_no_list, - present_map_no_details, present_places, present_place_keys, - present_list_overview, present_list_items + present_map_no_details, present_places, present_place_keys FROM content_blocks WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)}) ORDER BY owner_id, sort_order`, diff --git a/src/lib/adminSchema/shared.ts b/src/lib/adminSchema/shared.ts index 06c556e..f469cf4 100644 --- a/src/lib/adminSchema/shared.ts +++ b/src/lib/adminSchema/shared.ts @@ -556,20 +556,6 @@ export const PRESENT_BLOCK_FIELDS = [ when: { path: "present_places", value: "picked" }, 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 = { diff --git a/src/lib/useContent.ts b/src/lib/useContent.ts index bd2fc34..f6f5f0f 100644 --- a/src/lib/useContent.ts +++ b/src/lib/useContent.ts @@ -89,10 +89,6 @@ export type BlockPresent = { /** A map: which locations get a slide; null every marked one. */ places: 'picked' | 'none' | null 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). */ diff --git a/src/pages/EventPresent.tsx b/src/pages/EventPresent.tsx index 7e6e8d3..55d8194 100644 --- a/src/pages/EventPresent.tsx +++ b/src/pages/EventPresent.tsx @@ -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
.) and its items - (l
..) 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
. and + i
.) and ticks its items on and off (`hide`, + l
..). 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, 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 -type Picks = Pick +type Picks = Pick /* 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, 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 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(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({
{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 (
{section.title} @@ -690,31 +698,39 @@ function Setup({ {kinds.join(', ')} {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 (
- {block.present?.list_overview && ( - setHidden(toggle(hidden, listKey(s, b)))} - /> +

List: {first}

+ setLists(toggle(lists, overviewKey(s, b)))} + /> + setLists(toggle(lists, itemsKey(s, b)))} + /> + {own && ( +
    + {block.items.map((item, i) => ( +
  • + setHidden(toggle(hidden, listKey(s, b, i)))} + /> +
  • + ))} +
)} -
    - {(block.items ?? []).map((item, i) => ( -
  • - setHidden(toggle(hidden, listKey(s, b, i)))} - /> -
  • - ))} -
) } @@ -829,7 +845,7 @@ function Setup({