diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index 7798117..5e6fa46 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -30,7 +30,7 @@ what a dropdown in the admin editor says. | A record: an event, organization, person, team, award, timeline entry | the database | editing it in the admin | | The front page's words, photos, bands, stats and paths | the database | Admin → Pages → Front page | | Blog posts, and the Community page's blog settings (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community | -| The sections of Retreats, Community, Resources, Organization and History: titles, blurbs, accents, their content blocks and presets (the blog, groups map, regions, partners, events, timeline) | the database | Admin → Pages → the page. A section title is 30 characters at most (it's listed in the side nav); a front page heading fits about 60. Preset names: `PRESETS` in `src/lib/adminSchema/sitePages.ts`, what each draws: `PRESETS` in `src/pages/SitePage.tsx` | +| The sections of Retreats, Community, Resources, Organization and History: titles, blurbs, accents, their content blocks and presets (the blog, groups map, regions, partners, events, timeline, NGU's details) | the database | Admin → Pages → the page. A section title is 30 characters at most (it's listed in the side nav); a front page heading fits about 60. Preset names: `PRESETS` in `src/lib/adminSchema/sitePages.ts`, what each draws: `PRESETS` in `src/pages/SitePage.tsx` | | The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) | | The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) | | Navigation, colors, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) | diff --git a/server/src/admin-schema/sitePages.js b/server/src/admin-schema/sitePages.js index d8c57e0..99edd3f 100644 --- a/server/src/admin-schema/sitePages.js +++ b/server/src/admin-schema/sitePages.js @@ -30,6 +30,7 @@ const sectionsChild = { "partner_list", "events", "timeline", + "organization_details", ]), text("scope_id"), enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]), diff --git a/server/src/migrations/058_contact_blocks.sql b/server/src/migrations/058_contact_blocks.sql deleted file mode 100644 index 3dfdf4a..0000000 --- a/server/src/migrations/058_contact_blocks.sql +++ /dev/null @@ -1,73 +0,0 @@ --- ═══════════════════════════════════════════════════════════════ --- 058 DETAILS & CONTACT AS BLOCKS --- --- The Organization page's Details & Contact section was a preset --- (organization_details) drawing NGU's address, tax ID and email --- from code. It's ordinary content now, edited like any section's: --- each section that used the preset gets those details as blocks --- (the address, the nonprofit line with the tax ID, an email --- button), and the preset leaves page_sections' CHECK. --- --- page_sections is rebuilt for that CHECK, keeping its ids (its --- blocks are owned by them), with its index and cleanup trigger. --- ═══════════════════════════════════════════════════════════════ - -INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text, href) -SELECT 'page_section', CAST(s.id AS TEXT), 'body', b.sort_order, b.type, b.text, b.href - FROM page_sections s - CROSS JOIN ( - SELECT 1000 AS sort_order, 'paragraph' AS type, - '1901 NW Blue Parkway' || char(10) || 'Unity Village, MO 64065' || char(10) || - '*(Physical address, not for mail)*' AS text, - NULL AS href - UNION ALL - SELECT 1001, 'paragraph', - 'Next Generation of Unity is a qualified 501(c)(3) nonprofit organization. Tax ID: 33-2819320.', NULL - UNION ALL - SELECT 1002, 'button', 'info@nextgenerationofunity.org', 'mailto:info@nextgenerationofunity.org' - ) b - WHERE s.preset = 'organization_details'; - -UPDATE page_sections SET preset = NULL WHERE preset = 'organization_details'; - -CREATE TABLE page_sections_new ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - page_id TEXT NOT NULL REFERENCES site_pages (id) ON DELETE CASCADE, - sort_order INTEGER NOT NULL DEFAULT 0, - anchor TEXT NOT NULL - CONSTRAINT "A section's URL ID can use only lowercase letters, numbers and hyphens, eg. leadership." - CHECK (anchor <> '' AND anchor NOT GLOB '*[^a-z0-9-]*'), - title TEXT NOT NULL - CONSTRAINT "A section title can be 30 characters at most (it's listed in the page's side nav)." - CHECK (length(title) <= 30), - blurb TEXT, - accent TEXT CHECK (accent IN ('teal', 'deep', 'green', 'amber')), - preset TEXT CHECK (preset IN ('community_blog', 'group_map', 'region_list', 'partner_list', - 'events', 'timeline')), - -- An events preset's filter and first view. - scope_id TEXT REFERENCES event_scopes (id) ON DELETE SET NULL, - event_type TEXT CHECK (event_type IN ('retreat', 'class', 'workshop', 'meeting', 'other')), - view TEXT CHECK (view IN ('carousel', 'grid', 'map')), - UNIQUE (page_id, anchor) -) STRICT; - -INSERT INTO page_sections_new - (id, page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view) -SELECT id, page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view - FROM page_sections; - -PRAGMA legacy_alter_table = ON; -DROP TABLE page_sections; -ALTER TABLE page_sections_new RENAME TO page_sections; -PRAGMA legacy_alter_table = OFF; - -CREATE INDEX page_sections_page_idx ON page_sections (page_id, sort_order); - - --- ── Triggers last (see CLAUDE.md, Migrations) ── - -CREATE TRIGGER page_sections_cleanup -AFTER DELETE ON page_sections -BEGIN - DELETE FROM content_blocks WHERE owner_kind = 'page_section' AND owner_id = CAST(old.id AS TEXT); -END; diff --git a/src/components/PageShell.tsx b/src/components/PageShell.tsx index 1b0918c..411095c 100644 --- a/src/components/PageShell.tsx +++ b/src/components/PageShell.tsx @@ -5,14 +5,10 @@ heading with a blurb and rule. Sections paint no background of their own: the page's (PageBackdrop.tsx) runs behind all of them. - `sideNav` adds an "On this page" list in the left margin, the + `sideNav` adds an "On this page" column at the left from lg up, the admin editors' own (SectionNav), sticky under the header, listing - the sections with the one being read lit. It sits beside the - sections rather than taking a column from them, so they stay where - they'd be without it; it shows once the margin beside the 72rem - content is wide enough for it (88rem screens up, titles wrapping - onto a second line). Narrower, the header's dropdowns list the - sections instead. + the sections with the one being read lit. Below lg the menu lists + the sections instead. Whatever goes inside a section is passed as `content`, the shell doesn't care what it is. @@ -109,9 +105,12 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P if (typeof title === "string") document.title = documentTitle(title); }, [title]); - // The thin solid banner between sections, the page's full width - // (behind the side nav). - const banner = (accent: string) =>
; + // The thin solid banner between sections. With the side nav it runs + // the page's full width, under the nav column, rather than stopping + // at the content's edge. + const banner = (accent: string) => ( +
+ ); const bands = sections.map((section, i) => (
{banner(section.accent)} @@ -133,17 +132,13 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
{sideNav ? ( -
- {/* The margin left of the content (72rem, its text 1.5rem in). */} -