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