Present: callout slides, Select all and Deselect all on the setup
- Setup, per callout block: a slide of its own, centered under the subheading above it (else the section's heading); Callouts seconds - Select all and Deselect all over each list of the setup's checkboxes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
afa95179ef
commit
c46a612226
1 changed files with 133 additions and 3 deletions
|
|
@ -30,6 +30,11 @@
|
||||||
i<section>.<block>) and ticks its items on and off (`hide`,
|
i<section>.<block>) and ticks its items on and off (`hide`,
|
||||||
l<section>.<block>.<item>). A people block shows each one's role
|
l<section>.<block>.<item>). A people block shows each one's role
|
||||||
or title when the setup ticks it (`titles`, <section>.<block>).
|
or title when the setup ticks it (`titles`, <section>.<block>).
|
||||||
|
callout a callout block the setup picks for a slide of its
|
||||||
|
own (`lists`, q<section>.<block>): 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:
|
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
|
||||||
|
|
@ -129,6 +134,7 @@ const KINDS = [
|
||||||
{ key: 'event', label: 'Event spotlight', help: 'Each event of an events block alone', seconds: 12 },
|
{ 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: '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: '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
|
] as const
|
||||||
type Kind = (typeof KINDS)[number]['key']
|
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. */
|
/* A list's picks in `lists`: its Overview slide, A slide per item. */
|
||||||
const overviewKey = (s: number, b: number) => `o${s}.${b}`
|
const overviewKey = (s: number, b: number) => `o${s}.${b}`
|
||||||
const itemsKey = (s: number, b: number) => `i${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`. */
|
/* A list item's key in `hide`. */
|
||||||
const listKey = (s: number, b: number, i: number) => `l${s}.${b}.${i}`
|
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
|
/* 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<string>, s: number, b: number): string | 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' && (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. */
|
/* Blocks that start a section. */
|
||||||
const STARTS_SECTION = new Set(['heading', 'tab'])
|
const STARTS_SECTION = new Set(['heading', 'tab'])
|
||||||
|
|
@ -382,6 +392,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 === '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)) {
|
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 && lists.has(overviewKey(s, b)) && items.length) {
|
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(', ')
|
return slide.title ?? (slide.items ?? []).map((item) => item.text).join(', ')
|
||||||
case 'item':
|
case 'item':
|
||||||
return entry!.text
|
return entry!.text
|
||||||
|
case 'callout':
|
||||||
|
return `${slide.title}: ${preview(slide.blocks?.[0]?.text, 40)}`
|
||||||
default:
|
default:
|
||||||
return [slide.day?.name, entry!.time, entry!.text].filter(Boolean).join(' · ')
|
return [slide.day?.name, entry!.time, entry!.text].filter(Boolean).join(' · ')
|
||||||
}
|
}
|
||||||
|
|
@ -718,7 +736,8 @@ function Setup({
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2 className="mb-4 text-2xl font-bold text-ink">Sections</h2>
|
<h2 className="mb-4 text-2xl font-bold text-ink">Sections</h2>
|
||||||
<p className="mb-4 text-sm text-muted">The page's parts, each starting at a Heading block.</p>
|
<p className="mb-2 text-sm text-muted">The page's parts, each starting at a Heading block.</p>
|
||||||
|
<AllNone keys={sections.map((_, s) => s)} off={skipped} onChange={setSkipped} className="mb-4" />
|
||||||
<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)
|
||||||
|
|
@ -751,6 +770,15 @@ function Setup({
|
||||||
checked={lists.has(itemsKey(s, b))}
|
checked={lists.has(itemsKey(s, b))}
|
||||||
onToggle={() => setLists(toggle(lists, itemsKey(s, b)))}
|
onToggle={() => setLists(toggle(lists, itemsKey(s, b)))}
|
||||||
/>
|
/>
|
||||||
|
{own && (
|
||||||
|
<AllNone
|
||||||
|
keys={block.items.map((_, i) => listKey(s, b, i))}
|
||||||
|
off={hidden}
|
||||||
|
onChange={setHidden}
|
||||||
|
enabled={on}
|
||||||
|
className="pl-7"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{own && (
|
{own && (
|
||||||
<ul className="space-y-2 pl-7">
|
<ul className="space-y-2 pl-7">
|
||||||
{block.items.map((item, i) => (
|
{block.items.map((item, i) => (
|
||||||
|
|
@ -768,6 +796,19 @@ function Setup({
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// A callout: a slide of its own, or the section's text.
|
||||||
|
if (block.type === 'callout' && block.text) {
|
||||||
|
return (
|
||||||
|
<div key={b} className="mt-3 pl-7">
|
||||||
|
<PickEntry
|
||||||
|
label={`Callout: ${preview(block.present?.text || block.text, 50)}, as its own slide`}
|
||||||
|
enabled={on}
|
||||||
|
checked={lists.has(calloutKey(s, b))}
|
||||||
|
onToggle={() => setLists(toggle(lists, calloutKey(s, b)))}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
// A people block: their roles and titles, or not.
|
// A people block: their roles and titles, or not.
|
||||||
if (block.type === 'people') {
|
if (block.type === 'people') {
|
||||||
return (
|
return (
|
||||||
|
|
@ -791,6 +832,12 @@ function Setup({
|
||||||
<p className="text-sm text-muted">
|
<p className="text-sm text-muted">
|
||||||
Events: {preview(events.map(({ item }) => name(item)).join(', '), 60)}
|
Events: {preview(events.map(({ item }) => name(item)).join(', '), 60)}
|
||||||
</p>
|
</p>
|
||||||
|
<AllNone
|
||||||
|
keys={EVENT_PARTS.map(([part]) => eventKey(s, b, part))}
|
||||||
|
off={hidden}
|
||||||
|
onChange={setHidden}
|
||||||
|
enabled={on}
|
||||||
|
/>
|
||||||
<div className="flex flex-wrap gap-x-6 gap-y-2">
|
<div className="flex flex-wrap gap-x-6 gap-y-2">
|
||||||
{EVENT_PARTS.map(([part, partLabel]) => (
|
{EVENT_PARTS.map(([part, partLabel]) => (
|
||||||
<PickEntry
|
<PickEntry
|
||||||
|
|
@ -802,6 +849,13 @@ function Setup({
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
<AllNone
|
||||||
|
keys={events.map(({ i }) => eventKey(s, b, i))}
|
||||||
|
off={hidden}
|
||||||
|
onChange={setHidden}
|
||||||
|
enabled={on}
|
||||||
|
className="pl-7"
|
||||||
|
/>
|
||||||
<ul className="space-y-2 pl-7">
|
<ul className="space-y-2 pl-7">
|
||||||
{events.map(({ item, i }) => (
|
{events.map(({ item, i }) => (
|
||||||
<li key={i}>
|
<li key={i}>
|
||||||
|
|
@ -822,6 +876,9 @@ function Setup({
|
||||||
const { n, days } = schedule
|
const { n, days } = schedule
|
||||||
return (
|
return (
|
||||||
<div key={b} className="mt-3 space-y-4 pl-7">
|
<div key={b} className="mt-3 space-y-4 pl-7">
|
||||||
|
{days.length > 1 && (
|
||||||
|
<AllNone keys={days.map((_, d) => key(n, d))} off={hidden} onChange={setHidden} enabled={on} />
|
||||||
|
)}
|
||||||
{days.map((day, d) => (
|
{days.map((day, d) => (
|
||||||
<div key={d}>
|
<div key={d}>
|
||||||
<PickEntry
|
<PickEntry
|
||||||
|
|
@ -831,6 +888,13 @@ function Setup({
|
||||||
checked={!hidden.has(key(n, d))}
|
checked={!hidden.has(key(n, d))}
|
||||||
onToggle={() => setHidden(toggle(hidden, key(n, d)))}
|
onToggle={() => setHidden(toggle(hidden, key(n, d)))}
|
||||||
/>
|
/>
|
||||||
|
<AllNone
|
||||||
|
keys={day.entries.map((_, e) => key(n, d, e))}
|
||||||
|
off={hidden}
|
||||||
|
onChange={setHidden}
|
||||||
|
enabled={on && !hidden.has(key(n, d))}
|
||||||
|
className="mt-2 pl-7"
|
||||||
|
/>
|
||||||
<ul className="mt-2 space-y-2 pl-7">
|
<ul className="mt-2 space-y-2 pl-7">
|
||||||
{day.entries.map((entry, e) => (
|
{day.entries.map((entry, e) => (
|
||||||
<li key={e}>
|
<li key={e}>
|
||||||
|
|
@ -841,6 +905,14 @@ function Setup({
|
||||||
onToggle={() => setHidden(toggle(hidden, key(n, d, e)))}
|
onToggle={() => setHidden(toggle(hidden, key(n, d, e)))}
|
||||||
/>
|
/>
|
||||||
{entry.kind === 'block' && entry.items?.length ? (
|
{entry.kind === 'block' && entry.items?.length ? (
|
||||||
|
<>
|
||||||
|
<AllNone
|
||||||
|
keys={entry.items.map((_, i) => 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"
|
||||||
|
/>
|
||||||
<ul className="mt-2 space-y-2 pl-7">
|
<ul className="mt-2 space-y-2 pl-7">
|
||||||
{entry.items.map((item, i) => (
|
{entry.items.map((item, i) => (
|
||||||
<li key={i}>
|
<li key={i}>
|
||||||
|
|
@ -853,6 +925,7 @@ function Setup({
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|
@ -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<T>({
|
||||||
|
keys,
|
||||||
|
off,
|
||||||
|
onChange,
|
||||||
|
enabled = true,
|
||||||
|
className = '',
|
||||||
|
}: {
|
||||||
|
keys: T[]
|
||||||
|
off: Set<T>
|
||||||
|
onChange: (next: Set<T>) => 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 (
|
||||||
|
<div className={`flex gap-4 text-xs ${className}`}>
|
||||||
|
<button type="button" disabled={!enabled || keys.every((k) => !off.has(k))} onClick={() => set(true)} className={button}>
|
||||||
|
Select all
|
||||||
|
</button>
|
||||||
|
<button type="button" disabled={!enabled || keys.every((k) => off.has(k))} onClick={() => set(false)} className={button}>
|
||||||
|
Deselect all
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/* One checkbox on the setup screen: a schedule entry (its time and
|
/* One checkbox on the setup screen: a schedule entry (its time and
|
||||||
kind beside it) or a day (`label`, `strong`). */
|
kind beside it) or a day (`label`, `strong`). */
|
||||||
const KIND_NOTE = { block: 'Block', break: 'Break', heading: 'Heading' } as const
|
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 (
|
||||||
|
<div className="flex h-full flex-col text-center">
|
||||||
|
<Scroll center>
|
||||||
|
<SlideTitle color={color}>{slide.title}</SlideTitle>
|
||||||
|
<Rise order={1}>
|
||||||
|
<aside
|
||||||
|
className="mx-auto max-w-[75vw] space-y-[2vh] border-l-[0.5vw] px-[3vw] py-[3vh] text-[clamp(1.3rem,2.8vw,3.4rem)] leading-snug text-body"
|
||||||
|
style={{ borderColor: accent, background: `color-mix(in srgb, ${accent} 10%, var(--color-surface))` }}
|
||||||
|
>
|
||||||
|
<Paragraphs text={block.present?.text || block.text} accent={accent} />
|
||||||
|
</aside>
|
||||||
|
</Rise>
|
||||||
|
</Scroll>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (slide.kind === 'list') {
|
if (slide.kind === 'list') {
|
||||||
const items = slide.items ?? []
|
const items = slide.items ?? []
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue