Compare commits

..

No commits in common. "3308b5f1b54b7349a0132ac3f9e85fda024b71bd" and "3e4a725c9942c3bc3b41970e5eb683139672b7b6" have entirely different histories.

8 changed files with 50 additions and 96 deletions

View file

@ -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 | | 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 | | 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 | | 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 **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) | | 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) | | Navigation, colors, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) |

View file

@ -30,6 +30,7 @@ const sectionsChild = {
"partner_list", "partner_list",
"events", "events",
"timeline", "timeline",
"organization_details",
]), ]),
text("scope_id"), text("scope_id"),
enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]), enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]),

View file

@ -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;

View file

@ -5,14 +5,10 @@
heading with a blurb and rule. Sections paint no background of heading with a blurb and rule. Sections paint no background of
their own: the page's (PageBackdrop.tsx) runs behind all of them. 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 admin editors' own (SectionNav), sticky under the header, listing
the sections with the one being read lit. It sits beside the the sections with the one being read lit. Below lg the menu lists
sections rather than taking a column from them, so they stay where the sections instead.
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.
Whatever goes inside a section is passed as `content`, the shell Whatever goes inside a section is passed as `content`, the shell
doesn't care what it is. 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); if (typeof title === "string") document.title = documentTitle(title);
}, [title]); }, [title]);
// The thin solid banner between sections, the page's full width // The thin solid banner between sections. With the side nav it runs
// (behind the side nav). // the page's full width, under the nav column, rather than stopping
const banner = (accent: string) => <div className="h-2" style={{ background: accent }} />; // at the content's edge.
const banner = (accent: string) => (
<div className={`h-2 ${sideNav ? "lg:-ml-[var(--side-nav-w)]" : ""}`} style={{ background: accent }} />
);
const bands = sections.map((section, i) => ( const bands = sections.map((section, i) => (
<div key={section.id}> <div key={section.id}>
{banner(section.accent)} {banner(section.accent)}
@ -133,17 +132,13 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
</div> </div>
{sideNav ? ( {sideNav ? (
<div className="relative"> <div className="[--side-nav-w:16rem] lg:grid lg:grid-cols-[var(--side-nav-w)_minmax(0,1fr)]">
{/* The margin left of the content (72rem, its text 1.5rem in). */} <aside className="relative z-10 hidden lg:block">
<aside <div className="sticky pt-8 pl-6 pr-2" style={{ top: "calc(var(--header-h, 5rem) + 1rem)" }}>
className="absolute inset-y-0 left-0 z-10 hidden min-[88rem]:block"
style={{ width: "calc((100% - 72rem) / 2 + 1rem)" }}
>
<div className="sticky pt-8 pl-4 pr-2" style={{ top: "calc(var(--header-h, 5rem) + 1rem)" }}>
<SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} wrap /> <SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} wrap />
</div> </div>
</aside> </aside>
{bands} <div className="min-w-0">{bands}</div>
</div> </div>
) : ( ) : (
bands bands

View file

@ -2,8 +2,7 @@
ORGANIZATION DETAILS ORGANIZATION DETAILS
NGU's own address, nonprofit status and contact email, shown in NGU's own address, nonprofit status and contact email, shown in
the footer (the Organization page's Details & Contact is its own the footer and in the Organization page's Details & Contact. The
blocks, Pages → Organization, seeded from these by migration 058). The
street address is where NGU is, not where to send post, and says street address is where NGU is, not where to send post, and says
so. so.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */

View file

@ -18,6 +18,7 @@ const PRESETS = {
partner_list: "Partner organization cards", partner_list: "Partner organization cards",
events: "Event carousel or grid", events: "Event carousel or grid",
timeline: "Timeline", timeline: "Timeline",
organization_details: "Address, tax ID and email",
}; };
const ACCENT_OPTIONS = [ const ACCENT_OPTIONS = [
@ -210,5 +211,5 @@ export const communityPage = sitePage(
export const retreatsPage = sitePage("retreats", "Retreats page", ["events"]); export const retreatsPage = sitePage("retreats", "Retreats page", ["events"]);
export const resourcesPage = sitePage("resources", "Resources page", []); export const resourcesPage = sitePage("resources", "Resources page", []);
export const organizationPage = sitePage("organization", "Organization page", []); export const organizationPage = sitePage("organization", "Organization page", ["organization_details"]);
export const historyPage = sitePage("history", "History page", ["timeline"]); export const historyPage = sitePage("history", "History page", ["timeline"]);

View file

@ -7,4 +7,4 @@
box or a build banner can read the same value later. box or a build banner can read the same value later.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
export const SITE_VERSION = "NGU-Web.v1.10.7"; export const SITE_VERSION = "NGU-Web.v1.10.6";

View file

@ -22,6 +22,7 @@ import { sitePage } from '../lib/site.ts'
import { useSectionManifest } from '../lib/sections.tsx' import { useSectionManifest } from '../lib/sections.tsx'
import { useSitePage, type SitePageSection } from '../lib/useSitePages.ts' import { useSitePage, type SitePageSection } from '../lib/useSitePages.ts'
import { useHistory } from '../lib/useHistory.ts' import { useHistory } from '../lib/useHistory.ts'
import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts'
import { HISTORY_DECADES } from '../data/historyDecades.ts' import { HISTORY_DECADES } from '../data/historyDecades.ts'
import { ACCENTS, BRAND } from '../lib/color.ts' import { ACCENTS, BRAND } from '../lib/color.ts'
import { scrollBehavior } from '../lib/motion.ts' import { scrollBehavior } from '../lib/motion.ts'
@ -78,6 +79,7 @@ const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>>
}, },
}), }),
timeline: () => ({ Component: Timeline }), timeline: () => ({ Component: Timeline }),
organization_details: () => ({ Component: OrganizationDetails }),
} }
export default function SitePage({ id }: { id: string }) { export default function SitePage({ id }: { id: string }) {
@ -183,3 +185,32 @@ function Timeline({ accent = BRAND }: { accent?: string }) {
</div> </div>
) )
} }
/* NGU's address, nonprofit status and email (src/data/organizationDetails.ts). */
function OrganizationDetails() {
const details = ORGANIZATION_DETAILS
return (
<div className="mx-auto grid max-w-6xl gap-8 px-6 md:grid-cols-2">
<div className="space-y-3 text-body">
<address className="not-italic leading-relaxed">
{details.street}
<br />
{details.cityLine}
<br />
<span className="text-sm text-muted">({details.addressNote})</span>
</address>
<p className="text-sm text-muted">
{details.nonprofit} Tax ID: {details.taxId}.
</p>
</div>
<div>
<a
href={`mailto:${details.email}`}
className="btn inline-block border border-link px-6 py-2.5 text-link transition-colors hover:bg-tint"
>
{details.email}
</a>
</div>
</div>
)
}