Add a Schedule content block with day tabs

A schedule block's entries (migration 034) each have a day, time,
title, detail, location, person and link, and fold out for a longer
description, the person's photo and page, a graphic and a Google map
of a place or address. Entries sit in one tab per day, in the order
entered; the tab for today's weekday opens first, and a one-day
schedule draws no tabs.

In the editor, the entry fields show only under a schedule block:
repeater `when` can now look at the parent row (scope "parent"), and
a field's label can depend on the row. The block preview names an
entry's person. The showcase retreat and post each have a schedule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 21:12:47 -05:00
parent d6477b6d30
commit 71a470b66f
10 changed files with 556 additions and 29 deletions

View file

@ -302,12 +302,16 @@ const BLOCK_TYPES = [
["button", "Button", "One filled call-to-action button, eg. Register, Donate."],
["image", "Image", "A picture, with alt text and an optional caption and link."],
["video", "Video", "A YouTube, Vimeo or Facebook video, or a video file, played in place."],
["schedule", "Schedule", "Entries in one tab per day, each folding out for more. The text is an optional intro."],
["divider", "Divider", "A thin line between parts."],
];
/* An item field that only a schedule's entries have. */
const SCHEDULE_ENTRY = { scope: "parent", path: "type", value: "schedule" };
const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type;
const TEXT_TYPES = ["paragraph", "heading", "subheading", "callout", "quote", "button", "image", "video"];
const TEXT_TYPES = ["paragraph", "heading", "subheading", "callout", "quote", "button", "image", "video", "schedule"];
const TEXT_HELP = {
paragraph: FORMATTING_HELP,
@ -316,9 +320,10 @@ const TEXT_HELP = {
button: "The button's label, eg. Register now",
image: "Caption shown under the image. Optional.",
video: "Caption shown under the video. Optional.",
schedule: "Optional intro above the tabs. " + FORMATTING_HELP,
};
const TEXT_LABEL = { button: "Label", image: "Caption", video: "Caption" };
const TEXT_LABEL = { button: "Label", image: "Caption", video: "Caption", schedule: "Intro" };
const HREF_HELP = {
paragraph: "Optional. Makes the whole paragraph one link. For a link inside the text, use [text](url).",
@ -357,7 +362,7 @@ const blocksChild = {
},
{
path: "text",
label: "Text",
label: (row) => TEXT_LABEL[row?.type] ?? "Text",
widget: "textarea",
full: true,
when: { path: "type", value: TEXT_TYPES },
@ -400,13 +405,59 @@ const blocksChild = {
key: "items",
label: "Items",
addLabel: "Add item",
when: { path: "type", value: ["list", "links"] },
title: (row) => row.text || "New item",
when: { path: "type", value: ["list", "links", "schedule"] },
title: (row) => [row.day, row.time, row.text].filter(Boolean).join(" · ") || "New item",
blank: { text: "" },
fields: [
{ path: "text", label: "Text", required: true },
{ path: "detail", label: "Detail", help: "Lists only: shown after the text" },
{ path: "url", label: "URL", help: "Blank for a plain list item. Link buttons need one." },
{
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 },
{ path: "text", label: "Text", required: true, help: "Schedules: the entry's title" },
{
path: "location",
label: "Location",
help: "eg. Main Hall",
when: SCHEDULE_ENTRY,
},
{
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",
when: SCHEDULE_ENTRY,
},
{ path: "detail", label: "Detail", help: "A line under the text. Lists: shown after the text" },
{ path: "url", label: "URL", help: "Blank for plain text. Link buttons need one." },
{
path: "description",
label: "More",
widget: "textarea",
full: true,
help: "Shown when the entry is folded out. " + FORMATTING_HELP,
when: SCHEDULE_ENTRY,
},
{
path: "media",
label: "Graphic",
widget: "image",
resolve: blockMedia,
full: true,
help: "Optional, in the fold-out: a map of the site, a slide, a poster",
when: SCHEDULE_ENTRY,
},
{
path: "map",
label: "Map",
full: true,
help: "Optional, in the fold-out: a place or address for a Google map, eg. Camp Hebron, Halifax PA",
when: SCHEDULE_ENTRY,
},
],
},
],

View file

@ -34,6 +34,7 @@ export type ContentBlock = {
| 'video'
| 'button'
| 'callout'
| 'schedule'
text?: string | null
media?: string | null
href?: string | null
@ -41,7 +42,22 @@ export type ContentBlock = {
alt?: string | null
/** Who a quote is by. */
cite?: string | null
items?: Array<{ text: string; detail?: string | null; url?: string | null }>
items?: ContentBlockItem[]
}
/** A list, link-row or schedule entry. The schedule fields are
* empty on the other two (034_schedule_block.sql). */
export type ContentBlockItem = {
text: string
detail?: string | null
url?: string | null
day?: string | null
time?: string | null
location?: string | null
description?: string | null
media?: string | null
map?: string | null
person?: { id: string; name: string; photo?: string | null; tagline?: string | null } | null
}
export type Link = {