From a59702b7f35fe56c4ae1cb039ac1ad657cb93638 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Thu, 12 Nov 2026 06:04:48 -0600 Subject: [PATCH] Present: a section's pictures left or right of its text, fitted - Setup, per section with pictures and text: Pictures in the text, left of it or right of it (`pictures`), in a column beside the rest - That slide shrinks to fit (Fit), measured again as pictures load Co-Authored-By: Claude Opus 5.5 --- src/pages/EventPresent.tsx | 108 ++++++++++++++++++++++++++++++++----- 1 file changed, 95 insertions(+), 13 deletions(-) diff --git a/src/pages/EventPresent.tsx b/src/pages/EventPresent.tsx index da19123..6fb705b 100644 --- a/src/pages/EventPresent.tsx +++ b/src/pages/EventPresent.tsx @@ -30,6 +30,9 @@ 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`,
.). + A section with pictures (image blocks) and other text can have the + setup put its pictures in a column left or right of the rest + (`pictures`,
:left|right), the slide shrunk to fit. 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 @@ -174,6 +177,11 @@ const ownSlides = (block: ContentBlock, lists: Set, s: number, b: number (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) +/* Where a section's pictures can go beside its text. */ +const SIDES = ['left', 'right'] as const +type Side = (typeof SIDES)[number] +const isPicture = (block: ContentBlock) => block.type === 'image' + /* Blocks that start a section. */ const STARTS_SECTION = new Set(['heading', 'tab']) /* Text that alone makes no section slide: the heading titles what @@ -219,6 +227,8 @@ type Slide = { days?: Day[] tags?: ScheduleTag[] blocks?: ContentBlock[] + /* A section's pictures in a column beside its text (the setup). */ + pictures?: Side venue?: Venue location?: VenueLocation items?: ContentBlockItem[] @@ -275,11 +285,17 @@ function readSettings(params: URLSearchParams) { order: list(params.get('order')), lists: new Set(list(params.get('lists')) ?? []), titles: new Set(list(params.get('titles')) ?? []), + pictures: new Map( + (list(params.get('pictures')) ?? []).flatMap((pick) => { + const [at, side] = pick.split(':') + return SIDES.includes(side as Side) ? [[Number(at), side as Side] as const] : [] + }), + ), 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. */ @@ -372,7 +388,7 @@ 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, lists, titles } = picks + const { skipped, seconds, hidden, lists, titles, pictures } = picks const slides: Slide[] = [] sections.forEach((section, s) => { if (skipped.has(s)) return @@ -385,7 +401,11 @@ function buildSlides(sections: Section[], schedules: Map }) // 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 }) + if (seconds.section && own) { + // Pictures beside the text, when picked and there are both. + const side = text.some(isPicture) && text.some((block) => !isPicture(block)) ? pictures.get(s) : undefined + slides.push({ id: `t${s}`, kind: 'section', seconds: seconds.section, label, blocks: text, pictures: side }) + } const title = section.headed && !own ? label : null section.blocks.forEach((block, b) => { const at = `${s}.${b}` @@ -568,6 +588,7 @@ export default function EventPresent() { if (next.theme) out.set('theme', next.theme) if (next.lists.size) out.set('lists', [...next.lists].join(',')) if (next.titles.size) out.set('titles', [...next.titles].join(',')) + if (next.pictures.size) out.set('pictures', [...next.pictures].map(([at, side]) => `${at}:${side}`).join(',')) out.set('play', '1') setParams(out) }} @@ -603,8 +624,9 @@ function Setup({ const [theme, setTheme] = useState(settings.theme) const [lists, setLists] = useState(settings.lists) const [titles, setTitles] = useState(settings.titles) + const [pictures, setPictures] = useState(settings.pictures) const [dragging, setDragging] = useState(null) - const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only, lists, titles }), order) + const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only, lists, titles, pictures }), order) const count = slides.length // Moves a slide in the list, which then names every slide shown. const move = (from: number, to: number) => { @@ -750,6 +772,29 @@ function Setup({ {section.title} {kinds.join(', ')} + {/* Pictures and other text: where the pictures go. */} + {section.blocks.some(isPicture) && + section.blocks.some((block, b) => !isPicture(block) && !ownSlides(block, lists, s, b)) && ( + + )} {section.blocks.map((block, b) => { // A list: its own slides if picked, then its items. if (block.type === 'list' && block.items?.length) { @@ -1001,7 +1046,7 @@ function Setup({