Page editors: Retreats, Community, Resources, Organization and History built from sections

Each page is now a list of sections edited in Admin → Pages: a title
(30 characters at most, for the side nav), URL ID, blurb and accent,
its own content blocks, and an optional preset (Community blog, groups
map, region list, partner cards, events, timeline, NGU's details).
Migration 056 seeds every page as the code drew it and moves the
Organization editor's blocks and volunteering into its sections. The
Community blog's settings move into the Community editor. The header,
footer and side nav read each page's sections from the API.

The admin engine reads and writes nested collections to any depth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-01 00:15:30 -05:00
parent 4a1d6fd6e9
commit 9daf7b1a4f
29 changed files with 972 additions and 938 deletions

View file

@ -1,12 +1,9 @@
import { preview } from "../text.ts";
import { mediaUrl } from "../media.ts";
import { PUBLISHED_FIELD, LISTED_FIELD, FEATURED_KINDS, featuredCardsChild, blocksChild } from "./shared.ts";
import { PUBLISHED_FIELD, LISTED_FIELD, blocksChild } from "./shared.ts";
/* ── Blog (031_blog.sql) ─────────────────────────────────────────
Posts at /blog/:id, and the Community page's blog section. The
section's community posts reuse the featured cards, limited to
links: a pinned Substack post is a link card, and Fetch preview
fills it from the post. */
Posts at /blog/:id. The Community page's blog section is edited
with that page (sitePages.ts). */
/* A post's body is the content blocks without the card/body choice:
a post only has a body. */
@ -106,87 +103,3 @@ export const blogPosts = {
blogBlocksChild,
],
};
export const communityPage = {
key: "community_page",
label: "Community blog section",
singular: "community blog section",
idLabel: "Page",
singleton: "community",
list: { columns: [], filters: [] },
groups: [
{
legend: "Section",
note: "The first section of the Community page.",
fields: [
{ path: "blog_title", label: "Heading", help: "Default: Community Blog" },
{ path: "blog_blurb", label: "Blurb", widget: "textarea", full: true },
],
},
{
legend: "Our posts",
note: "Pinned posts first, then the newest published, listed posts, up to the number of slots.",
fields: [
{ path: "internal_title", label: "Heading", help: "Default: From NGU" },
{ path: "internal_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
],
},
{
legend: "Community posts",
note: "Pinned cards first, then the newest items from the feeds below, up to the number of slots.",
fields: [
{ path: "external_title", label: "Heading", help: "Default: From our community" },
{ path: "external_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
{ path: "external_url", label: "Button link", help: "eg. https://ngu.substack.com", full: true },
{ path: "external_label", label: "Button text", help: "Default: Read more on Substack" },
],
},
],
children: [
{
key: "pinned_posts",
label: "Pinned posts (ours)",
note: "Always shown, before the newest.",
addLabel: "Pin a post",
title: (row, options) =>
options?.blog_posts?.find((p) => p.id === row.post_id)?.label ?? "New pin",
blank: { post_id: "" },
fields: [
{
path: "post_id",
label: "Post",
widget: "select",
optionsFrom: "blog_posts",
required: true,
},
],
},
{
...featuredCardsChild,
label: "Pinned community posts",
note: "Always shown, before the feeds' newest. Paste a post's link and press Fetch preview.",
addLabel: "Pin a post",
blank: { kind: "", url: "", title: "" },
fields: featuredCardsChild.fields.map((field) =>
field.path === "kind"
? { ...field, options: FEATURED_KINDS.filter(([kind]) => kind !== "record") }
: field,
),
},
{
key: "feeds",
label: "Feeds",
note: "RSS or Atom feeds whose newest posts fill the community slots. Read about every 30 minutes.",
addLabel: "Add feed",
title: (row) => row.label || row.url || "New feed",
blank: { url: "", label: "" },
fields: [
{ path: "url", label: "Feed URL", required: true, full: true, help: "eg. https://ngu.substack.com/feed" },
{ path: "label", label: "Source name", help: "Shown on its cards. Default: the feed's own title" },
],
},
],
};

View file

@ -173,7 +173,7 @@ export const frontPage = {
options: FRONT_PAGE_SECTIONS,
required: true,
},
{ path: "title", label: "Heading", help: "Heading Override" },
{ path: "title", label: "Heading", help: "Default: the band's own name. Up to about 60 characters fit." },
{ path: "blurb", label: "Blurb", full: true },
{ path: "is_hidden", label: "Hidden", widget: "checkbox", help: "Hide for now" },
],

View file

@ -1,71 +0,0 @@
/* Pages → Organization page: the /organization page's own content.
Server side: server/src/admin-schema/organizationPage.js. Each
section's blocks are their own collection; the Leadership blocks
are where the teams go, a People block each, in order. */
import { blocksChild } from "./shared.ts";
/* A block collection for one section: the shared block editor,
without "Shown in" (these blocks only ever show on the page). */
const sectionBlocks = (key: string, label: string, note: string) => ({
...blocksChild,
key,
label,
note,
fields: blocksChild.fields.filter((field) => field.path !== "slot"),
});
export const organizationPage = {
key: "organization_page",
label: "Organization page",
singular: "organization page",
idLabel: "Page",
singleton: "organization",
list: { columns: [], filters: [] },
groups: [
{
legend: "Mission, Vision & Values",
note: "The page's first section. Its content is the Mission blocks below.",
fields: [{ path: "mission_title", label: "Heading", help: "Default: Mission, Vision & Values" }],
},
{
legend: "Leadership",
note: "The second section: the Leadership blocks below, then Volunteering.",
fields: [
{ path: "leadership_title", label: "Heading", help: "Default: Leadership" },
{ path: "leadership_blurb", label: "Blurb", widget: "textarea", full: true },
],
},
{
legend: "Volunteering",
note: "Under the leadership: a title, a line or two and the links below.",
fields: [
{ path: "volunteer_title", label: "Title", help: "Default: Volunteering" },
{ path: "volunteer_blurb", label: "Blurb", widget: "textarea", full: true },
],
},
],
children: [
sectionBlocks("mission_blocks", "Mission blocks", "The Mission, Vision & Values section: headings, paragraphs, lists, whatever it needs."),
sectionBlocks(
"leadership_blocks",
"Leadership blocks",
"The Leadership section, in order: eg. a People block for the Board of Trustees, then one for the Retreat Team.",
),
{
key: "volunteer_links",
label: "Volunteering links",
note: "Buttons under the volunteering blurb.",
addLabel: "Add link",
title: (row) => row.label || row.url || "New link",
blank: { label: "", url: "" },
fields: [
{ path: "label", label: "Label", required: true, help: "eg. Volunteer at a retreat" },
{ path: "url", label: "Link", required: true, full: true, help: "A page on this site (eg. /request) or anywhere else" },
],
},
],
};

View file

@ -0,0 +1,215 @@
/* ── The site's own pages (056_site_pages.sql) ───────────────────
Pages → Community, Retreats, Resources, Organization, History:
each page is its sections, in order, and each section is its
heading and its own content blocks, then a preset if it has one
(a prebuilt part of the site, drawn under the blocks). Server
side: server/src/admin-schema/sitePages.js; the page is
src/pages/SitePage.tsx.
The preset values are the CHECK list on page_sections.preset;
each page offers the ones that belong on it. */
import { FEATURED_KINDS, featuredCardsChild, blocksChild } from "./shared.ts";
const PRESETS = {
community_blog: "Community blog (its settings are below)",
group_map: "Local groups map",
region_list: "Unity Regions list",
partner_list: "Partner organization cards",
events: "Event carousel or grid",
timeline: "Timeline",
organization_details: "Address, tax ID and email",
};
const ACCENT_OPTIONS = [
["teal", "Teal"],
["deep", "Deep teal"],
["green", "Green"],
["amber", "Amber"],
];
const EVENT_TYPES = [
["retreat", "Retreat"],
["class", "Class"],
["workshop", "Workshop"],
["meeting", "Meeting"],
["other", "Other"],
];
const EVENTS = { path: "preset", value: "events" };
const sectionsChild = (presets: string[]) => ({
key: "sections",
label: "Sections",
note: "Top to bottom. Each is listed in the page's side nav and the header's menu under its title.",
addLabel: "Add section",
title: (row) => row.title || "New section",
blank: { anchor: "", title: "", blurb: "", accent: "", preset: "", content_blocks: [] },
fields: [
{
path: "title",
label: "Title",
required: true,
help: "Up to 30 characters, so it fits the side nav. eg. Mission, Vision & Values",
},
{
path: "anchor",
label: "URL ID",
required: true,
help: "The section's link after the #: lowercase letters, numbers and hyphens, eg. leadership",
},
{ path: "blurb", label: "Blurb", widget: "textarea", full: true, help: "A line under the title" },
{ path: "accent", label: "Accent", widget: "select", options: ACCENT_OPTIONS, blankLabel: "Default: Teal" },
...(presets.length
? [
{
path: "preset",
label: "Preset",
widget: "select",
options: presets.map((key) => [key, PRESETS[key]]),
blankLabel: "Default: none, just the blocks below",
help: "A prebuilt part of the site, shown under the section's blocks",
},
]
: []),
...(presets.includes("events")
? [
{
path: "scope_id",
label: "Events: scope",
widget: "select",
optionsFrom: "event_scopes",
blankLabel: "Default: every scope",
when: EVENTS,
},
{
path: "event_type",
label: "Events: type",
widget: "select",
options: EVENT_TYPES,
blankLabel: "Default: every type",
when: EVENTS,
},
{
path: "view",
label: "Opens as",
widget: "select",
options: [["carousel", "Carousel"], ["grid", "Grid"]],
blankLabel: "Default: Carousel",
when: EVENTS,
},
]
: []),
...(presets.includes("group_map")
? [
{
path: "view",
label: "Opens as",
widget: "select",
options: [["map", "Map"], ["grid", "Grid"]],
blankLabel: "Default: Map",
when: { path: "preset", value: "group_map" },
},
]
: []),
],
children: [
{
...blocksChild,
label: "Blocks",
note: "The section's own content: headings, paragraphs, people, links, whatever it needs.",
fields: blocksChild.fields.filter((field) => field.path !== "slot"),
},
],
});
const sitePage = (id: string, label: string, presets: string[], more: Record<string, any> = {}) => ({
key: `${id}_page`,
label,
singular: label.toLowerCase(),
idLabel: "Page",
singleton: id,
list: { columns: [], filters: [] },
groups: [],
...more,
children: [sectionsChild(presets), ...(more.children ?? [])],
});
export const communityPage = sitePage(
"community",
"Community page",
["community_blog", "group_map", "region_list", "partner_list"],
{
groups: [
{
legend: "Community blog: our posts",
note: "For the Community blog preset. Pinned posts first, then the newest published, listed posts, up to the number of slots.",
fields: [
{ path: "blog.internal_title", label: "Heading", help: "Default: From NGU" },
{ path: "blog.internal_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
],
},
{
legend: "Community blog: community posts",
note: "Pinned cards first, then the newest items from the feeds below, up to the number of slots.",
fields: [
{ path: "blog.external_title", label: "Heading", help: "Default: From our community" },
{ path: "blog.external_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
{ path: "blog.external_url", label: "Button link", help: "eg. https://ngu.substack.com", full: true },
{ path: "blog.external_label", label: "Button text", help: "Default: Read more on Substack" },
],
},
],
children: [
{
key: "pinned_posts",
label: "Community blog: pinned posts (ours)",
note: "Always shown, before the newest.",
addLabel: "Pin a post",
title: (row, options) =>
options?.blog_posts?.find((p) => p.id === row.post_id)?.label ?? "New pin",
blank: { post_id: "" },
fields: [
{
path: "post_id",
label: "Post",
widget: "select",
optionsFrom: "blog_posts",
required: true,
},
],
},
{
...featuredCardsChild,
label: "Community blog: pinned community posts",
note: "Always shown, before the feeds' newest. Paste a post's link and press Fetch preview.",
addLabel: "Pin a post",
blank: { kind: "", url: "", title: "" },
fields: featuredCardsChild.fields.map((field) =>
field.path === "kind"
? { ...field, options: FEATURED_KINDS.filter(([kind]) => kind !== "record") }
: field,
),
},
{
key: "feeds",
label: "Community blog: feeds",
note: "RSS or Atom feeds whose newest posts fill the community slots. Read about every 30 minutes.",
addLabel: "Add feed",
title: (row) => row.label || row.url || "New feed",
blank: { url: "", label: "" },
fields: [
{ path: "url", label: "Feed URL", required: true, full: true, help: "eg. https://ngu.substack.com/feed" },
{ path: "label", label: "Source name", help: "Shown on its cards. Default: the feed's own title" },
],
},
],
},
);
export const retreatsPage = sitePage("retreats", "Retreats page", ["events"]);
export const resourcesPage = sitePage("resources", "Resources page", []);
export const organizationPage = sitePage("organization", "Organization page", ["organization_details"]);
export const historyPage = sitePage("history", "History page", ["timeline"]);