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:
parent
4a1d6fd6e9
commit
9daf7b1a4f
29 changed files with 972 additions and 938 deletions
95
server/src/admin-schema/sitePages.js
Normal file
95
server/src/admin-schema/sitePages.js
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
import { text, url, int, enumeration, featuredCardsChild, blocksChild } from "./columns.js";
|
||||
|
||||
/* ── The site's own pages (056_site_pages.sql) ───────────────────
|
||||
|
||||
Community, Retreats, Resources, Organization and History: one
|
||||
site_pages row each, edited as its own singleton, with its
|
||||
sections nested under it and each section's blocks under that
|
||||
(the blocks' items under them, as on any record). A section is
|
||||
either its blocks or a preset, a prebuilt part of the site
|
||||
(SitePage.tsx draws both).
|
||||
|
||||
Community also carries the blog section's settings: the
|
||||
community_page row (same id) as an extension, and its pinned
|
||||
posts, cards and feeds, all owned by that id. */
|
||||
|
||||
const sectionsChild = {
|
||||
key: "sections",
|
||||
table: "page_sections",
|
||||
owner: { column: "page_id" },
|
||||
order: "sort_order",
|
||||
columns: [
|
||||
text("anchor", { required: true }),
|
||||
text("title", { required: true }),
|
||||
text("blurb"),
|
||||
enumeration("accent", ["teal", "deep", "green", "amber"]),
|
||||
enumeration("preset", [
|
||||
"community_blog",
|
||||
"group_map",
|
||||
"region_list",
|
||||
"partner_list",
|
||||
"events",
|
||||
"timeline",
|
||||
"organization_details",
|
||||
]),
|
||||
text("scope_id"),
|
||||
enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]),
|
||||
enumeration("view", ["carousel", "grid", "map"]),
|
||||
],
|
||||
children: [blocksChild("page_section")],
|
||||
};
|
||||
|
||||
const sitePage = (id, more = {}) => ({
|
||||
key: `${id}_page`,
|
||||
table: "site_pages",
|
||||
idColumn: "id",
|
||||
idKind: "slug",
|
||||
singleton: id,
|
||||
concurrency: "updated_at",
|
||||
|
||||
list: { columns: ["id", "updated_at"], filters: [], search: [], order: "id" },
|
||||
|
||||
columns: [],
|
||||
...more,
|
||||
children: [sectionsChild, ...(more.children ?? [])],
|
||||
});
|
||||
|
||||
export const communityPage = sitePage("community", {
|
||||
extensions: [
|
||||
{
|
||||
key: "blog",
|
||||
table: "community_page",
|
||||
idColumn: "id",
|
||||
columns: [
|
||||
text("internal_title"),
|
||||
int("internal_slots"),
|
||||
text("external_title"),
|
||||
int("external_slots"),
|
||||
url("external_url"),
|
||||
text("external_label"),
|
||||
],
|
||||
},
|
||||
],
|
||||
children: [
|
||||
{
|
||||
key: "pinned_posts",
|
||||
table: "community_page_pinned_posts",
|
||||
owner: { column: "page_id" },
|
||||
order: "sort_order",
|
||||
columns: [text("post_id", { required: true })],
|
||||
},
|
||||
featuredCardsChild("community_page"),
|
||||
{
|
||||
key: "feeds",
|
||||
table: "community_page_feeds",
|
||||
owner: { column: "page_id" },
|
||||
order: "sort_order",
|
||||
columns: [url("url", { required: true }), text("label")],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const retreatsPage = sitePage("retreats");
|
||||
export const resourcesPage = sitePage("resources");
|
||||
export const organizationPage = sitePage("organization");
|
||||
export const historyPage = sitePage("history");
|
||||
Loading…
Add table
Add a link
Reference in a new issue