Schedule: entry types, picked times, striped rows, blocks in the presentation

Entries get a type (normal, block, break, heading) and a Featured tick.
Times are picked (start, optional end) and shown as 7:00pm or 9:00 to
10:30am; the typed time stays as the override, so existing entries look
the same. A block holds sub-items (content_block_subitems, migration 086),
each with every entry field. Rows alternate a faint tint. The presentation
gets a Blocks slide (its own seconds) before each sub-item's spotlight,
and sub-items get their own checkboxes on the setup page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-11-02 23:15:53 -06:00
parent 274ffc26e0
commit 7885d10249
9 changed files with 603 additions and 120 deletions

View file

@ -182,6 +182,7 @@ also in `server/src/admin-schema/` and a CHECK):
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema/shared.ts`). |
| Content blocks → Schedule items → Type | (blank: normal entry), block, break, heading | **yes**, migration 086 | `SCHEDULE_KINDS` in `src/lib/adminSchema/shared.ts`; drawn by `ScheduleBlock.tsx` and `SchedulePresent.tsx` (which slides each kind gets). A block's sub-items are `content_block_subitems`. |
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |

View file

@ -191,6 +191,37 @@ export const blocksChild = (ownerKind) => ({
text("media_alt"),
text("map"),
text("map_image"),
// Its kind, picked times and Featured tick (086).
enumeration("kind", ["block", "break", "heading"]),
time("start_time"),
time("end_time"),
bool("featured"),
],
children: [
{
// A block entry's sub-items (086).
key: "items",
table: "content_block_subitems",
owner: { column: "item_id" },
order: "sort_order",
when: { column: "kind", value: "block" },
columns: [
text("text", { required: true }),
text("detail"),
url("url"),
time("start_time"),
time("end_time"),
text("time"),
text("location"),
text("person_id"),
text("description"),
text("media"),
text("media_alt"),
text("map"),
text("map_image"),
bool("featured"),
],
},
],
},
],

View file

@ -0,0 +1,47 @@
-- ═══════════════════════════════════════════════════════════════
-- 086 SCHEDULE ENTRY TYPES
--
-- A schedule entry gets a kind:
-- null a normal entry
-- block a time frame holding several things, its sub-items
-- (content_block_subitems below), each with its own time
-- break a meal or free time: a quieter row, no spotlight slide
-- heading a label across the day, eg. Evening sessions
-- and `featured`, which makes the row stand out.
--
-- Times are picked (start_time, end_time, HH:MM 24-hour) and shown
-- as 7:00pm or 9:00 to 10:30am (shape.js). The old typed `time`
-- stays as the override: when it's filled it shows instead, so the
-- entries typed before this look the same.
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE content_block_items ADD COLUMN kind TEXT
CHECK (kind IN ('block', 'break', 'heading'));
ALTER TABLE content_block_items ADD COLUMN start_time TEXT;
ALTER TABLE content_block_items ADD COLUMN end_time TEXT;
ALTER TABLE content_block_items ADD COLUMN featured INTEGER NOT NULL DEFAULT 0
CHECK (featured IN (0, 1));
-- A block entry's sub-items: every field an entry has but day and
-- kind (they're under their block's day, and don't nest further).
CREATE TABLE content_block_subitems (
id INTEGER PRIMARY KEY AUTOINCREMENT,
item_id INTEGER NOT NULL REFERENCES content_block_items (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
text TEXT NOT NULL,
detail TEXT,
url TEXT,
start_time TEXT,
end_time TEXT,
time TEXT, -- the override, as on an entry
location TEXT,
person_id TEXT REFERENCES people (id) ON DELETE SET NULL,
description TEXT,
media TEXT,
media_alt TEXT,
map TEXT,
map_image TEXT,
featured INTEGER NOT NULL DEFAULT 0 CHECK (featured IN (0, 1))
) STRICT;
CREATE INDEX content_block_subitems_item_idx
ON content_block_subitems (item_id, sort_order);

View file

@ -82,18 +82,25 @@ const PAST = "showcase-past-event";
/* ── Content ───────────────────────────────────────────────── */
/* A schedule over three days, using every entry field: a plain
entry, one with a location and person, one folding out with a
description, graphic and map, one linked, and one with no day
(it lands in a tab of its own). */
/* A schedule over three days, using every entry field and kind: a
plain entry, one with a location and person, one folding out with
a description, graphic and map, one linked, a heading, a featured
entry, a block with sub-items, a break, typed and picked times,
and one with no day (it lands in a tab of its own). */
const SCHEDULE = [
"schedule",
{ text: "The weekend at a glance. Tap an entry for more." },
[
{ day: "Friday", time: "4:00pm", text: "Arrivals and check-in", location: "Front desk" },
{ day: "Friday", start_time: "16:00", text: "Arrivals and check-in", location: "Front desk" },
{ day: "Friday", kind: "heading", text: "Evening", detail: "A heading across the day" },
{ day: "Friday", time: "7:00 to 8:30pm", text: "Opening session", location: "Main Hall", person_id: "showcase-person", detail: "Welcome and worship", description: "The **opening session** sets the theme for the weekend.\n\nBring a notebook.", media: "/uploads/showcase.jpg", map: "Camp Hebron, Halifax PA", map_image: "/uploads/showcase.jpg" },
{ day: "Saturday", time: "9:00am", text: "Workshops", location: "Classrooms", person_id: "showcase-member-2", detail: "Pick one of three", url: "/blog/content-block-showcase" },
{ day: "Saturday", time: "7:00pm", text: "Talent night", location: "Main Hall", person_id: "showcase-member-3", description: "Sign up at the front desk by noon." },
{ day: "Saturday", start_time: "08:00", end_time: "09:00", kind: "break", text: "Breakfast", location: "Dining hall" },
{ day: "Saturday", start_time: "09:00", end_time: "10:30", kind: "block", text: "Workshops", location: "Classrooms", detail: "Pick one of three", items: [
{ start_time: "09:00", end_time: "09:45", text: "Leading worship", location: "Room A", person_id: "showcase-member-2", url: "/blog/content-block-showcase" },
{ start_time: "09:00", end_time: "09:45", text: "Speaking with confidence", location: "Room B", featured: 1, description: "A featured sub-item that folds out." },
{ time: "After the first round", text: "Open questions", location: "Room C" },
] },
{ day: "Saturday", start_time: "19:00", featured: 1, text: "Talent night", location: "Main Hall", person_id: "showcase-member-3", description: "Sign up at the front desk by noon." },
{ day: "Sunday", time: "10:00am", text: "Closing service", location: "Chapel", map: "Main Street, Halifax PA" },
{ time: "Any time", text: "Quiet room open", location: "Library", detail: "An entry with no day" },
],
@ -210,7 +217,10 @@ function blocks(ownerKind, ownerId, slot, list) {
type,
...f,
});
items.forEach((item, i) => insert("content_block_items", { block_id: lastInsertRowid, sort_order: i, ...item }));
items.forEach(({ items: subitems = [], ...item }, i) => {
const entry = insert("content_block_items", { block_id: lastInsertRowid, sort_order: i, ...item });
subitems.forEach((sub, j) => insert("content_block_subitems", { item_id: entry.lastInsertRowid, sort_order: j, ...sub }));
});
});
}

View file

@ -107,12 +107,14 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
const blockIds = [...byId.keys()];
const ENTRY_FIELDS = `i.text, i.detail, i.url, i.start_time, i.end_time, i.time, i.location,
i.description, i.media, i.media_alt, i.map, i.map_image, i.featured,
p.id AS person_id, p.display_name AS person_name,
p.photo AS person_photo, p.tagline AS person_tagline`;
const itemRows = db
.prepare(
`SELECT i.block_id, i.text, i.detail, i.url,
i.day, i.time, i.location, i.description, i.media, i.media_alt, i.map, i.map_image,
p.id AS person_id, p.display_name AS person_name,
p.photo AS person_photo, p.tagline AS person_tagline
`SELECT i.id, i.block_id, i.day, i.kind, ${ENTRY_FIELDS}
FROM content_block_items i
LEFT JOIN v_people_public p ON p.id = i.person_id AND p.is_published = 1
WHERE i.block_id IN (${placeholders(blockIds.length)})
@ -122,20 +124,49 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
// The schedule fields are null on a list or link-row item; they
// ride along anyway rather than branching on the block's type.
// An unpublished person comes back as no person.
const itemsById = new Map();
for (const row of itemRows) {
byId.get(row.block_id)?.items.push({
const item = { ...scheduleEntry(row), day: row.day, kind: row.kind ?? "entry", items: [] };
itemsById.set(row.id, item);
byId.get(row.block_id)?.items.push(item);
}
// A block entry's sub-items (086).
const blockEntryIds = itemRows.filter((row) => row.kind === "block").map((row) => row.id);
if (blockEntryIds.length) {
const subRows = db
.prepare(
`SELECT i.item_id, ${ENTRY_FIELDS}
FROM content_block_subitems i
LEFT JOIN v_people_public p ON p.id = i.person_id AND p.is_published = 1
WHERE i.item_id IN (${placeholders(blockEntryIds.length)})
ORDER BY i.item_id, i.sort_order`,
)
.all(...blockEntryIds);
for (const row of subRows) itemsById.get(row.item_id)?.items.push(scheduleEntry(row));
}
return out;
}
/* A schedule entry or sub-item as the page gets it. `time` is what
to show: the typed override, else the picked times (086). An
unpublished person comes back as no person. */
function scheduleEntry(row) {
return {
text: row.text,
detail: row.detail,
url: row.url,
day: row.day,
time: row.time,
time: row.time || clockRange(row.start_time, row.end_time),
start_time: row.start_time,
end_time: row.end_time,
location: row.location,
description: row.description,
media: row.media,
media_alt: row.media_alt,
map: row.map,
map_image: row.map_image,
featured: row.featured === 1,
person: row.person_id
? {
id: row.person_id,
@ -144,10 +175,21 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
tagline: row.person_tagline,
}
: null,
});
};
}
return out;
/* "19:00" → 7:00pm, and a range as 9:00 to 10:30am, or 11:30am to
1:00pm when it crosses noon. */
export function clockRange(start, end) {
if (!start) return null;
const clock = (hhmm) => {
const [h, m] = hhmm.split(":").map(Number);
return { text: `${h % 12 || 12}:${String(m).padStart(2, "0")}`, half: h < 12 ? "am" : "pm" };
};
const from = clock(start);
if (!end) return from.text + from.half;
const to = clock(end);
return `${from.text}${from.half === to.half ? "" : from.half} to ${to.text}${to.half}`;
}
/* ── Card description ──────────────────────────────────────────

View file

@ -18,6 +18,14 @@
the place typed in, with a link out to the full map; an entry's
own map image (069) shows instead, the link out kept.
An entry's kind (086): a normal entry; a block, its sub-items
listed under it, each a row of its own with its own fold-out; a
break (a meal, free time), a quieter row with no fold-out; or a
heading across the day. A featured entry stands out in the
accent, with a star. Rows alternate a faint tint, for reading
across. The time shown is `time`, which the API has already made
from the picked times or the typed override.
On an event page a Present button opens the schedule as a
slideshow for a screen (SchedulePresent.tsx).
@ -28,7 +36,7 @@
it, no map frame (ReadingSchedule).
═══════════════════════════════════════════════════════════════ */
import { CaretDown, Presentation } from '@phosphor-icons/react'
import { CaretDown, Presentation, Star } from '@phosphor-icons/react'
import { Fragment, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
import { Link } from 'react-router-dom'
@ -93,7 +101,24 @@ export function Avatar({ person, size }: { person: NonNullable<ContentBlockItem[
)
}
function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
/* A featured entry's star, read as a word by a screen reader. */
export function FeaturedStar({ className = 'h-4 w-4' }: { className?: string }) {
return (
<>
<Star aria-hidden="true" weight="fill" className={`inline shrink-0 ${className}`} />
<span className="sr-only">Featured: </span>
</>
)
}
/* A featured row's look: a faint wash of the accent and a bar down
its left edge. */
export const featuredStyle = (accent: string) => ({
background: withAlpha(accent, 10),
boxShadow: `inset 4px 0 0 ${accent}`,
})
function Entry({ entry, accent, sub = false }: { entry: ContentBlockItem; accent: string; sub?: boolean }) {
const [open, setOpen] = useState(false)
// Google's map loads only when asked for (Privacy page).
const [showMap, setShowMap] = useState(false)
@ -101,7 +126,23 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
const graphic = mediaUrl(entry.media)
const place = entry.map?.trim()
const mapImage = mediaUrl(entry.map_image)
const more = Boolean(entry.description || graphic || place || mapImage || entry.person)
const quiet = entry.kind === 'break'
const more = !quiet && Boolean(entry.description || graphic || place || mapImage || entry.person)
if (entry.kind === 'heading') {
return (
<li className="border-b border-brand/10 px-5 pt-6 pb-2 last:border-b-0">
<p className="text-sm font-bold uppercase tracking-wide" style={{ color: accentText(accent) }}>
{entry.text}
</p>
{entry.detail && (
<p className="mt-1 text-sm" style={{ color: BODY }}>
{entry.detail}
</p>
)}
</li>
)
}
const title = entry.url ? (
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accentText(accent) }}>
@ -112,16 +153,33 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
)
return (
<li className="border-b border-brand/10 last:border-b-0">
<li
className={sub ? 'pl-4' : 'border-b border-brand/10 px-5 last:border-b-0 even:bg-tint-soft/60'}
style={entry.featured ? featuredStyle(accent) : undefined}
>
{/* On a phone the time sits on its own line above the entry,
leaving the title the full width. */}
<div className="flex flex-wrap gap-x-4 gap-y-1 py-4 sm:flex-nowrap sm:gap-6">
<p className="w-full shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
<div
className={`flex flex-wrap gap-x-4 gap-y-1 sm:flex-nowrap ${quiet || sub ? 'py-2.5' : 'py-4'} ${
sub ? 'sm:gap-4' : 'sm:gap-6'
}`}
>
<p
className={`w-full shrink-0 pt-0.5 text-sm font-semibold ${sub ? 'sm:w-28' : 'sm:w-32'}`}
style={{ color: quiet ? BODY : accentText(accent) }}
>
{entry.time}
</p>
<div className="min-w-0 flex-1">
<p className="font-semibold text-body">{title}</p>
<p className={quiet ? 'text-muted' : 'font-semibold text-body'}>
{entry.featured && (
<span className="mr-1.5" style={{ color: accentText(accent) }}>
<FeaturedStar className="h-4 w-4 -translate-y-px" />
</span>
)}
{title}
</p>
{(entry.location || entry.person) && (
<p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm" style={{ color: BODY }}>
{entry.location && <span>{entry.location}</span>}
@ -160,7 +218,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
</div>
{more && open && (
<div id={panelId} className="mb-5 space-y-5 bg-tint-soft p-5 sm:ml-38">
<div id={panelId} className={`mb-5 space-y-5 bg-tint-soft p-5 ${sub ? 'sm:ml-32' : 'sm:ml-38'}`}>
{entry.person && (
<div className="flex items-center gap-4">
<Avatar person={entry.person} size="h-16 w-16" />
@ -228,21 +286,31 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
)}
</div>
)}
{/* A block's sub-items, under its title. */}
{entry.kind === 'block' && entry.items?.length ? (
<ul className="mb-4 sm:ml-38" style={{ borderLeft: `2px solid ${withAlpha(accent, 33)}` }}>
{entry.items.map((item, index) => (
<Entry key={index} entry={item} accent={accent} sub />
))}
</ul>
) : null}
</li>
)
}
/* Reading mode: every day, every entry and its fold-out, as text. A
day is an h4, under the page's h3 block headings (ContentBlocks). */
function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string | null; accent: string }) {
/* One entry in reading mode, a block's sub-items in a list under it. */
function readingEntry(entry: ContentBlockItem, accent: string, key: number): ReactNode {
if (entry.kind === 'heading') {
return (
<div>
{intro && <Paragraphs text={intro} accent={accent} />}
{days.map((day, index) => (
<div key={day.name || index}>
{days.length > 1 && <h4>{day.name || 'Schedule'}</h4>}
<ul>
{day.entries.map((entry, i) => {
<li key={key}>
<p>
<strong>{entry.text}</strong>
</p>
{entry.detail && <p>{entry.detail}</p>}
</li>
)
}
const graphic = mediaUrl(entry.media)
const place = entry.map?.trim()
const mapImage = mediaUrl(entry.map_image)
@ -253,8 +321,9 @@ function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string
entry.person && <Link to={personHref(entry.person.id)}>{entry.person.name}</Link>,
].filter(Boolean)
return (
<li key={i}>
<li key={key}>
<p>
{entry.featured && 'Featured: '}
{parts.map((part, j) => (
<Fragment key={j}>
{j > 0 && ' · '}
@ -272,10 +341,23 @@ function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string
<a href={mapLink(place)}>Open {place} in Google Maps</a>
</p>
)}
{entry.kind === 'block' && entry.items?.length ? (
<ul>{entry.items.map((item, i) => readingEntry(item, accent, i))}</ul>
) : null}
</li>
)
})}
</ul>
}
/* Reading mode: every day, every entry and its fold-out, as text. A
day is an h4, under the page's h3 block headings (ContentBlocks). */
function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string | null; accent: string }) {
return (
<div>
{intro && <Paragraphs text={intro} accent={accent} />}
{days.map((day, index) => (
<div key={day.name || index}>
{days.length > 1 && <h4>{day.name || 'Schedule'}</h4>}
<ul>{day.entries.map((entry, i) => readingEntry(entry, accent, i))}</ul>
</div>
))}
</div>
@ -374,7 +456,7 @@ export default function ScheduleBlock({
id={`${baseId}-panel`}
role={days.length > 1 ? 'tabpanel' : undefined}
aria-labelledby={days.length > 1 ? `${baseId}-tab-${days.indexOf(current)}` : undefined}
className="border border-brand/15 bg-surface px-5"
className="border border-brand/15 bg-surface"
>
{current.entries.map((entry, index) => (
<Entry key={`${current.name}-${index}`} entry={entry} accent={accent} />

View file

@ -314,6 +314,23 @@ export const BLOCK_TYPES = [
/* An item field that only a schedule's entries have. */
export const SCHEDULE_ENTRY = { scope: "parent", path: "type", value: "schedule" };
/* A schedule entry's kinds (086); blank is a normal entry. */
export const SCHEDULE_KINDS = [
["block", "Block, with sub-items"],
["break", "Break or meal"],
["heading", "Heading"],
];
/* Picked times and the typed override, on an entry and a sub-item. */
const scheduleTimeFields = (when?: any) => [
{ path: "start_time", label: "Starts", widget: "time", when },
{ path: "end_time", label: "Ends", widget: "time", help: "Optional", when },
{
path: "time",
label: "Display as",
help: "Default: the times picked, eg. 7:00pm or 9:00 to 10:30am. Type here to show something else, eg. After dinner.",
when,
},
];
/* Item fields for a link card, and for every other kind of item. */
export const CARD_ITEM = { scope: "parent", path: "type", value: "cards" };
export const NOT_CARD_ITEM = { scope: "parent", path: "type", value: ["list", "links", "schedule"] };
@ -385,6 +402,43 @@ export const wordFields = (prefix: string, label: string, when?: any) => [
{ path: `${prefix}word_seconds`, label: label ? `${label}seconds per word` : "Seconds per word", widget: "number", help: "1 to 20. Default: the site's", when },
];
/* A block entry's sub-item (086): an entry's fields, under its
block's day. */
const SUB_ITEM_FIELDS = [
...scheduleTimeFields(),
{ path: "text", label: "Title", required: true },
{ path: "location", label: "Location", help: "eg. Room B" },
{
path: "person_id",
label: "Person",
widget: "select",
optionsFrom: "people",
blankLabel: "Default: none",
help: "Who hosts or speaks: shown with their photo, linked to their page",
},
{ path: "detail", label: "Detail", help: "A line under the title" },
{ path: "url", label: "URL", help: "Optional: makes the title a link", files: true },
{ path: "description", label: "More", widget: "textarea", full: true, help: "Shown when it's folded out. " + FORMATTING_HELP },
{ path: "media", label: "Graphic", widget: "image", crop: "free", resolve: mediaUrl, full: true, help: "Optional, in the fold-out" },
{
path: "media_alt",
label: "Graphic description",
full: true,
help: "For screen readers: what the graphic shows. Default: skipped as decoration.",
},
{ path: "map", label: "Map", full: true, help: "Optional: a place or address for a Google map" },
{
path: "map_image",
label: "Map image",
widget: "image",
crop: "free",
resolve: mediaUrl,
full: true,
help: "Optional: your own map, shown in place of the Google map and as a slide when presented",
},
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes it stand out" },
];
export const blocksChild = {
key: "content_blocks",
label: "Content blocks",
@ -488,16 +542,25 @@ export const blocksChild = {
label: "Items",
addLabel: "Add item",
when: { path: "type", value: ["list", "links", "schedule", "cards", "people"] },
title: (row) => [row.day, row.time, row.text].filter(Boolean).join(" · ") || "New item",
title: (row) => [row.day, row.time || row.start_time, row.text].filter(Boolean).join(" · ") || "New item",
blank: { text: "" },
fields: [
{
path: "kind",
label: "Type",
widget: "select",
options: SCHEDULE_KINDS,
blankLabel: "Default: Normal entry",
help: "A block holds several things in one time frame, each a sub-item with its own time. A break is a quieter row (a meal, free time). A heading labels part of the day, eg. Evening sessions.",
when: SCHEDULE_ENTRY,
},
{
path: "day",
label: "Day",
help: "The tab it's under, eg. Friday. Entries with the same day share a tab, in this order.",
when: SCHEDULE_ENTRY,
},
{ path: "time", label: "Time", help: "eg. 7:00pm, or 9:00 to 10:30am", when: SCHEDULE_ENTRY },
...scheduleTimeFields(SCHEDULE_ENTRY),
// A card: the link first, so Fetch preview can fill the rest.
{
path: "url",
@ -589,6 +652,18 @@ export const blocksChild = {
help: "Optional: your own map, eg. the camp with the room marked. Shown in the fold-out in place of the Google map (which stays a link), and as a slide when the schedule is presented.",
when: SCHEDULE_ENTRY,
},
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes the row stand out", when: SCHEDULE_ENTRY },
],
children: [
{
key: "items",
label: "Sub-items",
addLabel: "Add sub-item",
when: { path: "kind", value: "block" },
title: (row) => [row.time || row.start_time, row.text].filter(Boolean).join(" · ") || "New sub-item",
blank: { text: "" },
fields: SUB_ITEM_FIELDS,
},
],
},
],

View file

@ -74,6 +74,14 @@ export type ContentBlockItem = {
/** The entry's own map picture (069), shown in place of Google's. */
map_image?: string | null
person?: { id: string; name: string; photo?: string | null; tagline?: string | null } | null
/** A schedule entry's kind (086); sub-items have none. */
kind?: 'entry' | 'block' | 'break' | 'heading'
/** Picked times, HH:MM; `time` is already what to show. */
start_time?: string | null
end_time?: string | null
featured?: boolean
/** A block entry's sub-items. */
items?: ContentBlockItem[]
}
export type Link = {

View file

@ -13,8 +13,13 @@
The slides, for each day picked, in order:
overview the day's picked entries on one slide
spotlight one entry: its person beside title, time and place
block a block entry (086) and its sub-items on one slide,
in place of its spotlight; then each sub-item gets
the spotlight, graphic and map slides an entry does
graphic an entry's graphic, full screen
map an entry's own map image (069), full screen
A heading (086) is only a line on the overview; a break gets no
spotlight.
Keys while playing: arrows step, Space pauses, Escape leaves full
screen (the browser's), S goes back to the setup.
@ -25,11 +30,11 @@ import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { useParams, useSearchParams } from 'react-router-dom'
import PageState from '../components/PageState.tsx'
import { Avatar, groupByDay, mapAlt, type Day } from '../components/ScheduleBlock.tsx'
import { Avatar, FeaturedStar, featuredStyle, groupByDay, mapAlt, type Day } from '../components/ScheduleBlock.tsx'
import { Paragraphs } from '../components/InlineText.tsx'
import { useEvent, type ContentBlockItem } from '../lib/useContent.ts'
import { mediaUrl } from '../lib/media.ts'
import { BRAND, accentText, readableOn } from '../lib/color.ts'
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
import { documentTitle } from '../lib/site.ts'
import './SchedulePresent.css'
@ -37,6 +42,7 @@ import './SchedulePresent.css'
const KINDS = [
{ key: 'overview', label: 'Day overview', help: 'The whole day on one slide', seconds: 20 },
{ key: 'spotlight', label: 'Entry spotlight', help: 'One entry at a time, with its person', seconds: 12 },
{ key: 'block', label: 'Blocks', help: 'A block and the things in it, before each gets a spotlight', seconds: 15 },
{ key: 'graphic', label: 'Graphics', help: "An entry's graphic, full screen", seconds: 10 },
{ key: 'map', label: 'Map images', help: "An entry's own map, full screen", seconds: 10 },
] as const
@ -47,10 +53,15 @@ const ONE_COLUMN = 8
/* How long the controls stay up after the pointer last moved (ms). */
const CONTROLS_FOR = 2500
type Slide = { kind: Kind; seconds: number; day: Day; entry?: ContentBlockItem }
/* `parent` is a sub-item's block. */
type Slide = { kind: Kind; seconds: number; day: Day; entry?: ContentBlockItem; parent?: ContentBlockItem }
/* An entry's key in the address: day index, a dot, entry index. */
const entryKey = (day: number, entry: number) => `${day}.${entry}`
/* An entry's key in the address: day index, a dot, entry index, and
for a sub-item another dot and its index. */
const entryKey = (...at: number[]) => at.join('.')
/* Lines on an overview: entries and sub-items. */
const lineCount = (entries: ContentBlockItem[]) =>
entries.reduce((n, entry) => n + 1 + (entry.kind === 'block' ? (entry.items?.length ?? 0) : 0), 0)
const list = (value: string | null) => (value ? value.split(',').filter(Boolean) : null)
function readSettings(params: URLSearchParams, days: Day[]) {
@ -70,13 +81,32 @@ function buildSlides(days: Day[], { pickedDays, hidden, seconds }: Settings): Sl
const slides: Slide[] = []
days.forEach((all, d) => {
if (!pickedDays.has(d)) return
const day = { ...all, entries: all.entries.filter((_, e) => !hidden.has(entryKey(d, e))) }
if (day.entries.length === 0) return
const entries = all.entries.flatMap((entry, e) => {
if (hidden.has(entryKey(d, e))) return []
if (entry.kind !== 'block') return [entry]
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(entryKey(d, e, i))) }]
})
if (entries.length === 0) return
const day = { ...all, entries }
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, day })
for (const entry of day.entries) {
if (seconds.spotlight) slides.push({ kind: 'spotlight', seconds: seconds.spotlight, day, entry })
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, day, entry })
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, day, entry })
const media = (entry: ContentBlockItem, parent?: ContentBlockItem) => {
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, day, entry, parent })
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, day, entry, parent })
}
for (const entry of entries) {
if (entry.kind === 'heading') continue
if (entry.kind === 'block') {
if (seconds.block) slides.push({ kind: 'block', seconds: seconds.block, day, entry })
media(entry)
for (const item of entry.items ?? []) {
if (seconds.spotlight) slides.push({ kind: 'spotlight', seconds: seconds.spotlight, day, entry: item, parent: entry })
media(item, entry)
}
continue
}
if (seconds.spotlight && entry.kind !== 'break') slides.push({ kind: 'spotlight', seconds: seconds.spotlight, day, entry })
media(entry)
}
})
return slides
@ -243,16 +273,26 @@ function Setup({
<ul className="mt-3 space-y-2 pl-7">
{day.entries.map((entry, e) => (
<li key={e}>
<label className={`flex items-baseline gap-3 ${pickedDays.has(d) ? '' : 'opacity-50'}`}>
<input
type="checkbox"
disabled={!pickedDays.has(d)}
<PickEntry
entry={entry}
enabled={pickedDays.has(d)}
checked={!hidden.has(entryKey(d, e))}
onChange={() => setHidden(toggle(hidden, entryKey(d, e)))}
onToggle={() => setHidden(toggle(hidden, entryKey(d, e)))}
/>
<span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>
<span>{entry.text}</span>
</label>
{entry.kind === 'block' && entry.items?.length ? (
<ul className="mt-2 space-y-2 pl-7">
{entry.items.map((item, i) => (
<li key={i}>
<PickEntry
entry={item}
enabled={pickedDays.has(d) && !hidden.has(entryKey(d, e))}
checked={!hidden.has(entryKey(d, e, i))}
onToggle={() => setHidden(toggle(hidden, entryKey(d, e, i)))}
/>
</li>
))}
</ul>
) : null}
</li>
))}
</ul>
@ -284,6 +324,38 @@ function Setup({
)
}
/* One entry's checkbox on the setup screen, its kind beside it. */
const KIND_NOTE = { block: 'Block', break: 'Break', heading: 'Heading' } as const
function PickEntry({
entry,
enabled,
checked,
onToggle,
}: {
entry: ContentBlockItem
enabled: boolean
checked: boolean
onToggle: () => void
}) {
const note = entry.kind && entry.kind !== 'entry' ? KIND_NOTE[entry.kind] : null
return (
<label className={`flex items-baseline gap-3 ${enabled ? '' : 'opacity-50'}`}>
<input type="checkbox" disabled={!enabled} checked={checked} onChange={onToggle} />
<span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>
<span className={entry.kind === 'heading' ? 'font-semibold' : ''}>
{entry.featured && (
<span className="mr-1 text-link">
<FeaturedStar />
</span>
)}
{entry.text}
</span>
{note && <span className="text-xs text-muted">{note}</span>}
</label>
)
}
/* ── Player ─────────────────────────────────────────────────── */
function Player({
@ -444,28 +516,41 @@ function Rise({ order = 0, from = 'below', className = '', children }: {
)
}
function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
/* One line of the day overview: an entry, or (`sub`) one of a
block's sub-items under it. A heading is a label; a break is
quieter. */
function OverviewLine({ entry, accent, sub = false }: { entry: ContentBlockItem; accent: string; sub?: boolean }) {
const color = accentText(accent)
if (slide.kind === 'overview') {
const entries = slide.day.entries
const two = entries.length > ONE_COLUMN
if (entry.kind === 'heading') {
return (
<div className="flex h-full flex-col">
<Rise>
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color }}>
{slide.day.name || 'Schedule'}
</h1>
</Rise>
<ul className={`grid min-h-0 flex-1 content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
{entries.map((entry, i) => (
<li key={i}>
<Rise order={i + 1} from="left" className="flex items-baseline gap-[2vw] border-b border-brand/15 py-[1.2vh]">
<span className="w-[12vw] shrink-0 text-[clamp(1rem,1.8vw,2.4rem)] font-semibold" style={{ color }}>
<p
className="px-[1vw] pt-[2vh] pb-[0.6vh] text-[clamp(0.9rem,1.5vw,2rem)] font-bold uppercase tracking-wide"
style={{ color }}
>
{entry.text}
</p>
)
}
const quiet = entry.kind === 'break'
return (
<div className={`flex items-baseline gap-[2vw] px-[1vw] ${sub ? 'py-[0.6vh]' : 'border-b border-brand/15 py-[1.2vh]'}`}>
<span
className={`shrink-0 font-semibold ${sub ? 'w-[10vw] text-[clamp(0.9rem,1.4vw,1.9rem)]' : 'w-[12vw] text-[clamp(1rem,1.8vw,2.4rem)]'}`}
style={{ color: quiet ? undefined : color }}
>
{entry.time}
</span>
<span className="min-w-0 flex-1">
<span className="block text-[clamp(1.2rem,2.4vw,3rem)] font-bold leading-tight text-ink">
<span
className={`block leading-tight ${
quiet ? 'font-semibold text-muted' : 'font-bold text-ink'
} ${sub ? 'text-[clamp(1rem,1.9vw,2.4rem)]' : 'text-[clamp(1.2rem,2.4vw,3rem)]'}`}
>
{entry.featured && (
<span className="mr-[0.6vw]" style={{ color }}>
<FeaturedStar className="h-[0.8em] w-[0.8em]" />
</span>
)}
{entry.text}
</span>
{(entry.location || entry.person) && (
@ -475,6 +560,37 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
</span>
)}
</span>
</div>
)
}
function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
const color = accentText(accent)
if (slide.kind === 'overview') {
const entries = slide.day.entries
const two = lineCount(entries) > ONE_COLUMN
return (
<div className="flex h-full flex-col">
<Rise>
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color }}>
{slide.day.name || 'Schedule'}
</h1>
</Rise>
<ul className={`grid min-h-0 flex-1 content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
{entries.map((entry, i) => (
<li key={i} className="even:bg-tint-soft/60" style={entry.featured ? featuredStyle(accent) : undefined}>
<Rise order={i + 1} from="left">
<OverviewLine entry={entry} accent={accent} />
{entry.kind === 'block' && entry.items?.length ? (
<ul className="ml-[14vw] pb-[1vh]">
{entry.items.map((item, j) => (
<li key={j} style={item.featured ? featuredStyle(accent) : undefined}>
<OverviewLine entry={item} accent={accent} sub />
</li>
))}
</ul>
) : null}
</Rise>
</li>
))}
@ -485,6 +601,70 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
const entry = slide.entry!
if (slide.kind === 'block') {
const items = entry.items ?? []
return (
<div className="flex h-full flex-col">
<Rise>
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
{[slide.day.name, entry.time].filter(Boolean).join(' · ')}
</p>
</Rise>
<Rise order={1}>
<h1 className="mt-[1vh] text-[clamp(2.4rem,5vw,6.5rem)] font-bold leading-[1.05] text-ink">
{entry.featured && (
<span className="mr-[1vw]" style={{ color }}>
<FeaturedStar className="h-[0.8em] w-[0.8em]" />
</span>
)}
{entry.text}
</h1>
</Rise>
{(entry.location || entry.person || entry.detail) && (
<Rise order={2}>
<p className="mt-[1vh] flex flex-wrap gap-x-[2vw] text-[clamp(1.1rem,2vw,2.6rem)] text-muted">
{[entry.location, entry.person?.name, entry.detail].filter(Boolean).map((part, i) => (
<span key={i}>{part}</span>
))}
</p>
</Rise>
)}
<ul className="mt-[4vh] min-h-0 flex-1" style={{ borderLeft: `0.4vw solid ${withAlpha(accent, 40)}` }}>
{items.map((item, i) => (
<li key={i} className="even:bg-tint-soft/60" style={item.featured ? featuredStyle(accent) : undefined}>
<Rise order={i + 3} from="left" className="flex items-center gap-[2vw] px-[2vw] py-[1.6vh]">
<span className="w-[14vw] shrink-0 text-[clamp(1rem,2vw,2.6rem)] font-semibold" style={{ color }}>
{item.time}
</span>
<span className="min-w-0 flex-1">
<span className="block text-[clamp(1.3rem,2.8vw,3.6rem)] font-bold leading-tight text-ink">
{item.featured && (
<span className="mr-[0.6vw]" style={{ color }}>
<FeaturedStar className="h-[0.8em] w-[0.8em]" />
</span>
)}
{item.text}
</span>
{(item.location || item.detail) && (
<span className="mt-1 block text-[clamp(0.9rem,1.6vw,2rem)] text-muted">
{[item.location, item.detail].filter(Boolean).join(' · ')}
</span>
)}
</span>
{item.person && (
<span className="flex shrink-0 items-center gap-[1vw] text-[clamp(0.9rem,1.6vw,2rem)] text-body">
<Avatar person={item.person} size="h-[5vw] w-[5vw] text-[1.4vw]" />
{item.person.name}
</span>
)}
</Rise>
</li>
))}
</ul>
</div>
)
}
if (slide.kind === 'graphic' || slide.kind === 'map') {
const src = mediaUrl(slide.kind === 'map' ? entry.map_image : entry.media)
const alt = slide.kind === 'map' ? mapAlt(entry) : (entry.media_alt ?? '')
@ -521,11 +701,18 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
<div className="min-w-0 flex-1">
<Rise from="right">
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
{[slide.day.name, entry.time].filter(Boolean).join(' · ')}
{[slide.day.name, slide.parent?.text, entry.time].filter(Boolean).join(' · ')}
</p>
</Rise>
<Rise order={1} from="right">
<h1 className="mt-[1vh] text-[clamp(2.4rem,5.5vw,7rem)] font-bold leading-[1.05] text-ink">{entry.text}</h1>
<h1 className="mt-[1vh] text-[clamp(2.4rem,5.5vw,7rem)] font-bold leading-[1.05] text-ink">
{entry.featured && (
<span className="mr-[1vw]" style={{ color }}>
<FeaturedStar className="h-[0.8em] w-[0.8em]" />
</span>
)}
{entry.text}
</h1>
</Rise>
{entry.location && (
<Rise order={2} from="right">