Compare commits

...

3 commits

Author SHA1 Message Date
Zaldimmar
45b422641a Version v1.10.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 23:39:24 -05:00
Zaldimmar
ed0f12022f Navigation: section dropdowns, a side nav, Home's sections from the front page
- The header's second strip is gone: each top link drops down its
  page's sections on hover or keyboard focus.
- Retreats, Community, Resources, Organization and History get the
  admin editors' "On this page" column (SectionNav), sticky at the
  left from lg up, with the section being read lit.
- Home's sections in the dropdown, mobile menu, footer site map, the
  feedback form and the QR maker are the bands the front page is
  showing, in its order and under its headings (navSections.ts,
  frontPageBands.ts, which Home.tsx now draws from too).
- Resources comes before Organization in the nav and footer.
- The Organization page draws from its own editor's content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 23:37:36 -05:00
Zaldimmar
43797f38bc Cleanup of old-data fixes; an editor for the Organization page
Nothing before these changes was ever public, so the fixes kept for
older data go: the /leadership redirect (MOVED in routes/pages.js),
index.html's move of "ngu-" browser keys to "site-", the boot-time
sorting of images from before folders (media.js), and emoji path
icons (a path with no named icon shows a dot; migration 055 turns
the baseline's seeded emoji into their names).

Pages → Organization page (migration 055): a singleton with the
Mission, Vision & Values blocks, the Leadership blocks (a People
block per team, in order) with a heading and blurb, and Volunteering
(title, blurb, links). content_blocks gains the two owner kinds;
GET /organization-page serves it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 23:37:35 -05:00
31 changed files with 592 additions and 365 deletions

View file

@ -38,16 +38,6 @@ Each image's `-640.webp` small copy sits beside it. Video and audio
clips (Tools → Video clips) stay in the root. The Media page and every
image picker have a tab per folder; a picker opens on its field's
folder, and uploads there.
**Images from before folders** (a bare name in the root) are sorted
once, when the server first starts with this version: a logo or icon
field names it → `logos/`; saved as a preview → `thumbnails/`; anything
else → `images/`. Every record that names it is rewritten to the new
path in one transaction, after the files move (if that fails, the files
move back). The journal says `uploads: moved N image(s) into folders`.
Back up the database and uploads before that first start; nothing is
needed after.
nginx needs no change: `location /uploads/` already serves the folders.
## Files copied in by hand

View file

@ -267,7 +267,7 @@ The numbers band's "Number Source" dropdown works the same way:
| What | File | Notes |
| --- | --- | --- |
| Header and footer navigation, page subnav links | `src/navConfig.ts` | `PAGE_LINKS`, `PAGE_SECTIONS`, `NAV_ACTIONS`. 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) | `src/navConfig.ts` | `PAGE_LINKS` (order), `PAGE_SECTIONS`, `NAV_ACTIONS`. The front page's sections aren't listed there: they follow the bands it shows (Front page → Sections), through `src/lib/navSections.ts` and `src/lib/frontPageBands.ts` (each band's anchor and default heading). A new page also needs a route in `src/App.tsx`. |
| Section titles, blurbs and colors on Retreats, Community, Organization, Resources, Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. A section's `id` must match its subnav `hash`. |
| 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

@ -13,16 +13,6 @@
and the accessibility choices, for the same reason. -->
<script>
try {
// Once: browser keys used to start "ngu-"; move them to "site-"
// so a visitor keeps their theme and closed notices.
for (var i = localStorage.length - 1; i >= 0; i--) {
var k = localStorage.key(i);
if (k && k.indexOf("ngu-") === 0) {
var nk = "site-" + k.slice(4);
if (localStorage.getItem(nk) === null) localStorage.setItem(nk, localStorage.getItem(k));
localStorage.removeItem(k);
}
}
var t = localStorage.getItem("site-theme");
document.documentElement.dataset.theme =
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";

View file

@ -51,6 +51,7 @@ import { timeline } from "./admin-schema/timeline.js";
import { frontPage } from "./admin-schema/frontPage.js";
import { blogPosts, communityPage } from "./admin-schema/blog.js";
import { siteSettings } from "./admin-schema/siteSettings.js";
import { organizationPage } from "./admin-schema/organizationPage.js";
export const ENTITIES = {
organizations,
@ -62,6 +63,7 @@ export const ENTITIES = {
front_page: frontPage,
blog_posts: blogPosts,
community_page: communityPage,
organization_page: organizationPage,
site_settings: siteSettings,
};

View file

@ -0,0 +1,43 @@
/* The Organization page (/organization): one row, its blocks and its
volunteering links (055_organization_page.sql). Two block
collections, each its own owner kind, so the editor shows them
apart: the Mission, Vision & Values section, and the Leadership
section (a People block per team, in order). */
import { text, url, blocksChild } from "./columns.js";
export const organizationPage = {
key: "organization_page",
table: "organization_page",
idColumn: "id",
idKind: "slug",
singleton: "organization",
concurrency: "updated_at",
list: {
columns: ["id", "updated_at"],
filters: [],
search: [],
order: "id",
},
columns: [
text("mission_title"),
text("leadership_title"),
text("leadership_blurb"),
text("volunteer_title"),
text("volunteer_blurb"),
],
children: [
{ ...blocksChild("org_page_mission"), key: "mission_blocks" },
{ ...blocksChild("org_page_leadership"), key: "leadership_blocks" },
{
key: "volunteer_links",
table: "organization_page_links",
owner: { column: "page_id" },
order: "sort_order",
columns: [text("label", { required: true }), url("url", { required: true })],
},
],
};

View file

@ -26,6 +26,7 @@ import history from "./routes/history.js";
import home from "./routes/home.js";
import directory from "./routes/directory.js";
import blog from "./routes/blog.js";
import organizationPage from "./routes/organizationPage.js";
import pages from "./routes/pages.js";
import feedback from "./routes/feedback.js";
import requests from "./routes/requests.js";
@ -38,7 +39,7 @@ import clips from "./routes/clips.js";
import imports from "./routes/import.js";
import files from "./routes/files.js";
import { CLIPS_DIR, startClipWorker } from "./clips.js";
import { UPLOADS_DIR, sortIntoFolders, writeMissingThumbs } from "./media.js";
import { UPLOADS_DIR, writeMissingThumbs } from "./media.js";
import { logSafe, startSessionSweeper } from "./auth.js";
import { syncDescriptorsWithSchema } from "./admin-schema-sync.js";
import { startGroupSync } from "./accessGroups.js";
@ -57,9 +58,6 @@ syncDescriptorsWithSchema(db, ENTITIES);
console.log(`db ${DB_PATH} (${db.driverName}, schema v${version})`);
await mkdir(UPLOADS_DIR, { recursive: true });
console.log(`uploads ${UPLOADS_DIR}`);
// Once: images from before folders into logos/, images/, thumbnails/.
const sorted = await sortIntoFolders(db);
if (sorted) console.log(`uploads: moved ${sorted} image(s) into folders`);
// In the background: pages fall back to the full file until it's done.
writeMissingThumbs()
.then((made) => made && console.log(`uploads: made ${made} small copies`))
@ -172,6 +170,7 @@ app.route("/api", history);
app.route("/api", home);
app.route("/api", directory);
app.route("/api", blog);
app.route("/api", organizationPage);
// Tighter limit on the write path than anything else gets.
app.use("/api/feedback", rateLimit({ windowMs: 60_000, max: 5 }));

View file

@ -36,8 +36,7 @@
by itself (link previews, Drive files' first pages), images/ for
the rest. A stored name includes it: 'logos/3f9c….webp', served at
/uploads/logos/3f9c….webp. The small copy sits beside it. Clips
and files from before folders keep a bare name in the root.
sortIntoFolders() moves those older images once, at boot.
keep a bare name in the root.
── Files copied in by hand ──
A file put straight into UPLOADS_DIR has no media row, so the
@ -51,7 +50,6 @@
import { randomBytes } from "node:crypto";
import { tx } from "./db.js";
import { mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
import path from "node:path";
@ -373,83 +371,4 @@ export async function registerLooseFiles(db) {
// Columns that hold a logo or a site icon: an image one of these
// names goes in logos/.
const LOGO_COLUMNS = new Set(["logo", "org_logo", "event_logo", "favicon", "apple_touch_icon"]);
// Tables whose text never names an upload a page uses.
const NOT_CONTENT = new Set(["media", "admin_users", "sessions", "feedback", "feedback_files", "sqlite_sequence"]);
/* Every image still in the root from before folders, moved into the
folder its uses call for (logos/ if a logo or icon field names it,
thumbnails/ if the site saved it as a preview, else images/), with
every record that names it rewritten to the new path. The files
move first; the rows change in one transaction, and if that fails
the files move back. Returns how many moved; run at boot, and a
no-op once nothing is left in the root. */
export async function sortIntoFolders(db) {
const rows = db
.prepare(
`SELECT id, filename, original_name FROM media
WHERE instr(filename, '/') = 0 AND content_type LIKE 'image/%'`,
)
.all();
if (rows.length === 0) return 0;
const columns = [];
for (const { name: table } of db
.prepare(`SELECT name FROM sqlite_schema WHERE type = 'table' AND name NOT LIKE 'sqlite_%'`)
.all()) {
if (NOT_CONTENT.has(table)) continue;
for (const col of db.prepare(`SELECT name, type FROM pragma_table_info(?)`).all(table)) {
if (col.type.toUpperCase() === "TEXT") columns.push({ table, column: col.name });
}
}
const namesOf = (filename) => [
...new Set([`${PUBLIC_PREFIX}${filename}`, `${PUBLIC_PREFIX}${encodeURIComponent(filename)}`, filename]),
];
const holds = (table, column, values) =>
db
.prepare(`SELECT 1 FROM "${table}" WHERE "${column}" IN (${values.map(() => "?").join(", ")}) LIMIT 1`)
.get(...values);
const moved = [];
for (const row of rows) {
const values = namesOf(row.filename);
const folder = columns.some(({ table, column }) => LOGO_COLUMNS.has(column) && holds(table, column, values))
? "logos"
: /^preview |\(preview\)$/.test(row.original_name) || holds("drive_files", "preview", values)
? "thumbnails"
: "images";
const to = `${folder}/${row.filename}`;
try {
await mkdir(path.join(UPLOADS_DIR, folder), { recursive: true });
await rename(path.join(UPLOADS_DIR, row.filename), path.join(UPLOADS_DIR, to));
} catch (err) {
// Not on disk (deleted by hand): leave its row as it is.
if (err.code !== "ENOENT") console.warn(`media: couldn't move ${row.filename}: ${err.message}`);
continue;
}
await rename(path.join(UPLOADS_DIR, thumbName(row.filename)), path.join(UPLOADS_DIR, thumbName(to))).catch(() => {});
moved.push({ row, to, values });
}
try {
tx(db, () => {
for (const { row, to, values } of moved) {
db.prepare(`UPDATE media SET filename = ? WHERE id = ?`).run(to, row.id);
for (const { table, column } of columns) {
db.prepare(`UPDATE "${table}" SET "${column}" = ? WHERE "${column}" IN (${values.map(() => "?").join(", ")})`).run(
publicPath(to),
...values,
);
}
}
});
} catch (err) {
for (const { row, to } of moved) {
await rename(path.join(UPLOADS_DIR, to), path.join(UPLOADS_DIR, row.filename)).catch(() => {});
await rename(path.join(UPLOADS_DIR, thumbName(to)), path.join(UPLOADS_DIR, thumbName(row.filename))).catch(() => {});
}
throw err;
}
return moved.length;
}

View file

@ -0,0 +1,134 @@
-- ═══════════════════════════════════════════════════════════════
-- 055 THE ORGANIZATION PAGE'S OWN EDITOR, NAMED PATH ICONS
--
-- The Organization page (/organization) is edited in the admin like
-- the Community blog section (Pages → Organization page): a
-- singleton row, organization_page, with
--
-- mission blocks content_blocks owned 'org_page_mission':
-- the Mission, Vision & Values section
-- leadership blocks content_blocks owned 'org_page_leadership':
-- the Leadership section, eg. a heading and a
-- People block per team (Board of Trustees,
-- then the Retreat Team), in the order given
-- volunteering a title, a blurb and organization_page_links,
-- under the leadership
--
-- Two owner kinds rather than a slot, so each list is its own
-- collection in the editor. The owner_kind CHECK changes, so
-- content_blocks is rebuilt as 054 did, with its index and owner
-- trigger (which learns the new kinds) again.
--
-- And the front page's "Find your way in" paths: the baseline seeded
-- them with emoji, from before the named icon list
-- (src/data/pathIcons.ts). The site now draws only named icons, so
-- the seeded emoji become their names and any other non-name is
-- cleared (shown as a plain dot until one is picked).
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE organization_page (
id TEXT PRIMARY KEY CHECK (id = 'organization'),
mission_title TEXT, -- null → 'Mission, Vision & Values'
leadership_title TEXT, -- null → 'Leadership'
leadership_blurb TEXT,
volunteer_title TEXT, -- null → 'Volunteering'
volunteer_blurb TEXT,
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
) STRICT;
INSERT INTO organization_page (id) VALUES ('organization');
CREATE TABLE organization_page_links (
id INTEGER PRIMARY KEY AUTOINCREMENT,
page_id TEXT NOT NULL REFERENCES organization_page (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
label TEXT NOT NULL,
url TEXT NOT NULL
) STRICT;
CREATE INDEX organization_page_links_idx ON organization_page_links (page_id, sort_order);
-- ── Blocks for the page ────────────────────────────────────────
CREATE TABLE content_blocks_new (
id INTEGER PRIMARY KEY AUTOINCREMENT,
owner_kind TEXT NOT NULL
CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post',
'org_page_mission', 'org_page_leadership')),
owner_id TEXT NOT NULL,
slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body')),
sort_order INTEGER NOT NULL DEFAULT 0,
type TEXT NOT NULL
CHECK (type IN ('heading', 'subheading', 'paragraph',
'list', 'links', 'quote', 'image', 'divider',
'video', 'button', 'callout', 'schedule', 'table', 'cards',
'people')),
text TEXT,
media TEXT,
href TEXT,
alt TEXT,
cite TEXT,
team_id TEXT REFERENCES teams (id) ON DELETE SET NULL
) STRICT;
INSERT INTO content_blocks_new
(id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id)
SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id
FROM content_blocks;
PRAGMA legacy_alter_table = ON;
DROP TABLE content_blocks;
ALTER TABLE content_blocks_new RENAME TO content_blocks;
PRAGMA legacy_alter_table = OFF;
CREATE INDEX content_blocks_owner_idx
ON content_blocks (owner_kind, owner_id, slot, sort_order);
-- ── Path icons ─────────────────────────────────────────────────
UPDATE front_page_paths SET icon = 'compass' WHERE icon = '🧭';
UPDATE front_page_paths SET icon = 'hands' WHERE icon = '🤲';
UPDATE front_page_paths SET icon = 'sparkle' WHERE icon = '🌱';
UPDATE front_page_paths SET icon = 'people' WHERE icon = '🤝';
UPDATE front_page_paths SET icon = NULL
WHERE icon IS NOT NULL
AND icon NOT IN ('heart', 'hands', 'people', 'calendar', 'tent', 'map', 'home', 'book',
'learn', 'chat', 'music', 'compass', 'sparkle', 'star');
-- ── Triggers last (see CLAUDE.md, Migrations) ──
CREATE TRIGGER organization_page_touch
AFTER UPDATE ON organization_page
FOR EACH ROW WHEN new.updated_at = old.updated_at
BEGIN
UPDATE organization_page SET updated_at = datetime('now') WHERE id = new.id;
END;
CREATE TRIGGER content_blocks_owner_exists
BEFORE INSERT ON content_blocks
BEGIN
SELECT CASE
WHEN new.owner_kind = 'event'
AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such event')
WHEN new.owner_kind = 'organization'
AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such organization')
WHEN new.owner_kind = 'person'
AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such person')
WHEN new.owner_kind = 'team'
AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such team')
WHEN new.owner_kind = 'blog_post'
AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such blog post')
WHEN new.owner_kind IN ('org_page_mission', 'org_page_leadership')
AND NOT EXISTS (SELECT 1 FROM organization_page WHERE id = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such organization page')
END;
END;

View file

@ -0,0 +1,43 @@
/* ═══════════════════════════════════════════════════════════════
ORGANIZATION PAGE ROUTE: read-only, mounted under /api
GET /organization-page the Organization page's own content:
its section titles, the Mission and
Leadership blocks, and Volunteering
(title, blurb, links)
Edited in the admin as Pages → Organization page
(admin-schema/organizationPage.js). The blocks are shaped as on
any record page (loadBlocks), so ContentBlocks draws them.
═══════════════════════════════════════════════════════════════ */
import { Hono } from "hono";
import { json, loadBlocks } from "../shape.js";
const ID = "organization";
const organizationPage = new Hono();
organizationPage.get("/organization-page", (c) => {
const db = c.get("db");
const row = db.prepare(`SELECT * FROM organization_page WHERE id = ?`).get(ID) ?? {};
const links = db
.prepare(`SELECT label, url FROM organization_page_links WHERE page_id = ? ORDER BY sort_order, id`)
.all(ID);
return json(c, {
page: {
mission_title: row.mission_title ?? null,
mission_blocks: loadBlocks(db, "org_page_mission", [ID]).get(ID) ?? [],
leadership_title: row.leadership_title ?? null,
leadership_blurb: row.leadership_blurb ?? null,
leadership_blocks: loadBlocks(db, "org_page_leadership", [ID]).get(ID) ?? [],
volunteer: {
title: row.volunteer_title ?? null,
blurb: row.volunteer_blurb ?? null,
links,
},
},
});
});
export default organizationPage;

View file

@ -21,9 +21,6 @@
the app's own not-found page with a 404 status, so search engines
drop it.
A page that moved answers with a 301 to where it is now (MOVED),
so old links, QR codes and search results keep working.
If the metadata can't be built (no site.json at SITE_CONFIG, say),
the page is still served, as built, and the cause is logged once:
a preview is never worth a page that won't load.
@ -92,23 +89,12 @@ pages.get("/sitemap.xml", (c) => {
});
});
/* Pages that have moved: old path → new, query string kept. */
const MOVED = {
"/leadership": "/organization",
};
pages.get("*", (c, next) => {
const pathname = c.req.path;
// The API's own paths, and an upload that isn't there, stay plain
// 404s rather than becoming a page.
if (/^\/(api|uploads)(\/|$)/.test(pathname)) return next();
const moved = MOVED[pathname.replace(/(.)\/+$/, "$1")];
if (moved) {
const query = new URL(c.req.url).search;
return c.redirect(moved + query, 301);
}
let html;
try {
html = indexHtml();

View file

@ -1,5 +1,6 @@
import { Link } from "react-router-dom";
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
import { PAGE_LINKS, NAV_ACTIONS } from "../navConfig.ts";
import { useNavSections } from "../lib/navSections.ts";
import siteLogo from "../assets/logos/NGU_Logo.svg";
import PlatformIcon from "./PlatformIcon.tsx";
import { ORGANIZATION_DETAILS as Organization_Details } from "../data/organizationDetails.ts";
@ -44,6 +45,7 @@ const sectionLinkClass =
const headingClass = "text-white/90 text-sm font-semibold mb-4";
export default function Footer() {
const sectionsOf = useNavSections();
return (
<footer className="py-16 px-6" style={{ background: "#001011" }}>
<div className="max-w-6xl mx-auto">
@ -85,7 +87,7 @@ export default function Footer() {
<h2 className={headingClass}>Site Map</h2>
<ul className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-x-6 gap-y-6">
{PAGE_LINKS.map((page) => {
const sections = PAGE_SECTIONS[page.path] ?? [];
const sections = sectionsOf(page.path);
return (
<li key={page.path}>
<Link to={page.path} className={pageLinkClass}>

View file

@ -1,7 +1,8 @@
import { X, List } from "@phosphor-icons/react";
import { Suspense, useState, useEffect, useRef } from "react";
import { NavLink, Link, Outlet, useLocation } from "react-router-dom";
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
import { PAGE_LINKS, NAV_ACTIONS } from "../navConfig.ts";
import { useNavSections } from "../lib/navSections.ts";
import Banner from "./Banner.tsx";
import siteLogo from "../assets/logos/NGU_Logo.svg";
import Footer from "./Footer.tsx";
@ -76,23 +77,18 @@ const navActions = NAV_ACTIONS as NavActionItem[];
export default function Layout() {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const [activeSection, setActiveSection] = useState<string | null>(null);
// Measured below; this first guess (nav, plus the section strip on
// pages that have one) keeps the content from jumping when it lands.
const [headerHeight, setHeaderHeight] = useState(() =>
72 + ((PAGE_SECTIONS[window.location.pathname] ?? []).length ? 36 : 0),
);
// Measured below; this first guess keeps the content from jumping
// when it lands.
const [headerHeight, setHeaderHeight] = useState(72);
const headerRef = useRef<HTMLElement>(null);
const closeMenuRef = useRef<HTMLButtonElement>(null);
const location = useLocation();
const sections = PAGE_SECTIONS[location.pathname] ?? [];
const activePage = PAGE_LINKS.find((p) => p.path === location.pathname);
const sectionsOf = useNavSections();
// Close the mobile menu whenever the route changes
useEffect(() => {
setMobileMenuOpen(false);
setActiveSection(null);
}, [location.pathname]);
// The open menu is modal: focus starts on its close button, Escape
@ -105,9 +101,9 @@ export default function Layout() {
return () => window.removeEventListener("keydown", onKey);
}, [mobileMenuOpen]);
// The header grows and shrinks: the banner can be dismissed and the
// subnav only exists on some pages. Measure it instead of guessing,
// so the spacer below always matches.
// The header grows and shrinks: the banner can be dismissed, and
// wraps on a narrow screen. Measure it instead of guessing, so the
// spacer below always matches.
useEffect(() => {
const el = headerRef.current;
if (!el) return;
@ -132,33 +128,6 @@ export default function Layout() {
window.scrollTo({ top: 0 });
}, [location.pathname, location.hash, location.key]);
// Highlight whichever section is currently in view
useEffect(() => {
if (sections.length === 0) return;
const targets = sections
.map((s) => document.querySelector(s.hash))
.filter(Boolean);
if (targets.length === 0) return;
const observer = new IntersectionObserver(
(entries) => {
const visible = entries
.filter((e) => e.isIntersecting)
.sort(
(a, b) => a.boundingClientRect.top - b.boundingClientRect.top
)[0];
if (visible) setActiveSection(`#${visible.target.id}`);
},
// Top margin tracks the live header height so the highlight stays
// accurate whether or not the banner is showing.
{ rootMargin: `-${headerHeight + 30}px 0px -60% 0px`, threshold: 0 }
);
targets.forEach((t) => observer.observe(t));
return () => observer.disconnect();
}, [location.pathname, headerHeight]);
return (
// overflow-x-clip, not -hidden: hidden makes this div a scroll
// container, and then nothing inside it can be position: sticky
@ -195,23 +164,51 @@ export default function Layout() {
<img src={siteLogo} alt="Next Generation of Unity" className="h-10 w-auto" />
</Link>
{/* Each page, and under it on hover or keyboard focus its
sections (navSections.ts): the sections live in these
dropdowns rather than a strip of their own. */}
<div className="hidden lg:flex items-center gap-6">
{PAGE_LINKS.map((page) => (
<NavLink
key={page.path}
to={page.path}
end={page.path === "/"}
className={({ isActive }) =>
`text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${
isActive
? "text-white border-[#9cc47c]"
: "text-white/75 hover:text-white border-transparent"
}`
}
>
{page.label}
</NavLink>
))}
{PAGE_LINKS.map((page) => {
const pageSections = sectionsOf(page.path);
return (
<div key={page.path} className="group relative">
<NavLink
to={page.path}
end={page.path === "/"}
className={({ isActive }) =>
`block text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${
isActive
? "text-white border-[#9cc47c]"
: "text-white/75 hover:text-white border-transparent"
}`
}
>
{page.label}
</NavLink>
{pageSections.length > 0 && (
// pt-3 is the bridge the pointer crosses from the
// link into the menu without it closing.
<div className="invisible absolute top-full left-0 z-10 pt-3 opacity-0 transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-focus-within:visible group-focus-within:opacity-100">
<ul
className="min-w-56 py-2 shadow-xl"
style={{ background: "rgba(0, 16, 17, 0.97)", borderTop: "2px solid #9cc47c" }}
>
{pageSections.map((section) => (
<li key={section.hash}>
<Link
to={`${page.path}${section.hash}`}
className="block px-4 py-2 text-sm text-white/80 transition-colors hover:bg-white/10 hover:text-[#f0bd4f] focus-visible:bg-white/10"
>
{section.label}
</Link>
</li>
))}
</ul>
</div>
)}
</div>
);
})}
</div>
</div>
@ -235,43 +232,6 @@ export default function Layout() {
</div>
</nav>
{/* Tier 2, sections of the current page */}
{sections.length > 0 && (
<nav
className="hidden md:flex items-center px-6 py-2"
aria-label={`On this page: ${activePage?.label}`}
style={{
background: "rgba(0, 16, 17, 0.92)",
borderBottom: "1px solid rgba(92, 231, 255, 0.15)",
}}
>
<span className="text-xs text-white/65">{activePage?.label}</span>
{/* Separates the page label from its sections */}
<span
aria-hidden
className="mx-5 h-4 w-px"
style={{ background: "rgba(92, 231, 255, 0.3)" }}
/>
<div className="flex items-center gap-6">
{sections.map((section) => (
<a
key={section.hash}
href={section.hash}
aria-current={activeSection === section.hash ? "location" : undefined}
className={`text-sm transition-colors duration-200 ${
activeSection === section.hash
? "text-[#9cc47c]"
: "text-white/75 hover:text-[#9cc47c]"
}`}
>
{section.label}
</a>
))}
</div>
</nav>
)}
</header>
<PageBackdrop />
@ -313,7 +273,7 @@ export default function Layout() {
<div className="w-64">
{PAGE_LINKS.map((page) => {
const pageSections = PAGE_SECTIONS[page.path] ?? [];
const pageSections = sectionsOf(page.path);
const isActive = location.pathname === page.path;
return (

View file

@ -5,6 +5,11 @@
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" 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. 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.
@ -33,6 +38,7 @@ import { useEffect, type ReactNode } from "react";
import { documentTitle } from "../lib/site.ts";
import { accentText, BRAND } from '../lib/color.ts'
import { SectionNav } from "./admin/SectionNav.tsx";
export type ShellSection = {
@ -48,6 +54,8 @@ type PageShellProps = {
title: ReactNode;
intro?: ReactNode;
sections: ShellSection[];
/** An "On this page" column beside the sections, from lg up. */
sideNav?: boolean;
};
export function Section({ section }: { section: ShellSection }) {
@ -89,7 +97,7 @@ export function Section({ section }: { section: ShellSection }) {
);
}
export default function PageShell({ title, intro, sections }: PageShellProps) {
export default function PageShell({ title, intro, sections, sideNav = false }: PageShellProps) {
// 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.
@ -97,6 +105,15 @@ export default function PageShell({ title, intro, sections }: PageShellProps) {
if (typeof title === "string") document.title = documentTitle(title);
}, [title]);
const bands = sections.map((section, i) => (
<div key={section.id}>
{/* Thin solid banner between sections */}
<div className="h-2" style={{ background: section.accent }} />
<Section section={section} />
{i === sections.length - 1 && <div className="h-2" style={{ background: section.accent }} />}
</div>
));
return (
<>
{/* Page header */}
@ -109,16 +126,18 @@ export default function PageShell({ title, intro, sections }: PageShellProps) {
</div>
</div>
{sections.map((section, i) => (
<div key={section.id}>
{/* Thin solid banner between sections */}
<div className="h-2" style={{ background: section.accent }} />
<Section section={section} />
{i === sections.length - 1 && (
<div className="h-2" style={{ background: section.accent }} />
)}
{sideNav ? (
<div className="lg:grid lg:grid-cols-[13rem_minmax(0,1fr)]">
<aside className="hidden lg:block">
<div className="sticky pt-8 pl-6" style={{ top: "calc(var(--header-h, 5rem) + 1rem)" }}>
<SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} />
</div>
</aside>
<div className="min-w-0">{bands}</div>
</div>
))}
) : (
bands
)}
</>
);

View file

@ -1,7 +1,8 @@
/* ═══════════════════════════════════════════════════════════════
EDITOR SECTION NAV
The record editor's table of contents. On a wide screen it's a
The record editor's table of contents, and the public pages'
"On this page" column too (PageShell's sideNav). On a wide screen it's a
sticky column left of the form; below lg it's a slim sticky bar
with a "Jump to" menu. Both list the same sections, which
EntityEdit derives from the manifest (field groups, then child

View file

@ -5,9 +5,7 @@
Connect Nav → Icon), as [key, label]. The admin's dropdown lists
the labels; Pathfinder.tsx draws the Phosphor icon for each key.
Adding one is a line here and one in ICONS in Pathfinder.tsx.
A path saved before this list existed may hold an emoji instead
of a key; Pathfinder shows that as it is.
A path with none set shows a dot.
═══════════════════════════════════════════════════════════════ */
export const PATH_ICONS: [string, string][] = [

View file

@ -27,6 +27,7 @@ import { timeline } from "./adminSchema/timeline.ts";
import { frontPage } from "./adminSchema/frontPage.ts";
import { blogPosts, communityPage } from "./adminSchema/blog.ts";
import { siteSettings } from "./adminSchema/siteSettings.ts";
import { organizationPage } from "./adminSchema/organizationPage.ts";
export const ADMIN_ENTITIES: Record<string, any> = {
organizations,
@ -38,6 +39,7 @@ export const ADMIN_ENTITIES: Record<string, any> = {
front_page: frontPage,
blog_posts: blogPosts,
community_page: communityPage,
organization_page: organizationPage,
site_settings: siteSettings,
};

View file

@ -0,0 +1,71 @@
/* Pages → Organization page: the /organization page's own content.
Server side: server/src/admin-schema/organizationPage.js. Each
section's blocks are their own collection; the Leadership blocks
are where the teams go, a People block each, in order. */
import { blocksChild } from "./shared.ts";
/* A block collection for one section: the shared block editor,
without "Shown in" (these blocks only ever show on the page). */
const sectionBlocks = (key: string, label: string, note: string) => ({
...blocksChild,
key,
label,
note,
fields: blocksChild.fields.filter((field) => field.path !== "slot"),
});
export const organizationPage = {
key: "organization_page",
label: "Organization page",
singular: "organization page",
idLabel: "Page",
singleton: "organization",
list: { columns: [], filters: [] },
groups: [
{
legend: "Mission, Vision & Values",
note: "The page's first section. Its content is the Mission blocks below.",
fields: [{ path: "mission_title", label: "Heading", help: "Default: Mission, Vision & Values" }],
},
{
legend: "Leadership",
note: "The second section: the Leadership blocks below, then Volunteering.",
fields: [
{ path: "leadership_title", label: "Heading", help: "Default: Leadership" },
{ path: "leadership_blurb", label: "Blurb", widget: "textarea", full: true },
],
},
{
legend: "Volunteering",
note: "Under the leadership: a title, a line or two and the links below.",
fields: [
{ path: "volunteer_title", label: "Title", help: "Default: Volunteering" },
{ path: "volunteer_blurb", label: "Blurb", widget: "textarea", full: true },
],
},
],
children: [
sectionBlocks("mission_blocks", "Mission blocks", "The Mission, Vision & Values section: headings, paragraphs, lists, whatever it needs."),
sectionBlocks(
"leadership_blocks",
"Leadership blocks",
"The Leadership section, in order: eg. a People block for the Board of Trustees, then one for the Retreat Team.",
),
{
key: "volunteer_links",
label: "Volunteering links",
note: "Buttons under the volunteering blurb.",
addLabel: "Add link",
title: (row) => row.label || row.url || "New link",
blank: { label: "", url: "" },
fields: [
{ path: "label", label: "Label", required: true, help: "eg. Volunteer at a retreat" },
{ path: "url", label: "Link", required: true, full: true, help: "A page on this site (eg. /request) or anywhere else" },
],
},
],
};

38
src/lib/frontPageBands.ts Normal file
View file

@ -0,0 +1,38 @@
/* ═══════════════════════════════════════════════════════════════
FRONT PAGE BANDS
Each band the front page can show (front_page_sections.section):
the anchor it sits at, and the heading it gets when the admin gives
it none. Home.tsx draws the bands; the nav and footer list the ones
the front page is showing (navSections.ts). The countdown has no
anchor: it's a card under the hero, not a section to jump to.
═══════════════════════════════════════════════════════════════ */
import type { FrontPage, FrontPageSectionKey } from './useFrontPage.ts'
export const FRONT_PAGE_BANDS: Record<FrontPageSectionKey, { id: string | null; title: string }> = {
countdown: { id: null, title: 'Next up' },
retreats: { id: 'retreats', title: 'National Retreats' },
calendar: { id: 'calendar', title: 'What’s on' },
stats: { id: 'numbers', title: 'By the numbers' },
timeline: { id: 'story', title: 'Our story so far' },
connect: { id: 'connect', title: 'Find your way in' },
featured: { id: 'featured', title: 'Featured' },
}
/* Whether a band has anything to draw: Home.tsx leaves out a band
with nothing in it, and so does the nav. */
export function bandShows(page: FrontPage, key: FrontPageSectionKey): boolean {
switch (key) {
case 'countdown':
return Boolean(page.countdown)
case 'stats':
return page.stats.length > 0
case 'connect':
return page.paths.length > 0
case 'featured':
return page.featured.length > 0
default:
return true
}
}

34
src/lib/navSections.ts Normal file
View file

@ -0,0 +1,34 @@
/* ═══════════════════════════════════════════════════════════════
NAV SECTIONS: the sections listed under each page in the header's
dropdowns, the mobile menu and the footer's site map
The static pages' lists are PAGE_SECTIONS in navConfig.ts. The
front page's comes from the front page itself: the bands it is
showing, in the admin's order, each under its heading (Front page
→ Sections), so hiding a band or renaming it changes the menus too.
═══════════════════════════════════════════════════════════════ */
import { useCallback } from 'react'
import { PAGE_SECTIONS } from '../navConfig.ts'
import { useFrontPage } from './useFrontPage.ts'
import { FRONT_PAGE_BANDS, bandShows } from './frontPageBands.ts'
export type NavSection = { label: string; hash: string }
export function useNavSections(): (path: string) => NavSection[] {
const { data: page } = useFrontPage()
return useCallback(
(path: string) => {
if (path !== '/') return PAGE_SECTIONS[path] ?? []
if (!page) return []
return page.sections.flatMap((section) => {
const band = FRONT_PAGE_BANDS[section.section]
if (!band?.id || !bandShows(page, section.section)) return []
return [{ label: section.title || band.title, hash: `#${band.id}` }]
})
},
[page],
)
}

View file

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

View file

@ -5,21 +5,15 @@ export const PAGE_LINKS = [
{ label: "Home", path: "/" },
{ label: "Retreats", path: "/retreats" },
{ label: "Community", path: "/community" },
{ label: "Organization", path: "/organization" },
{ label: "Resources", path: "/resources" },
{ label: "Organization", path: "/organization" },
{ label: "History", path: "/history" },
];
// Sections belong to a page, keyed by that page's path.
// A page with no sections gets no subnav row.
export const PAGE_SECTIONS = {
"/": [
{ label: "#Featured", hash: "#hero" },
{ label: "#Connect", hash: "#connect" },
{ label: "#Retreats", hash: "#retreats" },
{ label: "#Calendar", hash: "#calendar" },
{ label: "#About", hash: "#numbers" },
],
// Sections belong to a page, keyed by that page's path: the header's
// dropdowns, the mobile menu and the footer list them (navSections.ts).
// The front page's aren't here: they follow the bands it's showing.
export const PAGE_SECTIONS: Record<string, Array<{ label: string; hash: string }>> = {
"/retreats": [
{ label: "National", hash: "#national" },
{ label: "Regional", hash: "#regional" },

View file

@ -87,6 +87,7 @@ export default function CommunityPage() {
return (
<PageShell
sideNav
title={PAGE.title}
intro={PAGE.description}
sections={sections}

View file

@ -70,6 +70,7 @@ export default function History() {
return (
<PageShell
sideNav
title={PAGE.title}
intro={PAGE.description}
sections={[

View file

@ -41,6 +41,7 @@ import {
type FrontPageSection,
type FrontPageSectionKey,
} from '../lib/useFrontPage.ts'
import { FRONT_PAGE_BANDS, bandShows } from '../lib/frontPageBands.ts'
import './sections/home/home.css'
type BandProps = {
@ -51,56 +52,26 @@ type BandProps = {
position: number
}
/* Default headings for a band the admin didn't title, and how each
one renders. The ids are the page anchors, #connect is what the
hero's second button points at out of the box. */
const SECTIONS: Record<
FrontPageSectionKey,
{ title: string; render: (props: BandProps) => ReactNode }
> = {
countdown: {
title: 'Next up',
render: ({ page, position }) =>
page.countdown && <NextEventCountdown event={page.countdown} overlap={position === 0} />,
},
retreats: {
title: 'National Retreats',
render: ({ section, title }) => (
<RetreatsBand id="retreats" title={title} blurb={section.blurb} />
),
},
calendar: {
title: 'What’s on',
render: ({ section, title }) => (
<CalendarBand id="calendar" title={title} blurb={section.blurb} />
),
},
stats: {
title: 'By the numbers',
render: ({ page, section, title }) =>
page.stats.length > 0 && (
<StatsBand id="numbers" title={title} blurb={section.blurb} stats={page.stats} />
),
},
timeline: {
title: 'Our story so far',
render: ({ section, title }) => (
<FeaturedTimelineRail id="story" title={title} blurb={section.blurb} />
),
},
connect: {
title: 'Find your way in',
render: ({ page, section, title }) => (
<Pathfinder id="connect" title={title} blurb={section.blurb} paths={page.paths} />
),
},
featured: {
title: 'Featured',
render: ({ page, section, title }) =>
page.featured.length > 0 && (
<FeaturedBand id="featured" title={title} blurb={section.blurb} cards={page.featured} />
),
},
/* How each band renders. Its anchor, its heading when the admin
gave it none, and whether it has anything to draw are
frontPageBands.ts's, which the nav and footer read too; #connect is
what the hero's second button points at out of the box. */
const id = (key: FrontPageSectionKey) => FRONT_PAGE_BANDS[key].id ?? undefined
const BANDS: Record<FrontPageSectionKey, (props: BandProps) => ReactNode> = {
countdown: ({ page, position }) => <NextEventCountdown event={page.countdown!} overlap={position === 0} />,
retreats: ({ section, title }) => <RetreatsBand id={id('retreats')!} title={title} blurb={section.blurb} />,
calendar: ({ section, title }) => <CalendarBand id={id('calendar')!} title={title} blurb={section.blurb} />,
stats: ({ page, section, title }) => (
<StatsBand id={id('stats')!} title={title} blurb={section.blurb} stats={page.stats} />
),
timeline: ({ section, title }) => <FeaturedTimelineRail id={id('timeline')!} title={title} blurb={section.blurb} />,
connect: ({ page, section, title }) => (
<Pathfinder id={id('connect')!} title={title} blurb={section.blurb} paths={page.paths} />
),
featured: ({ page, section, title }) => (
<FeaturedBand id={id('featured')!} title={title} blurb={section.blurb} cards={page.featured} />
),
}
export default function Home() {
@ -138,15 +109,16 @@ export default function Home() {
)}
{page?.sections.map((section, position) => {
const band = SECTIONS[section.section]
// A key the CHECK has gained since this file was written.
if (!band) return null
const render = BANDS[section.section]
// A key the CHECK has gained since this file was written, or a
// band with nothing to draw.
if (!render || !bandShows(page, section.section)) return null
return (
<div key={section.section}>
{band.render({
{render({
page,
section,
title: section.title || band.title,
title: section.title || FRONT_PAGE_BANDS[section.section].title,
position,
})}
</div>

View file

@ -1,50 +1,49 @@
/* ═══════════════════════════════════════════════════════════════
ORGANIZATION: /organization (it was /leadership, which the API
redirects here)
ORGANIZATION: /organization
NGU itself, in three parts:
NGU itself, in three parts, edited in the admin as Pages →
Organization page (GET /organization-page):
mission Mission, Vision & Values: the national organization
record's own description and content blocks (Data →
Organizations → NGU), so editors change them with the
block editor
leadership that record's teams, each with its people (OrgTeams):
the Board of Trustees, the Retreat Team, committees
and volunteers, in the admin's order
mission Mission, Vision & Values: the page's mission blocks
leadership its leadership blocks, in order (a People block per
team: the Board of Trustees, then the Retreat Team),
then Volunteering: a title, a blurb and its links
contact NGU's address, nonprofit status and email
(src/data/organizationDetails.ts), and the record's
own contact links (OrgContact)
(src/data/organizationDetails.ts)
The record is the one organization of kind national, found rather
than named, so its URL ID can change.
A section with nothing written yet says so (ComingSoon) rather
than showing a heading over nothing.
═══════════════════════════════════════════════════════════════ */
import PageShell from '../components/PageShell.tsx'
import ComingSoon from '../components/ComingSoon.tsx'
import ContentBlocks from '../components/ContentBlocks.tsx'
import OrgTeams, { hasTeams } from '../components/OrgTeams.tsx'
import OrgContact from '../components/OrgContact.tsx'
import HomeLink from './sections/home/HomeLink.tsx'
import { sitePage } from '../lib/site.ts'
import { useOrganizations } from '../lib/organizations.ts'
import { useOrganization, type OrganizationRecord } from '../lib/useContent.ts'
import { useRecord } from '../lib/useRecord.ts'
import type { ContentBlock } from '../lib/useContent.ts'
import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts'
import { ACCENTS, BRAND } from '../lib/color.ts'
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage('/organization')
type OrganizationPage = {
mission_title?: string | null
mission_blocks: ContentBlock[]
leadership_title?: string | null
leadership_blurb?: string | null
leadership_blocks: ContentBlock[]
volunteer: { title?: string | null; blurb?: string | null; links: Array<{ label: string; url: string }> }
}
export default function Organization() {
const national = useOrganizations('national')
const id = national.organizations[0]?.id
const record = useOrganization(id)
const org = record.data ?? null
const failed = national.error || record.error
const loading = !failed && !org && (national.loading || record.loading || Boolean(id))
const { data: page, loading, error } = useRecord<OrganizationPage>('/organization-page', 'page')
const pending = (what: string) =>
failed ? (
error ? (
<p className="mx-auto max-w-6xl px-6 text-danger">Couldn’t load {what} right now.</p>
) : loading ? (
) : loading || !page ? (
<div className="mx-auto max-w-6xl px-6">
<div className="skeleton !min-h-40" aria-label={`Loading ${what}`} />
</div>
@ -54,59 +53,78 @@ export default function Organization() {
<PageShell
title={PAGE.title}
intro={PAGE.description}
sideNav
sections={[
{
id: 'mission',
title: 'Mission, Vision & Values',
title: page?.mission_title || 'Mission, Vision & Values',
accent: BRAND,
content: pending('our mission') ?? <Mission org={org} />,
content:
pending('our mission') ??
(page!.mission_blocks.length > 0 ? (
<div className="mx-auto max-w-6xl px-6">
<div className="max-w-3xl">
<ContentBlocks blocks={page!.mission_blocks} accent={BRAND} />
</div>
</div>
) : (
<ComingSoon what="our mission, vision and values" />
)),
},
{
id: 'leadership',
title: 'Leadership',
blurb: 'Our board, retreat team, committees and volunteers.',
title: page?.leadership_title || 'Leadership',
blurb: page?.leadership_blurb ?? undefined,
accent: ACCENTS.green,
content:
pending('our leadership') ??
(org && hasTeams(org) ? (
<div className="mx-auto max-w-6xl px-6">
<OrgTeams org={org} accent={ACCENTS.green} />
</div>
) : (
<ComingSoon what="our leadership list" />
)),
content: pending('our leadership') ?? <Leadership page={page!} />,
},
{
id: 'contact',
title: 'Details & Contact',
accent: ACCENTS.deep,
content: <Contact org={org} />,
content: <Contact />,
},
]}
/>
)
}
function Mission({ org }: { org: OrganizationRecord | null }) {
const paragraphs = org?.description ?? []
const blocks = org?.blocks ?? []
if (paragraphs.length === 0 && blocks.length === 0) return <ComingSoon what="our mission, vision and values" />
function Leadership({ page }: { page: OrganizationPage }) {
const { volunteer } = page
const hasVolunteering = Boolean(volunteer.title || volunteer.blurb || volunteer.links.length)
return (
<div className="mx-auto max-w-6xl space-y-6 px-6">
{paragraphs.map((paragraph, index) => (
<p key={index} className="max-w-3xl text-lg leading-relaxed text-body">
{paragraph}
</p>
))}
<div className="max-w-3xl">
<ContentBlocks blocks={blocks} accent={BRAND} />
</div>
<div className="mx-auto max-w-6xl space-y-14 px-6">
{page.leadership_blocks.length > 0 ? (
<ContentBlocks blocks={page.leadership_blocks} accent={ACCENTS.green} />
) : (
<ComingSoon what="our leadership list" />
)}
{hasVolunteering && (
<div className="max-w-3xl">
<h3 className="text-2xl font-bold text-ink">{volunteer.title || 'Volunteering'}</h3>
{volunteer.blurb && <p className="mt-2 leading-relaxed text-body">{volunteer.blurb}</p>}
{volunteer.links.length > 0 && (
<div className="mt-5 flex flex-wrap gap-3">
{volunteer.links.map((link) => (
<HomeLink
key={`${link.url}-${link.label}`}
url={link.url}
className="btn inline-block bg-action px-5 py-2.5 text-white transition-colors hover:bg-action-hover"
>
{link.label}
</HomeLink>
))}
</div>
)}
</div>
)}
</div>
)
}
function Contact({ org }: { org: OrganizationRecord | null }) {
function Contact() {
const details = ORGANIZATION_DETAILS
return (
<div className="mx-auto grid max-w-6xl gap-8 px-6 md:grid-cols-2">
@ -122,14 +140,13 @@ function Contact({ org }: { org: OrganizationRecord | null }) {
{details.nonprofit} Tax ID: {details.taxId}.
</p>
</div>
<div className="space-y-4">
<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>
{org && <OrgContact org={org} accent={ACCENTS.deep} />}
</div>
</div>
)

View file

@ -33,6 +33,7 @@ const SECTIONS = [
export default function ResourcesPage() {
return (
<PageShell
sideNav
title={PAGE.title}
intro={PAGE.description}
sections={SECTIONS}

View file

@ -112,6 +112,7 @@ export default function RetreatsPage() {
return (
<PageShell
sideNav
title={PAGE.title}
intro={PAGE.description}
sections={sections}

View file

@ -105,6 +105,11 @@ export const PAGES_NAV = {
label: "Community blog section",
blurb: "The Community page's blog: headings, pinned posts and feeds.",
},
{
to: "/admin/organization_page",
label: "Organization page",
blurb: "Mission, vision and values, the leadership teams in order, and volunteering.",
},
],
};

View file

@ -18,7 +18,8 @@
import { CaretDown } from '@phosphor-icons/react';
import { useState } from "react";
import { post, ApiError } from "../../lib/api.ts";
import { PAGE_LINKS, PAGE_SECTIONS } from "../../navConfig.ts";
import { PAGE_LINKS } from "../../navConfig.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'
@ -175,7 +176,8 @@ export function TilePicker({
/* ── Where on the site ───────────────────────────────────────── */
function LocationPicker({ page, section, onPageChange, onSectionChange }) {
const sections = page === SITE_WIDE ? [] : PAGE_SECTIONS[page] ?? [];
const sectionsOf = useNavSections();
const sections = page === SITE_WIDE ? [] : sectionsOf(page);
return (
<div>
@ -228,10 +230,10 @@ function LocationPicker({ page, section, onPageChange, onSectionChange }) {
}
// Human-readable version of the picked location, for the thank-you panel.
function describeLocation(page, section) {
function describeLocation(page, section, sectionsOf: (path: string) => NavSection[]) {
if (page === SITE_WIDE) return null;
const pageLabel = PAGE_LINKS.find((p) => p.path === page)?.label ?? page;
const sectionLabel = (PAGE_SECTIONS[page] ?? []).find(
const sectionLabel = sectionsOf(page).find(
(s) => s.hash === section,
)?.label;
return sectionLabel ? `${pageLabel} → ${sectionLabel}` : pageLabel;
@ -240,6 +242,7 @@ function describeLocation(page, section) {
/* ── The form ────────────────────────────────────────────────── */
export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) {
const sectionsOf = useNavSections();
const request = fixedType === DATA_REQUEST.id;
const [type, setType] = useState<any>(fixedType ?? null);
const [page, setPage] = useState(SITE_WIDE);
@ -309,7 +312,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
}
if (status === "sent") {
const where = describeLocation(page, section);
const where = describeLocation(page, section, sectionsOf);
return (
<div
aria-live="polite"

View file

@ -34,7 +34,8 @@
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, PAGE_SECTIONS } from '../../navConfig.ts'
import { NAV_ACTIONS, PAGE_LINKS } from '../../navConfig.ts'
import { useNavSections } from '../../lib/navSections.ts'
import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts'
import { siteUrl } from '../../lib/site.ts'
import { useDirectory, type Directory } from '../../lib/useContent.ts'
@ -252,6 +253,7 @@ function downloadPng(svg: SVGSVGElement, stem: string) {
}
export default function QrCodeMaker() {
const sectionsOf = useNavSections();
const { data: directory, loading, error } = useDirectory()
const [kind, setKind] = useState<Kind>('pages')
@ -277,7 +279,7 @@ export default function QrCodeMaker() {
}
}, [choices, path])
const sections = kind === 'pages' ? (PAGE_SECTIONS[path] ?? []) : []
const sections = kind === 'pages' ? sectionsOf(path) : []
const selected = choices.find((c) => c.path === path) ?? null
const typed = kind === 'custom' ? typedUrl(custom) : null
const target = kind === 'custom' ? typed : selected ? `${selected.path}${section}` : null

View file

@ -21,7 +21,7 @@
are cells of the same block.
═══════════════════════════════════════════════════════════════ */
import { ArrowRight, ArrowUpRight, BookOpen, CalendarBlank, ChatCircle, Compass, GraduationCap, HandHeart, Heart, House, MapPin, MusicNotes, Sparkle, Star, Tent, UsersThree, type Icon } from '@phosphor-icons/react'
import { ArrowRight, ArrowUpRight, BookOpen, Dot, CalendarBlank, ChatCircle, Compass, GraduationCap, HandHeart, Heart, House, MapPin, MusicNotes, Sparkle, Star, Tent, UsersThree, type Icon } from '@phosphor-icons/react'
import { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react'
import HomeLink, { isExternal } from './HomeLink.tsx'
@ -38,8 +38,7 @@ type PathfinderProps = {
/* One accent per position, cycling. Paths are data; color is
presentation, so it's assigned here rather than stored. */
/* A path's icon: a key from src/data/pathIcons.ts, drawn from
Phosphor. A path saved before the list existed may hold an emoji;
that shows as it is. Nothing set is a dot. */
Phosphor. Nothing set (or a key no longer on the list) is a dot. */
const ICONS: Record<string, Icon> = {
heart: Heart,
hands: HandHeart,
@ -60,7 +59,7 @@ const ICONS: Record<string, Icon> = {
function PathIcon({ value }: { value?: string | null }) {
const Glyph = value ? ICONS[value] : null
if (Glyph) return <Glyph size={26} weight="bold" />
return <>{value || '•'}</>
return <Dot size={26} weight="bold" />
}
// The site's accent family, in turn (color.ts).