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:
parent
274ffc26e0
commit
7885d10249
9 changed files with 603 additions and 120 deletions
|
|
@ -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,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue