v1.14.0-profiles: profile accounts, drafts, page management, Planning Center #32

Merged
ngu-git-admin merged 15 commits from page-management into main 2026-10-28 07:00:10 +00:00
30 changed files with 716 additions and 216 deletions
Showing only changes of commit 0cc2a3f721 - Show all commits

View file

@ -61,7 +61,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
- All pages use `PageShell.tsx` as the wrapper unless explicitly noted otherwise.
- Pages live in `src/pages/`; section-level components go in `src/pages/sections/`.
- `src/data/` holds only hardcoded data shared across multiple section files (e.g. `historyDecades.ts`, map grid). Everything else comes from SQLite, through hooks in `src/lib/`.
- `navConfig.ts` is the single source of truth for navigation, routes, and actions (header, footer, pages).
- Navigation (header and footer links, page titles and intros, hidden pages) is edited in Pages → Navigation (`site_nav*` tables, `server/src/siteNav.js`, read through `src/lib/useSiteNav.ts`). `navConfig.ts` only holds the defaults the app starts from before that loads. Routes are in `App.tsx`; a static page's default title and intro in `site.json`'s `pages`. A hidden page answers Not found below viewer (server and app both).
- `api.ts` is the shared caching client used by frontend data hooks.
- `docs/updating-data-in-code.md`: where content that isn't in the database lives (admin dropdown labels, fixed value lists, nav, banner, decades, map grid) and how to change it. Keep it current when adding a dropdown or code-owned content.
- Images: every record image (logos, photos, backgrounds, block images) is an upload, in a folder by use: `/uploads/logos/`, `/uploads/images/`, `/uploads/thumbnails/` (saved previews), `/uploads/captions/` (videos' .vtt files); a logo or icon image field sets `folder: "logos"` (`docs/media-uploads.md`, Folders). A bare filename resolves to `/uploads/<file>` (`src/lib/media.ts`, and `server/src/pageMeta.js` for previews). Only the site's own chosen assets, the NGU logos in the nav, footer and admin, are bundled from `src/assets/logos/`. Logo images hide themselves on load error (`onError`).

View file

@ -247,8 +247,8 @@ const FRONT_PAGE_SECTIONS = [
The subnav links jump to each band by its anchor: the `id` passed in
each band's `render` in `Home.tsx` (`#retreats`, `#calendar`,
`#numbers`, `#connect`, and `#hero` for the hero). If you rename a
subnav label in `navConfig.ts`, leave its `hash` alone unless you also
change the band's `id`.
heading in Front page → Sections, its anchor stays: leave the band's
`id` alone unless you mean to break links to it.
**Adding a new kind of band** (not just renaming one) is a feature,
not a relabel: it needs a component, an entry in `SECTIONS` in
@ -278,7 +278,7 @@ The numbers band's "Number Source" dropdown works the same way:
| What | File | Notes |
| --- | --- | --- |
| Header and footer navigation, each page's sections (the header dropdowns, mobile menu and footer site map) | `src/navConfig.ts` | `PAGE_LINKS` (order), `NAV_ACTIONS`. Each page's sections aren't listed there: they follow the page itself, through `src/lib/navSections.ts` (the site pages' sections from Admin → Pages; the front page's bands it shows, with `src/lib/frontPageBands.ts` giving each band's anchor and default heading). A new page also needs a route in `src/App.tsx`. |
| Header and footer navigation, each page's sections (the header dropdowns, mobile menu and footer site map) | Admin → Pages → Navigation (the database, `075_site_nav.sql`); `src/navConfig.ts` is only the defaults the app starts from before it loads | Links: where each shows (header pages, header buttons, footer Get in Touch, footer bottom row), order, label, a header page set under another's menu, a filled button, new tab. Pages: title, intro and Hidden (Not found below viewer, out of the menus and the sitemap; `server/src/siteNav.js`). Each page's sections aren't listed there: they follow the page itself, through `src/lib/navSections.ts` (the site pages' sections from Admin → Pages; the front page's bands it shows, with `src/lib/frontPageBands.ts` giving each band's anchor and default heading). A new static page needs a route in `src/App.tsx` and an entry in `site.json`'s `pages` (its default title and intro, and what Navigation's Page select offers); a new page of sections also needs its id in `site_pages`' CHECK and a descriptor in both admin schemas, like Shop (075). |
| Section titles, blurbs and colors on Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. |
| Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. |
| History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |

View file

@ -53,6 +53,7 @@ import { timeline } from "./admin-schema/timeline.js";
import { frontPage } from "./admin-schema/frontPage.js";
import { blogPosts } from "./admin-schema/blog.js";
import { siteSettings } from "./admin-schema/siteSettings.js";
import { siteNav } from "./admin-schema/siteNav.js";
import { newsletters } from "./admin-schema/newsletters.js";
import { personTagTypes } from "./admin-schema/personTags.js";
import { tags } from "./admin-schema/tags.js";
@ -64,6 +65,7 @@ import {
resourcesPage,
organizationPage,
historyPage,
shopPage,
} from "./admin-schema/sitePages.js";
export const ENTITIES = {
@ -84,6 +86,8 @@ export const ENTITIES = {
resources_page: resourcesPage,
organization_page: organizationPage,
history_page: historyPage,
shop_page: shopPage,
navigation: siteNav,
site_settings: siteSettings,
newsletters,
};

View file

@ -0,0 +1,44 @@
import { text, bool, enumeration } from "./columns.js";
/* ── Navigation (075_site_nav.sql) ───────────────────────────────
Pages → Navigation: the header's and footer's links, in order,
and each static page's title, intro and whether it's hidden
(siteNav.js reads it for the site). Admins and up: it can take a
page off the site. */
export const siteNav = {
key: "navigation",
table: "site_nav",
idColumn: "id",
idKind: "slug",
singleton: "site",
concurrency: "updated_at",
writeRole: "admin",
list: { columns: ["id", "updated_at"], filters: [], search: [], order: "id" },
columns: [],
children: [
{
key: "links",
table: "site_nav_links",
owner: { column: "nav_id" },
order: "sort_order",
columns: [
enumeration("place", ["main", "action", "footer", "legal"], { required: true }),
text("label", { required: true }),
text("path", { required: true }),
text("parent_path"),
enumeration("style", ["filled"]),
bool("new_tab"),
],
},
{
key: "pages",
table: "site_nav_pages",
owner: { column: "nav_id" },
order: "sort_order",
columns: [text("path", { required: true }), text("title"), text("description"), bool("is_hidden")],
},
],
};

View file

@ -2,7 +2,8 @@ import { text, url, int, enumeration, featuredCardsChild, blocksChild } from "./
/* ── The site's own pages (056_site_pages.sql) ───────────────────
Community, Retreats, Resources, Organization and History: one
Community, Retreats, Resources, Organization, History and Shop
(075): 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
@ -106,3 +107,4 @@ export const retreatsPage = sitePage("retreats");
export const resourcesPage = sitePage("resources");
export const organizationPage = sitePage("organization");
export const historyPage = sitePage("history");
export const shopPage = sitePage("shop");

View file

@ -3,8 +3,9 @@ import { text, enumeration } from "./columns.js";
/* ── Site settings (035_site_settings.sql) ──────────────────────
A singleton of overrides for what site.json says: name,
description, preview image, icons, search indexing, and static
pages' titles and intros. Superadmins only. pageMeta.js merges it
description, preview image, icons and search indexing (static
pages' titles and intros are Pages → Navigation's, siteNav.js).
Superadmins only. pageMeta.js merges it
over site.json. */
export const siteSettings = {
key: "site_settings",
@ -39,13 +40,6 @@ export const siteSettings = {
],
children: [
{
key: "pages",
table: "site_setting_pages",
owner: { column: "settings_id" },
order: "sort_order",
columns: [text("path", { required: true }), text("title"), text("description")],
},
{
key: "colors",
table: "site_setting_colors",

View file

@ -0,0 +1,122 @@
-- ═══════════════════════════════════════════════════════════════
-- 075 SITE NAVIGATION
--
-- Pages → Navigation edits what navConfig.ts used to fix in code:
-- the header's links and buttons, the footer's, and each page's
-- title, intro and whether it is hidden. navConfig.ts stays as the
-- defaults the app starts from before this arrives.
--
-- site_nav the editor's one row ('site')
-- site_nav_links every link, in order, by where it shows:
-- main the header's pages (sections drop
-- down under each); with a parent, in
-- that page's dropdown instead
-- action the header's buttons, right side
-- (and the phone menu's list under
-- the pages); a filled one also sits
-- beside the footer's logo
-- footer the footer's Get in Touch list
-- legal the footer's bottom row
-- site_nav_pages a static page's title and intro (the page's
-- heading and its search text) over site.json's,
-- and is_hidden: a hidden page is out of the nav
-- and the sitemap and answers Not found to anyone
-- below viewer (pageMeta.js, siteNav.js)
--
-- site_setting_pages (Site settings → Page titles and intros) moves
-- into site_nav_pages and is dropped.
--
-- The Shop page: site_pages takes 'shop' (a page of sections like
-- the others), rebuilt since its CHECK can't change in place. It
-- starts hidden, with its header button.
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE site_nav (
id TEXT PRIMARY KEY CHECK (id = 'site'),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
) STRICT;
INSERT INTO site_nav (id) VALUES ('site');
CREATE TABLE site_nav_links (
id INTEGER PRIMARY KEY AUTOINCREMENT,
nav_id TEXT NOT NULL REFERENCES site_nav (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
place TEXT NOT NULL CHECK (place IN ('main', 'action', 'footer', 'legal')),
label TEXT NOT NULL,
-- '/retreats', '/organization#contact', or an https:// address
path TEXT NOT NULL,
-- main links only: the page whose dropdown it sits in
parent_path TEXT,
-- action links only: null is the outlined button
style TEXT CHECK (style IN ('filled')),
new_tab INTEGER NOT NULL DEFAULT 0 CHECK (new_tab IN (0, 1))
) STRICT;
CREATE INDEX site_nav_links_order_idx ON site_nav_links (nav_id, sort_order);
INSERT INTO site_nav_links (nav_id, sort_order, place, label, path, parent_path, style, new_tab) VALUES
('site', 0, 'main', 'Home', '/', NULL, NULL, 0),
('site', 1, 'main', 'Retreats', '/retreats', NULL, NULL, 0),
('site', 2, 'main', 'Community', '/community', NULL, NULL, 0),
('site', 3, 'main', 'Resources', '/resources', NULL, NULL, 0),
('site', 4, 'main', 'Organization', '/organization', NULL, NULL, 0),
('site', 5, 'main', 'History', '/history', NULL, NULL, 0),
('site', 6, 'action', 'Shop', '/shop', NULL, NULL, 0),
('site', 7, 'action', 'Contact Us', '/organization#contact', NULL, NULL, 0),
('site', 8, 'action', 'Give', '/give', NULL, 'filled', 1),
('site', 9, 'footer', 'Feedback', '/feedback', NULL, NULL, 0),
('site', 10, 'footer', 'Request', '/request', NULL, NULL, 0),
('site', 11, 'footer', 'Contact Us', '/organization#contact', NULL, NULL, 0),
('site', 12, 'legal', 'Privacy Policy', '/privacy', NULL, NULL, 0),
('site', 13, 'legal', 'Terms of Service', '/terms', NULL, NULL, 0);
CREATE TABLE site_nav_pages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
nav_id TEXT NOT NULL REFERENCES site_nav (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
path TEXT NOT NULL, -- '/retreats', a key of site.json's pages
title TEXT, -- null: site.json's
description TEXT, -- null: site.json's
is_hidden INTEGER NOT NULL DEFAULT 0 CHECK (is_hidden IN (0, 1)),
UNIQUE (nav_id, path)
) STRICT;
INSERT INTO site_nav_pages (nav_id, sort_order, path, title, description)
SELECT 'site', sort_order, path, title, description
FROM site_setting_pages WHERE settings_id = 'site';
INSERT INTO site_nav_pages (nav_id, sort_order, path, is_hidden)
VALUES ('site', (SELECT coalesce(max(sort_order) + 1, 0) FROM site_nav_pages), '/shop', 1);
DROP TABLE site_setting_pages;
-- site_pages, with 'shop'.
CREATE TABLE site_pages_new (
id TEXT PRIMARY KEY
CHECK (id IN ('community', 'retreats', 'resources', 'organization', 'history', 'shop')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
) STRICT;
INSERT INTO site_pages_new (id, updated_at) SELECT id, updated_at FROM site_pages;
INSERT INTO site_pages_new (id) VALUES ('shop');
-- page_sections names site_pages; legacy mode leaves it alone
-- through the rename.
PRAGMA legacy_alter_table = ON;
DROP TABLE site_pages;
ALTER TABLE site_pages_new RENAME TO site_pages;
PRAGMA legacy_alter_table = OFF;
CREATE TRIGGER site_nav_touch
AFTER UPDATE ON site_nav
FOR EACH ROW WHEN new.updated_at = old.updated_at
BEGIN
UPDATE site_nav SET updated_at = datetime('now') WHERE id = new.id;
END;
CREATE TRIGGER site_pages_touch
AFTER UPDATE ON site_pages
FOR EACH ROW WHEN new.updated_at = old.updated_at
BEGIN
UPDATE site_pages SET updated_at = datetime('now') WHERE id = new.id;
END;

View file

@ -15,7 +15,8 @@
/site.json (SITE_CONFIG): the site's name, address, default
description and image, icons, and each static page's title and
description. Laid over it: Panel → Site settings (the
site_settings table, 035), where anything set wins and anything
site_settings table, 035) and Pages → Navigation's page titles
(site_nav_pages, 075), where anything set wins and anything
blank falls back to site.json. siteFor(db) does the merge. The
pages read the same merged values (renderPage writes them into
the HTML as window.__SITE__, see src/lib/site.ts), so a
@ -28,6 +29,8 @@
published, listed indexed, in the sitemap
published, unlisted noindex: reachable by link, not by search
unpublished, missing 404 and noindex, with the site defaults
a hidden static page 404 and noindex below viewer, out of the
sitemap (siteNav.js)
/admin noindex
Image paths resolve like src/lib/media.ts does: a bare filename
@ -44,6 +47,7 @@ import { fileURLToPath } from "node:url";
import { loadBlocks, paragraphs } from "./shape.js";
import { themeCss } from "./theme.js";
import { driveReady } from "./googleService.js";
import { hiddenFrom, hiddenPaths, navFor } from "./siteNav.js";
const here = path.dirname(fileURLToPath(import.meta.url));
@ -71,15 +75,15 @@ const origin = (site) => (site.url ?? "").replace(/\/$/, "");
/* site.json with the admin's Site settings laid over it: a value set
there wins, a blank one falls back. indexing 'on' / 'off' overrides
robots.index for this database only. Page overrides apply only to
pages site.json knows. */
robots.index for this database only. Page overrides (Pages →
Navigation) apply only to pages site.json knows. */
export function siteFor(db) {
const base = loadSite();
const row = db.prepare(`SELECT * FROM site_settings WHERE id = 'site'`).get() ?? {};
const pages = { ...(base.pages ?? {}) };
const overrides = db
.prepare(`SELECT path, title, description FROM site_setting_pages WHERE settings_id = 'site'`)
.prepare(`SELECT path, title, description FROM site_nav_pages WHERE nav_id = 'site'`)
.all();
for (const page of overrides) {
const known = pages[page.path];
@ -112,13 +116,15 @@ export function siteFor(db) {
};
}
/* What the browser app reads for headings and titles. */
// requestFiles: whether the Request form can take files (Drive set up).
const forBrowser = (site) => ({
/* What the browser app reads for headings, titles and its menus.
requestFiles: whether the Request form can take files (Drive set
up). nav: this visitor's links and the hidden pages (siteNav.js). */
const forBrowser = (site, nav) => ({
title: site.title,
pages: site.pages,
privacyEmail: site.privacyEmail,
requestFiles: driveReady(),
nav,
});
/* robots.txt for this database's setting, as the build writes it. */
@ -358,12 +364,13 @@ function blogMeta(site, db, id, meta) {
};
}
/* The metadata for one request path. */
export function metaFor(db, rawPath) {
/* The metadata for one request path, for this visitor (the signed-in
user or null, who decides whether a hidden page is there). */
export function metaFor(db, rawPath, user = null) {
const site = siteFor(db);
// Canonical form: no trailing slash (but "/" itself), no query.
const pathname = rawPath.split(/[?#]/)[0].replace(/(.)\/+$/, "$1") || "/";
const meta = defaults(site, db, pathname);
const meta = { ...defaults(site, db, pathname), nav: navFor(db, user) };
if (pathname === "/") {
// The home page's data, and its first hero photo when the hero is
@ -396,6 +403,7 @@ export function metaFor(db, rawPath) {
if (/^\/admin(\/|$)/.test(pathname)) return { ...meta, title: `Admin | ${site.title}`, noindex: true };
const page = site.pages?.[pathname];
if (page && hiddenFrom(db, user, pathname)) return notFound(meta);
if (page) {
return { ...meta, title: titled(site, page.title), description: plainText(page.description) ?? meta.description };
}
@ -520,7 +528,7 @@ export function renderPage(html, meta) {
),
// Read by src/lib/site.ts before the app's module runs (a plain
// script in the head runs during parsing; modules wait).
`<script>window.__SITE__ = ${scriptJson(forBrowser(site))}</script>`,
`<script>window.__SITE__ = ${scriptJson(forBrowser(site, meta.nav))}</script>`,
site.themeCss && `<style id="site-colors">${site.themeCss}</style>`,
analyticsTag(site),
].filter(Boolean);
@ -542,10 +550,13 @@ export function sitemap(db) {
const site = siteFor(db);
const base = origin(site);
const day = (value) => (value ? String(value).slice(0, 10) : null);
const hidden = hiddenPaths(db);
const entries = [
{ loc: "/" },
...Object.keys(site.pages ?? {}).map((loc) => ({ loc })),
...Object.keys(site.pages ?? {})
.filter((loc) => !hidden.has(loc))
.map((loc) => ({ loc })),
...db
.prepare(`SELECT id, updated_at FROM events WHERE is_published = 1 AND is_listed = 1`)
.all()

View file

@ -7,7 +7,8 @@
can say no while production says yes
GET /anything the built index.html, its title, description,
preview image, canonical link and structured
data filled in for that path (pageMeta.js)
data filled in for that path (pageMeta.js),
and this visitor's menus (siteNav.js)
In production nginx serves files that exist (the JS, CSS,
uploads) itself and sends everything else here, so a shared link
@ -35,6 +36,7 @@ import { fileURLToPath } from "node:url";
import { Hono } from "hono";
import { currentUser } from "../auth.js";
import { metaFor, renderPage, robotsTxt, siteFor, sitemap } from "../pageMeta.js";
import { CACHE, NO_STORE } from "../shape.js";
@ -109,7 +111,8 @@ pages.get("*", (c, next) => {
let meta;
let page;
try {
meta = metaFor(c.get("db"), pathname);
// Who's asking decides whether a hidden page is there (siteNav.js).
meta = metaFor(c.get("db"), pathname, currentUser(c.get("db"), c));
page = renderPage(html, meta);
} catch (err) {
warnOnce(

View file

@ -1,11 +1,15 @@
/* ═══════════════════════════════════════════════════════════════
SITE PAGE ROUTES: read-only, mounted under /api
GET /nav this visitor's header and footer links and
the hidden pages (siteNav.js); not cached,
since it depends on who's signed in
GET /site-pages every site page's section headings, for
the header's dropdowns and the side nav
GET /site-pages/:id one page's sections, in order: heading,
accent, preset (and an events preset's
filter and view), and its blocks
filter and view), and its blocks; Not
found for a hidden page, below viewer
Edited in the admin as Pages → each page
(admin-schema/sitePages.js). Blocks are shaped as on any record
@ -13,10 +17,17 @@
═══════════════════════════════════════════════════════════════ */
import { Hono } from "hono";
import { json, loadBlocks } from "../shape.js";
import { currentUser } from "../auth.js";
import { hiddenPaths, navFor, seesHidden } from "../siteNav.js";
import { NO_STORE, json, loadBlocks } from "../shape.js";
const sitePages = new Hono();
sitePages.get("/nav", (c) => {
const db = c.get("db");
return c.json({ nav: navFor(db, currentUser(db, c)) }, 200, NO_STORE);
});
sitePages.get("/site-pages", (c) => {
const rows = c
.get("db")
@ -31,7 +42,8 @@ sitePages.get("/site-pages", (c) => {
sitePages.get("/site-pages/:id", (c) => {
const db = c.get("db");
const id = c.req.param("id");
if (!db.prepare(`SELECT 1 FROM site_pages WHERE id = ?`).get(id)) {
const hidden = hiddenPaths(db).has(`/${id}`);
if (!db.prepare(`SELECT 1 FROM site_pages WHERE id = ?`).get(id) || (hidden && !seesHidden(currentUser(db, c)))) {
return c.json({ error: "No such page." }, 404);
}
@ -53,7 +65,9 @@ sitePages.get("/site-pages/:id", (c) => {
picked.set(section_id, [...(picked.get(section_id) ?? []), org_id]);
}
return json(c, {
// A hidden page is only for those signed in: never kept.
const send = hidden ? (body) => c.json(body, 200, NO_STORE) : (body) => json(c, body);
return send({
page: {
id,
sections: rows.map(({ id: sectionId, ...section }) => ({

65
server/src/siteNav.js Normal file
View file

@ -0,0 +1,65 @@
/* ═══════════════════════════════════════════════════════════════
SITE NAVIGATION
Pages → Navigation (075_site_nav.sql): the header's and footer's
links, and which static pages are hidden. Read by pageMeta.js
(window.__SITE__, the page's status, the sitemap) and served as
GET /api/nav for the app (routes/sitePages.js).
A hidden page answers Not found to anyone below viewer, and its
links are left out of what they're sent; a viewer and up sees
both, and the page says it's hidden (Layout.tsx). Who's asking
is the session cookie, so the same page can be hidden from one
visitor and shown to the next: the HTML is no-cache already.
═══════════════════════════════════════════════════════════════ */
import { hasRole } from "./auth.js";
/* Who sees hidden pages. */
export const SEES_HIDDEN = "viewer";
export const seesHidden = (user) => hasRole(user, SEES_HIDDEN);
/* The paths whose pages are hidden, eg. '/shop'. */
export function hiddenPaths(db) {
return new Set(
db
.prepare(`SELECT path FROM site_nav_pages WHERE nav_id = 'site' AND is_hidden = 1`)
.all()
.map((row) => row.path),
);
}
/* A link's page: its path without the #section or ?query, or null
for an address off the site. */
const pageOf = (href) => (/^\//.test(href) ? href.split(/[?#]/)[0].replace(/(.)\/+$/, "$1") : null);
/* Whether this path's page is one the user can't see. */
export function hiddenFrom(db, user, pathname) {
return !seesHidden(user) && hiddenPaths(db).has(pageOf(pathname));
}
/* What the app draws its menus from: every link this user may
follow, and the hidden pages' paths (so the app can answer Not
found, or say a page is hidden, without asking again). */
export function navFor(db, user) {
const hidden = hiddenPaths(db);
const sees = seesHidden(user);
const links = db
.prepare(
`SELECT place, label, path, parent_path, style, new_tab
FROM site_nav_links WHERE nav_id = 'site' ORDER BY sort_order, id`,
)
.all()
.filter((link) => sees || !hidden.has(pageOf(link.path)))
.map((link) => ({
place: link.place,
label: link.label,
path: link.path,
parent: link.parent_path || null,
filled: link.style === "filled",
newTab: link.new_tab === 1,
}));
return { links, hidden: [...hidden], seesHidden: sees };
}

View file

@ -54,6 +54,10 @@
"title": "Privacy Policy",
"description": "How Next Generation of Unity collects, uses, and protects your information."
},
"/shop": {
"title": "Shop",
"description": "Shirts, stickers and more from Next Generation of Unity. Every purchase supports our retreats and programs."
},
"/terms": {
"title": "Terms of Service",
"description": "The terms that apply when you use this site and our programs."

View file

@ -49,8 +49,8 @@ const lazyPage = (load) =>
throw err
}),
)
// Community, Retreats, Resources, Organization and History: each
// built in the admin from sections.
// Community, Retreats, Resources, Organization, History and Shop:
// each built in the admin from sections.
const SitePage = lazyPage(() => import("./pages/SitePage.tsx"))
const Feedback = lazyPage(() => import("./pages/Feedback.tsx"))
const Request = lazyPage(() => import("./pages/Request.tsx"))
@ -107,6 +107,7 @@ export default function App() {
<Route path="organization" element={<SitePage key="organization" id="organization" />} />
<Route path="resources" element={<SitePage key="resources" id="resources" />} />
<Route path="history" element={<SitePage key="history" id="history" />} />
<Route path="shop" element={<SitePage key="shop" id="shop" />} />
<Route path="feedback" element={<Feedback />} />
<Route path="request" element={<Request />} />
<Route path="qr" element={<QrCodes />} />

View file

@ -1,31 +1,16 @@
import { Link } from "react-router-dom";
import { PAGE_LINKS, NAV_ACTIONS } from "../navConfig.ts";
import { useNavSections } from "../lib/navSections.ts";
import { useSiteNav } from "../lib/useSiteNav.ts";
import SiteLink from "./SiteLink.tsx";
import siteLogo from "../assets/logos/NGU_Logo.svg";
import PlatformIcon from "./PlatformIcon.tsx";
import { ORGANIZATION_DETAILS as Organization_Details } from "../data/organizationDetails.ts";
import { SOCIAL_LINKS } from "../data/socialLinks.ts";
// Give's destination lives in navConfig so the footer and the nav can't drift.
// Only the label differs down here.
const giveAction = NAV_ACTIONS.find((a) => a.variant === "fancy");
/* An internal route, or an off-site address opened in a new tab. */
type TouchLink = { label: string } & (
| { external?: false; to: string }
| { external: true; href: string }
);
const Get_In_Touch: TouchLink[] = [
{ label: "Feedback", to: "/feedback"},
{ label: "Request", to: "/request" },
{ label: "Contact Us", to: "/organization#contact" },
];
const Footer_Links = [
{ label: "Privacy Policy", to: "/privacy" },
{ label: "Terms of Service", to: "/terms" },
];
/* Every link here is Pages → Navigation's (useSiteNav): the filled
header buttons (Give) beside the logo, Get in Touch, the site map
(the header's pages, their sections and the pages set under them)
and the bottom row. */
const footerLinkClass =
"text-white/65 hover:text-[var(--pal-green-2)] text-sm transition-colors";
@ -41,6 +26,7 @@ const headingClass = "text-white/90 text-sm font-semibold mb-4";
export default function Footer() {
const sectionsOf = useNavSections();
const nav = useSiteNav();
return (
<footer className="py-16 px-6" style={{ background: "#001011" }}>
<div className="max-w-6xl mx-auto">
@ -53,17 +39,18 @@ export default function Footer() {
<Link to="/" className="inline-block">
<img src={siteLogo} alt="Next Generation of Unity" className="h-14 w-auto" />
</Link>
{giveAction && (
<a
href={giveAction.to}
target="_blank"
rel="noopener noreferrer"
{nav.actions
.filter((action) => action.filled)
.map((action) => (
<SiteLink
key={`${action.label}${action.path}`}
link={action}
className="btn inline-block whitespace-nowrap px-6 py-2.5 text-sm text-white transition-transform duration-200 hover:-translate-y-0.5"
style={{ background: "var(--color-action)" }}
>
{giveAction.label}
</a>
)}
{action.label}
</SiteLink>
))}
</div>
<address className="mt-5 not-italic text-sm leading-relaxed text-white/60">
@ -100,22 +87,11 @@ export default function Footer() {
<h2 className={headingClass}>Get in Touch</h2>
<ul className="flex flex-col gap-3">
{Get_In_Touch.map((link) => (
<li key={link.label}>
{link.external ? (
<a
href={link.href}
target="_blank"
rel="noopener noreferrer"
className={pageLinkClass}
>
{nav.footer.map((link) => (
<li key={`${link.label}${link.path}`}>
<SiteLink link={link} className={pageLinkClass}>
{link.label}
</a>
) : (
<Link to={link.to} className={pageLinkClass}>
{link.label}
</Link>
)}
</SiteLink>
</li>
))}
</ul>
@ -126,13 +102,25 @@ export default function Footer() {
<nav aria-label="Site map" className="mb-12 border-t border-white/10 pt-10">
<h2 className={headingClass}>Site Map</h2>
<ul className="grid grid-cols-2 gap-x-6 gap-y-6 sm:grid-cols-3 lg:grid-cols-6">
{PAGE_LINKS.map((page) => {
{nav.main.map((page) => {
const sections = sectionsOf(page.path);
return (
<li key={page.path}>
<Link to={page.path} className={pageLinkClass}>
<SiteLink link={page} className={pageLinkClass}>
{page.label}
</Link>
</SiteLink>
{page.children.length > 0 && (
<ul className="flex flex-col">
{page.children.map((child) => (
<li key={child.path}>
<SiteLink link={child} className={pageLinkClass}>
{child.label}
</SiteLink>
</li>
))}
</ul>
)}
{sections.length > 0 && (
<ul className="mt-1 flex flex-col">
@ -157,10 +145,10 @@ export default function Footer() {
<div className="border-t border-white/10 pt-8 flex flex-col md:flex-row items-center justify-between gap-4">
<p className="text-white/65 text-sm">© 2026 Next Generation of Unity. All rights reserved.</p>
<div className="flex gap-6">
{Footer_Links.map((link) => (
<Link key={link.label} to={link.to} className={footerLinkClass}>
{nav.legal.map((link) => (
<SiteLink key={`${link.label}${link.path}`} link={link} className={footerLinkClass}>
{link.label}
</Link>
</SiteLink>
))}
</div>
</div>

View file

@ -1,8 +1,10 @@
import { X, List } from "@phosphor-icons/react";
import { Suspense, useState, useEffect, useRef } from "react";
import { X, List, EyeSlash } from "@phosphor-icons/react";
import { lazy, Suspense, useState, useEffect, useRef } from "react";
import { NavLink, Link, Outlet, useLocation } from "react-router-dom";
import { PAGE_LINKS, NAV_ACTIONS } from "../navConfig.ts";
import type { NavLink as NavLinkItem } from "../navConfig.ts";
import { useNavSections } from "../lib/navSections.ts";
import { useSiteNav } from "../lib/useSiteNav.ts";
import SiteLink from "./SiteLink.tsx";
import Banner from "./Banner.tsx";
import siteLogo from "../assets/logos/NGU_Logo.svg";
import Footer from "./Footer.tsx";
@ -14,25 +16,20 @@ import ThemeToggle from "./ThemeToggle.tsx";
import { jumpTo } from "../lib/focus.ts";
import { useReadingMode } from "../lib/readingMode.ts";
/* ── Right-side nav actions ──────────────────────────────── */
const NotFound = lazy(() => import("../pages/NotFound.tsx"));
type NavActionItem = {
label: string;
to: string;
variant: string;
external?: boolean;
};
/* ── Right-side nav actions ──────────────────────────────── */
const ACTION_VARIANTS: Record<
string,
{ className: string; style: React.CSSProperties }
> = {
ghost: {
outline: {
className:
"font-semibold border border-white/30 text-white/85 hover:border-white/60 hover:text-white hover:bg-white/10",
style: {},
},
fancy: {
filled: {
className: "font-bold text-white hover:scale-105",
style: { background: "var(--color-action)" },
},
@ -48,33 +45,20 @@ function NavAction({
size = "desktop",
onClick,
}: {
item: NavActionItem;
item: NavLinkItem;
size?: keyof typeof ACTION_SIZES;
onClick?: () => void;
}) {
const v = ACTION_VARIANTS[item.variant] ?? ACTION_VARIANTS.ghost;
const v = ACTION_VARIANTS[item.filled ? "filled" : "outline"];
const className = `inline-block whitespace-nowrap btn transition-all duration-200 active:scale-[0.98] ${ACTION_SIZES[size]} ${v.className}`;
return item.external ? (
<a
href={item.to}
target="_blank"
rel="noopener noreferrer"
className={className}
style={v.style}
onClick={onClick}
>
return (
<SiteLink link={item} className={className} style={v.style} onClick={onClick}>
{item.label}
</a>
) : (
<Link to={item.to} className={className} style={v.style} onClick={onClick}>
{item.label}
</Link>
</SiteLink>
);
}
const navActions = NAV_ACTIONS as NavActionItem[];
/* ── Layout ──────────────────────────────────────────────── */
export default function Layout() {
@ -95,6 +79,20 @@ export default function Layout() {
const pageRef = useRef<HTMLDivElement>(null);
const sectionsOf = useNavSections();
const nav = useSiteNav();
// A hidden page (Pages → Navigation) is Not found below viewer; a
// viewer and up sees it, under a bar saying so. The server answers
// the same (server/src/siteNav.js); this covers the app's own moves.
const hiddenHere = nav.isHidden(location.pathname);
const page = (
<Suspense fallback={null}>{hiddenHere && !nav.seesHidden ? <NotFound /> : <Outlet />}</Suspense>
);
const hiddenBar = hiddenHere && nav.seesHidden && (
<p className="flex items-center justify-center gap-2 bg-tint px-6 py-2 text-center text-sm text-ink print:hidden">
<EyeSlash size={18} weight="bold" aria-hidden="true" />
This page is hidden: only signed-in admin accounts can see it. Show it in Pages → Navigation.
</p>
);
// Close the mobile menu whenever the route changes
useEffect(() => {
@ -177,9 +175,7 @@ export default function Layout() {
<main id="main" tabIndex={-1} className="outline-none">
<ReaderView source={pageRef} />
<div ref={pageRef} hidden>
<Suspense fallback={null}>
<Outlet />
</Suspense>
{page}
</div>
</main>
<AccessibilityPanel />
@ -221,14 +217,15 @@ export default function Layout() {
none: it's the logo's link too, and its bands are one
scroll away. */}
<div className="hidden lg:flex items-center gap-6">
{PAGE_LINKS.map((page) => {
{nav.main.map((page) => {
const pageSections = page.path === "/" ? [] : sectionsOf(page.path);
const hasMenu = pageSections.length > 0 || page.children.length > 0;
return (
<div
key={page.path}
className="group relative"
onKeyDown={(e) => {
if (e.key !== "Escape" || pageSections.length === 0) return;
if (e.key !== "Escape" || !hasMenu) return;
setDismissed(page.path);
e.currentTarget.querySelector("a")?.focus();
}}
@ -250,7 +247,7 @@ export default function Layout() {
>
{page.label}
</NavLink>
{pageSections.length > 0 && (
{hasMenu && (
// 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
@ -276,6 +273,17 @@ export default function Layout() {
</Link>
</li>
))}
{/* Pages set under this one (Pages → Navigation), after its sections. */}
{page.children.map((child) => (
<li key={child.path}>
<SiteLink
link={child}
className="block px-4 py-2 text-sm font-semibold text-white/90 transition-colors hover:bg-white/10 hover:text-[var(--pal-amber-2)] focus-visible:bg-white/10"
>
{child.label}
</SiteLink>
</li>
))}
</ul>
</div>
)}
@ -287,8 +295,8 @@ export default function Layout() {
<div className="flex items-center gap-4">
<div className="hidden lg:flex items-center gap-3">
{navActions.map((item) => (
<NavAction key={item.label} item={item} />
{nav.actions.map((item) => (
<NavAction key={`${item.label}${item.path}`} item={item} />
))}
</div>
@ -315,9 +323,8 @@ export default function Layout() {
{/* Page content */}
<main id="main" tabIndex={-1} className="outline-none" inert={mobileMenuOpen}>
<Suspense fallback={null}>
<Outlet />
</Suspense>
{hiddenBar}
{page}
</main>
{/*Site Footer applied to every page*/}
@ -346,7 +353,7 @@ export default function Layout() {
</button>
<div className="w-64">
{PAGE_LINKS.map((page) => {
{nav.main.map((page) => {
const pageSections = sectionsOf(page.path);
const isActive = location.pathname === page.path;
@ -364,6 +371,22 @@ export default function Layout() {
{page.label}
</NavLink>
{/* Pages set under this one (Pages → Navigation) */}
{page.children.length > 0 && (
<div className="ml-3 pl-4 mb-2 flex flex-col">
{page.children.map((child) => (
<SiteLink
key={child.path}
link={child}
className="text-white text-xl font-bold py-2 hover:text-[var(--pal-amber-2)] transition-colors"
onClick={() => setMobileMenuOpen(false)}
>
{child.label}
</SiteLink>
))}
</div>
)}
{/* Sections nest under the page they belong to */}
{isActive && pageSections.length > 0 && (
<div
@ -388,9 +411,9 @@ export default function Layout() {
</div>
<div className="mt-8 flex flex-col items-center gap-3">
{navActions.map((item) => (
{nav.actions.map((item) => (
<NavAction
key={item.label}
key={`${item.label}${item.path}`}
item={item}
size="mobile"
onClick={() => setMobileMenuOpen(false)}

View file

@ -40,7 +40,7 @@
import { Fragment, useEffect, useState, type ReactNode, type RefObject } from 'react'
import { Link } from 'react-router-dom'
import { PAGE_LINKS } from '../navConfig.ts'
import { useSiteNav } from '../lib/useSiteNav.ts'
type Inline = string | { href: string; children: Inline[] }
@ -240,6 +240,7 @@ function Anchor({ href, children }: { href: string; children: ReactNode }) {
export default function ReaderView({ source }: { source: RefObject<HTMLElement | null> }) {
const [blocks, setBlocks] = useState<Block[]>([])
const { main: pages } = useSiteNav()
useEffect(() => {
const root = source.current
@ -264,7 +265,7 @@ export default function ReaderView({ source }: { source: RefObject<HTMLElement |
return (
<article className="reader">
<p>
{PAGE_LINKS.map((page, i) => (
{pages.map((page, i) => (
<span key={page.path}>
{i > 0 && ' · '}
<Link to={page.path}>{page.label}</Link>

View file

@ -0,0 +1,30 @@
import { Link } from 'react-router-dom'
import type { NavLink } from '../navConfig.ts'
/* A nav link (Pages → Navigation): a route on the site, or a plain
link for an address off it or one set to open in a new tab. */
export default function SiteLink({
link,
children,
...rest
}: {
link: NavLink
children: React.ReactNode
className?: string
style?: React.CSSProperties
onClick?: () => void
}) {
if (!link.path.startsWith('/') || link.newTab) {
return (
<a href={link.path} {...(link.newTab ? { target: '_blank', rel: 'noopener noreferrer' } : {})} {...rest}>
{children}
</a>
)
}
return (
<Link to={link.path} {...rest}>
{children}
</Link>
)
}

View file

@ -27,6 +27,7 @@ import { timeline } from "./adminSchema/timeline.ts";
import { frontPage } from "./adminSchema/frontPage.ts";
import { blogPosts } from "./adminSchema/blog.ts";
import { siteSettings } from "./adminSchema/siteSettings.ts";
import { siteNav } from "./adminSchema/siteNav.ts";
import { personTagTypes } from "./adminSchema/personTags.ts";
import { tags } from "./adminSchema/tags.ts";
import { contactTypes } from "./adminSchema/contactTypes.ts";
@ -37,6 +38,7 @@ import {
resourcesPage,
organizationPage,
historyPage,
shopPage,
} from "./adminSchema/sitePages.ts";
export const ADMIN_ENTITIES: Record<string, any> = {
@ -57,6 +59,8 @@ export const ADMIN_ENTITIES: Record<string, any> = {
resources_page: resourcesPage,
organization_page: organizationPage,
history_page: historyPage,
shop_page: shopPage,
navigation: siteNav,
site_settings: siteSettings,
};

View file

@ -0,0 +1,104 @@
import siteConfiguration from "../../../site.json";
/* ── Navigation (075_site_nav.sql) ───────────────────────────────
Pages → Navigation: the header's and footer's links, and each
static page's title, intro and whether it's hidden. Admins and up
save it, since hiding takes a page off the site. Server side:
server/src/admin-schema/siteNav.js; the site reads it through
server/src/siteNav.js and src/lib/useSiteNav.ts. */
const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).map(
([path, page]) => [path, `${page.title} (${path})`],
);
const PLACES: [string, string][] = [
["main", "Header: pages"],
["action", "Header: buttons"],
["footer", "Footer: Get in Touch"],
["legal", "Footer: bottom row"],
];
const placeLabel = (place) => PLACES.find(([key]) => key === place)?.[1];
export const siteNav = {
key: "navigation",
label: "Navigation",
singular: "navigation",
idLabel: "Navigation",
singleton: "site",
writeRole: "admin",
list: { columns: [], filters: [] },
groups: [],
children: [
{
key: "links",
label: "Links",
note: "Top to bottom, in the order each place shows them. A link to a hidden page is only shown to signed-in admin accounts. A header page lists its sections under it by itself (Pages → the page).",
addLabel: "Add link",
title: (row) => (row.label ? `${row.label} · ${placeLabel(row.place) ?? "No place"}` : "New link"),
blank: { place: "", label: "", path: "", parent_path: "", style: "", new_tab: 0 },
fields: [
{ path: "place", label: "Shows in", widget: "select", options: PLACES, required: true },
{ path: "label", label: "Label", required: true, help: "eg. Shop" },
{
path: "path",
label: "Link",
required: true,
full: true,
help: "A page on the site, a section of one, or an address elsewhere, eg. /shop, /organization#contact or https://www.bonfire.com/store/…",
},
{
path: "parent_path",
label: "Under page",
widget: "select",
options: [["/", "Home (/)"], ...SITE_PAGES],
blankLabel: "Default: its own place in the header",
help: "Lists it in that page's menu, after its sections, instead of in the header's row",
when: { path: "place", value: "main" },
},
{
path: "style",
label: "Style",
widget: "select",
options: [["filled", "Filled, like Give (also beside the footer's logo)"]],
blankLabel: "Default: outlined",
when: { path: "place", value: "action" },
},
{ path: "new_tab", label: "Opens in a new tab", widget: "checkbox" },
],
},
{
key: "pages",
label: "Pages",
note: "A page's heading and intro (also its search title and description), and whether it's hidden. A hidden page is out of the menus and the sitemap and says Not found to everyone but signed-in admin accounts, who see it with a bar saying it's hidden. Blank fields keep site.json's. A page not listed here shows as site.json has it.",
addLabel: "Add page",
title: (row) =>
`${SITE_PAGES.find(([path]) => path === row.path)?.[1] ?? "New page"}${row.is_hidden ? " · Hidden" : ""}`,
blank: { path: "", title: "", description: "", is_hidden: 0 },
fields: [
{ path: "path", label: "Page", widget: "select", options: SITE_PAGES, required: true },
{
path: "is_hidden",
label: "Hidden",
widget: "checkbox",
help: "Not found to everyone but signed-in admin accounts, eg. a page that isn't done",
},
{
path: "title",
label: "Title",
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.title ?? ""}` : undefined),
},
{
path: "description",
label: "Intro",
widget: "textarea",
full: true,
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.description ?? ""}` : undefined),
},
],
},
],
};

View file

@ -1,5 +1,6 @@
/* ── The site's own pages (056_site_pages.sql) ───────────────────
Pages → Community, Retreats, Resources, Organization, History:
Pages → Community, Retreats, Resources, Organization, History,
Shop (075):
each page is its sections, in order, and each section is its
heading and its own content blocks, then a preset if it has one
(a prebuilt part of the site, drawn under the blocks). Server
@ -254,3 +255,4 @@ export const retreatsPage = sitePage("retreats", "Retreats page", ["events"]);
export const resourcesPage = sitePage("resources", "Resources page", ["people_directory"]);
export const organizationPage = sitePage("organization", "Organization page", ["people_directory"]);
export const historyPage = sitePage("history", "History page", ["timeline"]);
export const shopPage = sitePage("shop", "Shop page", []);

View file

@ -4,10 +4,8 @@ import { THEME_DEFAULTS } from "../../../server/src/themeDefaults.js";
/* ── Site settings (035_site_settings.sql) ───────────────────────
Overrides for site.json, superadmins only: every blank falls back
to what site.json says, which is shown as the default. */
const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).map(
([path, page]) => [path, `${page.title} (${path})`],
);
to what site.json says, which is shown as the default. Page titles
and intros are Pages → Navigation's (siteNav.ts). */
/* The palette an admin can change, in the order the dropdown lists
it: token and label. The defaults come from the server's list
@ -218,28 +216,5 @@ export const siteSettings = {
},
],
},
{
key: "pages",
label: "Page titles and intros",
note: "Change a static page's heading and intro, which are also its search title and description. Blank fields keep site.json's.",
addLabel: "Change a page",
title: (row) => SITE_PAGES.find(([path]) => path === row.path)?.[1] ?? "New page",
blank: { path: "", title: "", description: "" },
fields: [
{ path: "path", label: "Page", widget: "select", options: SITE_PAGES, required: true },
{
path: "title",
label: "Title",
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.title ?? ""}` : undefined),
},
{
path: "description",
label: "Intro",
widget: "textarea",
full: true,
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.description ?? ""}` : undefined),
},
],
},
],
};

View file

@ -13,7 +13,7 @@
table, so there is one answer to "where does an event live" and
changing it is changing EVENT_BASE below.
navConfig.ts stays the source of truth for the *nav*: these are
The nav is Pages → Navigation's (useSiteNav.ts): these are
record routes, which never appear in it.
── On missing ids ──

56
src/lib/useSiteNav.ts Normal file
View file

@ -0,0 +1,56 @@
/* ═══════════════════════════════════════════════════════════════
SITE NAV: the header's and footer's links, and the hidden pages
Pages → Navigation, for this visitor (server/src/siteNav.js): a
link to a hidden page is only sent to a viewer and up. The page
HTML carries it (window.__SITE__.nav), so the menus draw on the
first paint; GET /api/nav asks again, which is also how the dev
server (no page metadata) and a sign-in in another tab get it.
Until either answers, navConfig.ts's defaults.
═══════════════════════════════════════════════════════════════ */
import { useMemo } from 'react'
import { NAV_DEFAULTS, type NavLink } from '../navConfig.ts'
import { useRecord } from './useRecord.ts'
export type SiteNav = {
links: NavLink[]
/** Paths of hidden pages, eg. '/shop'. */
hidden: string[]
/** This visitor sees hidden pages (signed in, viewer and up). */
seesHidden: boolean
}
const fromPage: SiteNav | undefined =
typeof window !== 'undefined' ? (window as unknown as { __SITE__?: { nav?: SiteNav } }).__SITE__?.nav : undefined
const DEFAULTS: SiteNav = { links: NAV_DEFAULTS, hidden: [], seesHidden: false }
/** A path's page: no #section or ?query, no trailing slash. */
export const pageOf = (path: string): string => path.split(/[?#]/)[0].replace(/(.)\/+$/, '$1') || '/'
export function useSiteNav() {
const { data } = useRecord<SiteNav>('/nav', 'nav')
const nav = data ?? fromPage ?? DEFAULTS
return useMemo(() => {
const main = nav.links.filter((l) => l.place === 'main')
const top = main.filter((l) => !l.parent)
const tops = new Set(top.map((l) => pageOf(l.path)))
return {
...nav,
/** The header's pages, each with the links set under it. */
main: top.map((page) => ({
...page,
children: main.filter((l) => l.parent && l.parent === pageOf(page.path)),
})),
/** Every main link, children included, for lists of the site's pages. */
pages: main.filter((l) => !l.parent || tops.has(l.parent)),
actions: nav.links.filter((l) => l.place === 'action'),
footer: nav.links.filter((l) => l.place === 'footer'),
legal: nav.links.filter((l) => l.place === 'legal'),
isHidden: (path: string) => nav.hidden.includes(pageOf(path)),
}
}, [nav])
}

View file

@ -1,22 +1,56 @@
// Single source of truth for navigation.
// Add a page here and in App.jsx, and both tiers of the nav update.
/* ═══════════════════════════════════════════════════════════════
NAV DEFAULTS
export const PAGE_LINKS = [
{ label: "Home", path: "/" },
{ label: "Retreats", path: "/retreats" },
{ label: "Community", path: "/community" },
{ label: "Resources", path: "/resources" },
{ label: "Organization", path: "/organization" },
{ label: "History", path: "/history" },
];
The header's and footer's links are edited in Pages → Navigation
(075_site_nav.sql) and reach the app through useSiteNav
(src/lib/useSiteNav.ts). This is what the app starts from before
they arrive: the same links the migration seeded, so a dev server
with no page metadata, or a moment before /api/nav answers, still
has a menu. Change the menus in the admin, not here.
// Right-side actions. `variant` picks the styling, not the destination.
export const NAV_ACTIONS = [
{ label: "Contact Us", to: "/organization#contact", variant: "ghost" },
{
label: "Give",
to: "/give",
variant: "fancy",
external: true,
},
];
place: main the header's pages (sections drop down under
each); with a parent, in that page's dropdown
action the header's buttons (filled: the Give style,
also beside the footer's logo)
footer the footer's Get in Touch list
legal the footer's bottom row
═══════════════════════════════════════════════════════════════ */
export type NavPlace = 'main' | 'action' | 'footer' | 'legal'
export type NavLink = {
place: NavPlace
label: string
/** '/retreats', '/organization#contact', or an https:// address. */
path: string
/** A main link's page whose dropdown it sits in. */
parent: string | null
filled: boolean
newTab: boolean
}
const link = (place: NavPlace, label: string, path: string, more: Partial<NavLink> = {}): NavLink => ({
place,
label,
path,
parent: null,
filled: false,
newTab: false,
...more,
})
export const NAV_DEFAULTS: NavLink[] = [
link('main', 'Home', '/'),
link('main', 'Retreats', '/retreats'),
link('main', 'Community', '/community'),
link('main', 'Resources', '/resources'),
link('main', 'Organization', '/organization'),
link('main', 'History', '/history'),
link('action', 'Contact Us', '/organization#contact'),
link('action', 'Give', '/give', { filled: true, newTab: true }),
link('footer', 'Feedback', '/feedback'),
link('footer', 'Request', '/request'),
link('footer', 'Contact Us', '/organization#contact'),
link('legal', 'Privacy Policy', '/privacy'),
link('legal', 'Terms of Service', '/terms'),
]

View file

@ -18,7 +18,7 @@ import { useMemo } from 'react'
import { Link, useLocation } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx'
import { PAGE_LINKS } from '../navConfig.ts'
import { useSiteNav } from '../lib/useSiteNav.ts'
import { SITE_PAGES } from '../lib/site.ts'
import { useDirectory, type Directory } from '../lib/useContent.ts'
import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts'
@ -33,10 +33,11 @@ const ORG_KIND_LABEL: Record<string, string> = {
partner: 'Partner',
}
/* Everything an address could have meant: the static pages, then
each kind of record, with the words to match it by. */
function candidates(directory: Directory | null): Candidate[] {
const pages: Candidate[] = Object.entries(SITE_PAGES).map(([path, page]) => ({
/* Everything an address could have meant: the static pages (not the
hidden ones), then each kind of record, with the words to match
it by. */
function candidates(directory: Directory | null, isHidden: (path: string) => boolean): Candidate[] {
const pages: Candidate[] = Object.entries(SITE_PAGES).filter(([path]) => !isHidden(path)).map(([path, page]) => ({
href: path,
label: page.title,
detail: 'Page',
@ -65,7 +66,11 @@ function candidates(directory: Directory | null): Candidate[] {
export default function NotFound() {
const { pathname } = useLocation()
const { data: directory, loading } = useDirectory()
const matches = useMemo(() => suggest(pathname, candidates(directory ?? null)), [pathname, directory])
const { main: pages, isHidden } = useSiteNav()
const matches = useMemo(
() => suggest(pathname, candidates(directory ?? null, isHidden)),
[pathname, directory, isHidden],
)
const reading = useReadingMode()
return (
@ -118,7 +123,7 @@ export default function NotFound() {
accent: ACCENTS.green,
content: (
<div className="mx-auto flex max-w-6xl flex-wrap gap-3 px-6">
{PAGE_LINKS.map((page) => (
{pages.map((page) => (
<Link
key={page.path}
to={page.path}

View file

@ -10,8 +10,8 @@ const PAGE = sitePage('/qr')
QR CODES PAGE: /qr
A QR code for any page on the site, for flyers, slides and
signs. Unlisted: not in navConfig, so neither the header nor the
footer links here. It lists only published records, so there is
signs. Unlisted: not in Pages → Navigation's links, so neither
the header nor the footer links here. It lists only published records, so there is
nothing on it a visitor couldn't already reach.
═══════════════════════════════════════════════════════════════ */

View file

@ -3,7 +3,7 @@
Bare on purpose. No PageShell, no announcement banner, no
footer site map. None of that belongs around a staff tool, and
/admin should never appear in navConfig.
/admin should never appear in Pages → Navigation.
Three areas share this chrome: Home, the CMS and the Panel. The
wordmark names whichever one you're in, and from anywhere but

View file

@ -114,6 +114,12 @@ export const PAGES_NAV = {
label: "Pages",
blurb: "What a page shows and in what order.",
children: [
// The header's and footer's links, page titles and hidden pages.
{
to: "/admin/navigation",
label: "Navigation",
blurb: "The header's pages and buttons, the footer's links, each page's title and intro, and which pages are hidden.",
},
// One record, not a list: the item opens it directly.
{
to: "/admin/front_page",
@ -147,6 +153,11 @@ export const PAGES_NAV = {
label: "History",
blurb: "Its sections: the timeline (its entries are under Data), and anything else.",
},
{
to: "/admin/shop_page",
label: "Shop",
blurb: "The shop's intro page: its sections and the links out to the store.",
},
],
};
@ -227,7 +238,7 @@ export const PANEL_NAV = {
{
to: SITE_SETTINGS,
label: "Site settings",
blurb: "The site's name, description, preview image, icons, page titles and search indexing.",
blurb: "The site's name, description, preview image, icons, colors, access groups and search indexing.",
},
],
};

View file

@ -7,8 +7,9 @@
the two sets are kept deliberately in step (MIN_MESSAGE, and the
ids in FEEDBACK_TYPES).
The page and section options come from navConfig, so adding a
page to the nav adds it to this form too.
The page and section options come from the header's pages (Pages
→ Navigation, useSiteNav.ts), so adding a page to the nav adds it
to this form too.
With fixedType the type is set and neither picker shows. The
Privacy page uses it for data requests (DATA_REQUEST), which also
@ -18,7 +19,7 @@
import { CaretDown } from '@phosphor-icons/react';
import { useState } from "react";
import { post, ApiError } from "../../lib/api.ts";
import { PAGE_LINKS } from "../../navConfig.ts";
import { useSiteNav } from "../../lib/useSiteNav.ts";
import { useNavSections, type NavSection } from "../../lib/navSections.ts";
import { DATA_REQUEST, FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
import { accentText, BRAND } from '../../lib/color.ts'
@ -185,6 +186,7 @@ export function TilePicker({
function LocationPicker({ page, section, onPageChange, onSectionChange }) {
const sectionsOf = useNavSections();
const { pages } = useSiteNav();
const sections = page === SITE_WIDE ? [] : sectionsOf(page);
return (
@ -210,7 +212,7 @@ function LocationPicker({ page, section, onPageChange, onSectionChange }) {
}}
>
<option value={SITE_WIDE}>Not page-specific</option>
{PAGE_LINKS.map((p) => (
{pages.map((p) => (
<option key={p.path} value={p.path}>
{p.label}
</option>
@ -238,9 +240,9 @@ function LocationPicker({ page, section, onPageChange, onSectionChange }) {
}
// Human-readable version of the picked location, for the thank-you panel.
function describeLocation(page, section, sectionsOf: (path: string) => NavSection[]) {
function describeLocation(page, section, sectionsOf: (path: string) => NavSection[], pages: { path: string; label: string }[]) {
if (page === SITE_WIDE) return null;
const pageLabel = PAGE_LINKS.find((p) => p.path === page)?.label ?? page;
const pageLabel = pages.find((p) => p.path === page)?.label ?? page;
const sectionLabel = sectionsOf(page).find(
(s) => s.hash === section,
)?.label;
@ -251,6 +253,7 @@ function describeLocation(page, section, sectionsOf: (path: string) => NavSectio
export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) {
const sectionsOf = useNavSections();
const { pages } = useSiteNav();
const request = fixedType === DATA_REQUEST.id;
const [type, setType] = useState<any>(fixedType ?? null);
const [page, setPage] = useState(SITE_WIDE);
@ -320,7 +323,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
}
if (status === "sent") {
const where = describeLocation(page, section, sectionsOf);
const where = describeLocation(page, section, sectionsOf, pages);
return (
<div
aria-live="polite"

View file

@ -19,8 +19,8 @@
site like every other choice), a full http(s) address, or a bare
domain, which gets https:// in front.
The main pages come from navConfig.ts, the same list the header
draws; records come from GET /directory, which lists only what's
The main pages come from Pages → Navigation (useSiteNav.ts), the
same list the header draws; records come from GET /directory, which lists only what's
published, and their URLs from hrefs.ts, the same builders the
site links with. So a code can only point at a page that exists.
@ -34,7 +34,7 @@
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import QrCode, { QR_DOVE, QR_INK, QR_PAPER, type QrCenter } from '../../components/QrCode.tsx'
import { NAV_ACTIONS, PAGE_LINKS } from '../../navConfig.ts'
import { useSiteNav } from '../../lib/useSiteNav.ts'
import { useNavSections } from '../../lib/navSections.ts'
import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts'
import { siteUrl } from '../../lib/site.ts'
@ -145,22 +145,21 @@ type Choice = { path: string; label: string }
type Group = { label?: string; choices: Choice[] }
/* The header's pages, then any nav action that is a page of its own
rather than an anchor on one of them (Give, not Contact Us). */
function mainPages(): Choice[] {
const pages = PAGE_LINKS.map((p) => ({ path: p.path, label: p.label }))
on the site rather than an anchor on one of them (Give, not
Contact Us). */
function mainPages(nav: ReturnType<typeof useSiteNav>): Choice[] {
const pages = nav.pages.map((p) => ({ path: p.path, label: p.label }))
const known = new Set(pages.map((p) => p.path))
for (const action of NAV_ACTIONS) {
const path = action.to.split('#')[0]
if (!action.to.includes('#') && !known.has(path)) {
pages.push({ path, label: action.label })
known.add(path)
}
for (const action of nav.actions) {
if (!action.path.startsWith('/') || action.path.includes('#') || known.has(action.path)) continue
pages.push({ path: action.path, label: action.label })
known.add(action.path)
}
return pages
}
function groupsFor(kind: Kind, directory: Directory | null): Group[] {
if (kind === 'pages') return [{ choices: mainPages() }]
function groupsFor(kind: Kind, directory: Directory | null, nav: ReturnType<typeof useSiteNav>): Group[] {
if (kind === 'pages') return [{ choices: mainPages(nav) }]
if (!directory) return []
switch (kind) {
@ -268,7 +267,8 @@ export default function QrCodeMaker() {
const [copied, setCopied] = useState(false)
const svgRef = useRef<SVGSVGElement>(null)
const groups = useMemo(() => groupsFor(kind, directory), [kind, directory])
const nav = useSiteNav()
const groups = useMemo(() => groupsFor(kind, directory, nav), [kind, directory, nav])
const choices = useMemo(() => groups.flatMap((group) => group.choices), [groups])
// Past FILTER_FROM records, a box above the select narrows them;
// the one chosen always stays.