NGU-Web/server/src/admin-schema/sitePages.js
Zaldimmar f65664217e Details & Contact as blocks, not a preset; the side nav sits in the margin instead of shifting the sections
Migration 058 turns the organization_details preset into the
section's own blocks and drops it from page_sections' CHECK. The side
nav is placed in the left margin beside the 72rem content, from 88rem
screens up, so sections stay where they'd be without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 03:28:03 -05:00

94 lines
2.7 KiB
JavaScript

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",
]),
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");