diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md
index f96f5b6..5f1ae6e 100644
--- a/docs/updating-data-in-code.md
+++ b/docs/updating-data-in-code.md
@@ -175,7 +175,7 @@ also in `admin-schema.js` and a CHECK):
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | `splitLinks` in `server/src/shape.js` |
| 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 | **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.ts`). |
+| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule | **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.ts`). |
| 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 |
diff --git a/server/src/admin-schema.js b/server/src/admin-schema.js
index e8a5ac1..edc53a8 100644
--- a/server/src/admin-schema.js
+++ b/server/src/admin-schema.js
@@ -179,6 +179,7 @@ const blocksChild = (ownerKind) => ({
"video",
"button",
"callout",
+ "schedule",
],
{ required: true },
),
@@ -198,6 +199,14 @@ const blocksChild = (ownerKind) => ({
text("text", { required: true }),
text("detail"),
text("url"),
+ // Schedule entries only (034_schedule_block.sql).
+ text("day"),
+ text("time"),
+ text("location"),
+ text("person_id"),
+ text("description"),
+ text("media"),
+ text("map"),
],
},
],
diff --git a/server/src/migrations/034_schedule_block.sql b/server/src/migrations/034_schedule_block.sql
new file mode 100644
index 0000000..0655c1a
--- /dev/null
+++ b/server/src/migrations/034_schedule_block.sql
@@ -0,0 +1,99 @@
+-- ═══════════════════════════════════════════════════════════════
+-- 034 CONTENT BLOCKS: SCHEDULE
+--
+-- A 'schedule' block: the block's items are its entries, grouped
+-- into one tab per day. Each entry says when, what and where, and
+-- folds out for more. The block's own text is an optional intro.
+--
+-- content_block_items gains the entry's fields. A list or link-row
+-- block leaves them empty:
+--
+-- day the tab it sits under, eg. 'Friday'. Tabs follow
+-- the order entries are in; blank means one untitled
+-- day, and a schedule of one day draws no tabs
+-- time '7:00pm', '9:00 to 10:30am': shown as typed
+-- location where it happens, eg. 'Main Hall'
+-- person_id who hosts or speaks: a people row, drawn with its
+-- photo and linked to its page. ON DELETE SET NULL,
+-- and an unpublished person isn't shown
+-- description the fold-out text, formatted like a paragraph
+-- media a graphic in the fold-out: '/uploads/…' or a URL
+-- map a place or address to show on a Google map in the
+-- fold-out, eg. 'Camp Hebron, Halifax PA'
+--
+-- text is the entry's title, detail a line under it, url a link on
+-- the title, as for list items.
+--
+-- The type list is a CHECK, so content_blocks is rebuilt the way
+-- 031 and 032 did it (legacy_alter_table around the rename, then
+-- the index and the owner trigger again). The item columns are
+-- plain ADD COLUMNs.
+--
+-- PRAGMA user_version; -- reads 33 before this file
+-- ═══════════════════════════════════════════════════════════════
+
+CREATE TABLE content_blocks_new (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ owner_kind TEXT NOT NULL
+ CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post')),
+ owner_id TEXT NOT NULL,
+ slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body')),
+ sort_order INTEGER NOT NULL DEFAULT 0,
+
+ type TEXT NOT NULL
+ CHECK (type IN ('heading', 'subheading', 'paragraph',
+ 'list', 'links', 'quote', 'image', 'divider',
+ 'video', 'button', 'callout', 'schedule')),
+ text TEXT,
+ media TEXT,
+ href TEXT,
+ alt TEXT,
+ cite TEXT
+) STRICT;
+
+INSERT INTO content_blocks_new
+ (id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite)
+SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite
+ FROM content_blocks;
+
+PRAGMA legacy_alter_table = ON;
+DROP TABLE content_blocks;
+ALTER TABLE content_blocks_new RENAME TO content_blocks;
+PRAGMA legacy_alter_table = OFF;
+
+CREATE INDEX content_blocks_owner_idx
+ ON content_blocks (owner_kind, owner_id, slot, sort_order);
+
+ALTER TABLE content_block_items ADD COLUMN day TEXT;
+ALTER TABLE content_block_items ADD COLUMN time TEXT;
+ALTER TABLE content_block_items ADD COLUMN location TEXT;
+ALTER TABLE content_block_items ADD COLUMN person_id TEXT
+ REFERENCES people (id) ON DELETE SET NULL;
+ALTER TABLE content_block_items ADD COLUMN description TEXT;
+ALTER TABLE content_block_items ADD COLUMN media TEXT;
+ALTER TABLE content_block_items ADD COLUMN map TEXT;
+
+
+-- ── Triggers last (see CLAUDE.md, Migrations) ──
+
+CREATE TRIGGER content_blocks_owner_exists
+BEFORE INSERT ON content_blocks
+BEGIN
+ SELECT CASE
+ WHEN new.owner_kind = 'event'
+ AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id)
+ THEN RAISE(ABORT, 'content_blocks: no such event')
+ WHEN new.owner_kind = 'organization'
+ AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id)
+ THEN RAISE(ABORT, 'content_blocks: no such organization')
+ WHEN new.owner_kind = 'person'
+ AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id)
+ THEN RAISE(ABORT, 'content_blocks: no such person')
+ WHEN new.owner_kind = 'team'
+ AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id)
+ THEN RAISE(ABORT, 'content_blocks: no such team')
+ WHEN new.owner_kind = 'blog_post'
+ AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id)
+ THEN RAISE(ABORT, 'content_blocks: no such blog post')
+ END;
+END;
diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js
index 747f7e4..41bcb3b 100644
--- a/server/src/seed-showcase.js
+++ b/server/src/seed-showcase.js
@@ -16,7 +16,8 @@
/people/showcase-person person: bio, links, roles past and
current, events, awards, private data
/events/showcase-event upcoming retreat: hosts, billed
- people, links, blocks, background
+ people, links, blocks, background,
+ a three-day schedule
/events/showcase-series weekly series with times
/events/showcase-past-event past event where the award was given
/blog/content-block-showcase every content block type
@@ -81,6 +82,23 @@ 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). */
+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", 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" },
+ { 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: "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" },
+ ],
+];
+
/* Every block type, for the blog showcase. [type, fields, items?] */
const ALL_BLOCKS = [
["paragraph", { text: "Every content block type, top to bottom, with each of its options. Use it to check the page after changing how blocks draw." }],
@@ -109,6 +127,8 @@ const ALL_BLOCKS = [
["subheading", { text: "Images" }],
["image", { media: IMAGE, alt: "Describe the picture here", text: "An image with a caption and alt text" }],
["image", { media: IMAGE, alt: "The same picture, linked", href: "/history" }],
+ ["subheading", { text: "Schedule" }],
+ SCHEDULE,
["subheading", { text: "Video" }],
["video", { href: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", text: "A YouTube video, with its own thumbnail" }],
["video", { href: "https://vimeo.com/76979871", media: IMAGE, text: "A Vimeo video with an uploaded still" }],
@@ -354,7 +374,7 @@ tx(db, () => {
{ kind: "social", platform: "instagram", label: "@showcaseretreat", url: "https://instagram.com/showcaseretreat" },
]);
blocks("event", EVENT, "card", cardText("event"));
- blocks("event", EVENT, "body", pageBody("event"));
+ blocks("event", EVENT, "body", [...pageBody("event"), ["heading", { text: "Schedule" }], SCHEDULE]);
insert("events", {
id: SERIES,
diff --git a/server/src/shape.js b/server/src/shape.js
index 5973156..179d71c 100644
--- a/server/src/shape.js
+++ b/server/src/shape.js
@@ -98,18 +98,39 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
const itemRows = db
.prepare(
- `SELECT block_id, text, detail, url
- FROM content_block_items
- WHERE block_id IN (${placeholders(blockIds.length)})
- ORDER BY block_id, sort_order`,
+ `SELECT i.block_id, i.text, i.detail, i.url,
+ i.day, i.time, i.location, i.description, i.media, i.map,
+ p.id AS person_id, p.display_name AS person_name,
+ p.photo AS person_photo, p.tagline AS person_tagline
+ FROM content_block_items i
+ LEFT JOIN people p ON p.id = i.person_id AND p.is_published = 1
+ WHERE i.block_id IN (${placeholders(blockIds.length)})
+ ORDER BY i.block_id, i.sort_order`,
)
.all(...blockIds);
+ // 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.
for (const row of itemRows) {
byId.get(row.block_id)?.items.push({
text: row.text,
detail: row.detail,
url: row.url,
+ day: row.day,
+ time: row.time,
+ location: row.location,
+ description: row.description,
+ media: row.media,
+ map: row.map,
+ person: row.person_id
+ ? {
+ id: row.person_id,
+ name: row.person_name,
+ photo: row.person_photo,
+ tagline: row.person_tagline,
+ }
+ : null,
});
}
diff --git a/src/components/ContentBlocks.tsx b/src/components/ContentBlocks.tsx
index d94e4b9..959dcd3 100644
--- a/src/components/ContentBlocks.tsx
+++ b/src/components/ContentBlocks.tsx
@@ -19,6 +19,10 @@
image media, alt, text is the caption, href
video href is the video, media a still, text
the caption; click to play
+ schedule items as entries in day tabs (day, time,
+ text, detail, url, location, person, and
+ a fold-out of description, media, map);
+ text is an optional intro. ScheduleBlock
divider nothing
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
@@ -33,6 +37,7 @@ import { blockMedia } from '../lib/media.ts'
import type { ContentBlock } from '../lib/useContent.ts'
import { Anchor, Inline, Paragraphs } from './InlineText.tsx'
import VideoPlayer from './VideoPlayer.tsx'
+import ScheduleBlock from './ScheduleBlock.tsx'
const BODY = '#4a6b72'
@@ -196,6 +201,10 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
)
+ case 'schedule':
+ if (!block.items?.length) return null
+ return
+ {entry.time} +
+ +{title}
+ {(entry.location || entry.person) && ( +
+ {entry.location && {entry.location}}
+ {entry.person && (
+
+
+ {entry.detail} +
+ )} ++ {entry.person.tagline} +
+ )} +Preview
- {PREVIEWS[spec.preview](row)} + {PREVIEWS[spec.preview](row, options)}