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/Layout.tsx b/src/components/Layout.tsx
index e98b6b2..f930891 100644
--- a/src/components/Layout.tsx
+++ b/src/components/Layout.tsx
@@ -189,12 +189,8 @@ export default function Layout() {
{pageSections.length > 0 && (
// pt-3 is the bridge the pointer crosses from the
- // link into the menu without it closing. Keyboard
- // focus opens it too, but only keyboard focus
- // (:focus-visible): a click leaves focus on the
- // link, which held the menu open after the
- // pointer had gone.
-
+ // link into the menu without it closing.
+
═══════════════════════════════════════════════════════════════ */
-import { useEffect, useRef, useState, type ReactNode } from "react";
+import { useEffect, type ReactNode } from "react";
import { documentTitle } from "../lib/site.ts";
-import { accentText, ACCENTS, BRAND } from '../lib/color.ts'
-import { SectionNav, useActiveSection } from "./admin/SectionNav.tsx";
-import "./PageShell.css";
+import { accentText, BRAND } from '../lib/color.ts'
+import { SectionNav } from "./admin/SectionNav.tsx";
export type ShellSection = {
@@ -103,161 +97,7 @@ export function Section({ section }: { section: ShellSection }) {
);
}
-/* The side nav's circle at rest: half again the list's width (or a
- little more than its height, if taller), at most 22rem. */
-const circleSize = (box: { width: number; height: number }) =>
- Math.min(Math.max(box.width * 1.5, box.height * 1.1), 22 * 16);
-
-/* The height an ellipse `width` wide needs to take in a box reaching
- `across` and `down` from its center (or a corner it's centered on):
- (across / a)^2 + (down / b)^2 <= 1. Equal to the width when a circle
- that wide would do; taller when the list is too tall for one. A
- box as wide as the ellipse can't be taken in, so it stops at 95%
- (about three times the box's height). */
-const coverHeight = (width: number, across: number, down: number) => {
- const a = width / 2;
- const ratio = Math.min(across / a, 0.95);
- return Math.max(width, (2 * down) / Math.sqrt(1 - ratio * ratio));
-};
-
-/* How far the list sits in from the column's top and left: the
- circle centers on that. LIST_TOP puts "On this page" level with
- the first section's title: the line (h-2, 8px), the section's
- py-20 (80px), then half the difference between the title's 40px
- line (md:text-4xl) and the heading's 16px one. Lower still if its
- circle needs the room to start CIRCLE_GAP below that first line
- rather than over it.
-
- Once the page scrolls, the list sticks just STUCK_TOP under the
- header, so its circle rises up behind the header like a sun in the
- corner; the sticky offset takes back whatever the list sits lower
- than that. */
-const LIST_TOP = 8 + 100 + (40 - 16) / 2;
-const STUCK_TOP = 16;
-const stickAt = (listTop: number) => `calc(var(--header-h, 5rem) + ${STUCK_TOP - listTop}px)`;
-const LIST_LEFT = 16;
-const CIRCLE_GAP = 8 + 4;
-/* Room the circle keeps: from the section's edge at rest, and around
- the list it takes in. */
-const CIRCLE_EDGE = 16;
-const CIRCLE_MARGIN = 12;
-
-/* The circle's color family for a section's accent (PageShell.css):
- green and amber their own, teal and deep teal (and any other) teal. */
-const circleFamily = (accent?: string) =>
- accent === ACCENTS.green ? "green" : accent === ACCENTS.amber ? "amber" : "teal";
-/* How far left of the list's center the circle sits, at most: never
- left of the "On this page" heading's own center, so a list of short
- titles keeps it on the heading. */
-const CIRCLE_SHIFT = 24;
-
export default function PageShell({ title, intro, sections, sideNav = false }: PageShellProps) {
- // The list's measured box, so its circle can center on it from a
- // layer of its own (below).
- // The column's width too: the circle keeps its right edge inside
- // it, sliding off the screen's left edge instead when the window
- // narrows.
- const listRef = useRef(null);
- const columnRef = useRef(null);
- const [listBox, setListBox] = useState<{ width: number; height: number; heading: number } | null>(null);
- const [columnWidth, setColumnWidth] = useState(0);
- useEffect(() => {
- const list = listRef.current;
- const column = columnRef.current;
- if (!list || !column) return;
- const ro = new ResizeObserver(() => {
- const heading = list.querySelector("[data-nav-heading]");
- setListBox({
- width: list.offsetWidth,
- height: list.offsetHeight,
- // The heading's center, from the list's left.
- heading: heading ? heading.offsetLeft + heading.offsetWidth / 2 : 0,
- });
- setColumnWidth(column.offsetWidth);
- });
- ro.observe(list);
- ro.observe(column);
- return () => ro.disconnect();
- }, [sideNav]);
- const navSections = sideNav ? sections.map((s) => ({ id: s.id, label: s.title, accent: s.accent })) : [];
- const active = useActiveSection(navSections);
- const activeAccent = sections.find((s) => s.id === active)?.accent;
-
- // The shape at rest: a circle centered on the list (a little left,
- // never left of the heading's center), CIRCLE_EDGE clear of the
- // section's edge, made an ellipse as tall as it takes when the list
- // is too tall for the circle (10 sections of two-line titles).
- // The shape at a given width: its center as near the list's as the
- // section's edge allows (it may run off the screen's left edge), and
- // the height it then takes.
- const restAt = (width: number, box: { width: number; height: number; heading: number }) => {
- const center = Math.min(
- LIST_LEFT + Math.max(box.width / 2 - CIRCLE_SHIFT, box.heading),
- columnWidth - CIRCLE_EDGE - width / 2,
- );
- const across = Math.max(center - LIST_LEFT, LIST_LEFT + box.width - center) + CIRCLE_MARGIN;
- return { width, height: coverHeight(width, across, box.height / 2 + CIRCLE_MARGIN), left: center - width / 2 };
- };
- const rest = (() => {
- if (!listBox) return null;
- const circle = restAt(circleSize(listBox), listBox);
- if (circle.height <= circle.width) return circle;
- // Too tall a list for the circle: the width, up to 22rem, that
- // needs the least height.
- let best = circle;
- for (let width = listBox.width + 2 * CIRCLE_MARGIN; width <= 22 * 16; width += 8) {
- const shape = restAt(width, listBox);
- if (shape.height < best.height) best = shape;
- }
- return best;
- })();
- const listTop = listBox && rest ? Math.max(LIST_TOP, CIRCLE_GAP + rest.height / 2 - listBox.height / 2) : LIST_TOP;
-
- // Stuck: the page has scrolled the list up to its place under the
- // header. The circle then becomes the corner sun (below).
- const [stuck, setStuck] = useState(false);
- useEffect(() => {
- const column = columnRef.current;
- if (!sideNav || !column) return;
- let frame = 0;
- const measure = () => {
- frame = 0;
- const header = parseFloat(getComputedStyle(column).getPropertyValue("--header-h")) || 80;
- setStuck(column.getBoundingClientRect().top + listTop <= header + STUCK_TOP + 1);
- };
- const onScroll = () => {
- if (!frame) frame = requestAnimationFrame(measure);
- };
- measure();
- window.addEventListener("scroll", onScroll, { passive: true });
- window.addEventListener("resize", onScroll);
- return () => {
- window.removeEventListener("scroll", onScroll);
- window.removeEventListener("resize", onScroll);
- if (frame) cancelAnimationFrame(frame);
- };
- }, [sideNav, listTop]);
-
- // The circle's box, from its layer's top left (which sticks with
- // the list). At rest: `rest` above. Stuck: a sun in the corner,
- // centered on the header's bottom left so the header and the
- // screen's edge hide three quarters of it, reaching past the list's
- // far corner. Never wider than the column (it'd show a cut edge at
- // the content): held narrower by the window, it stays centered on
- // the header's edge (so below it, it only ever curves inward) and
- // becomes an ellipse, as tall as it takes to take the list in.
- const circleBox = (() => {
- if (!listBox || !rest) return null;
- if (stuck) {
- const across = LIST_LEFT + listBox.width + CIRCLE_MARGIN;
- const down = STUCK_TOP + listBox.height + CIRCLE_MARGIN;
- const width = 2 * Math.min(Math.hypot(across, down), columnWidth - 8);
- const height = coverHeight(width, across, down);
- return { width, height, left: -width / 2, top: listTop - STUCK_TOP - height / 2 };
- }
- return { width: rest.width, height: rest.height, left: rest.left, top: listTop + listBox.height / 2 - rest.height / 2 };
- })();
-
// The tab's title as the visitor moves around. The first load's
// comes from the server (pageMeta.js), which also sets the page's
// description and preview for search and link sharing.
@@ -265,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)}
@@ -289,45 +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),
- clipping sideways only, so nothing reaches the
- content or the screen's edge. clip, not hidden: hidden
- would make it a scroll container, and the sticky layers in
- it would stop sticking. */}
-