Page updates: v1.10.3 to v1.10.6 #20

Merged
ngu-git-admin merged 19 commits from page-updates into main 2026-10-01 09:23:31 +01:00
16 changed files with 283 additions and 237 deletions
Showing only changes of commit ed0f12022f - Show all commits

View file

@ -267,7 +267,7 @@ The numbers band's "Number Source" dropdown works the same way:
| What | File | Notes | | 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`. | | 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. | | 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. | | History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |

View file

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

View file

@ -1,7 +1,8 @@
import { X, List } from "@phosphor-icons/react"; import { X, List } from "@phosphor-icons/react";
import { Suspense, useState, useEffect, useRef } from "react"; import { Suspense, useState, useEffect, useRef } from "react";
import { NavLink, Link, Outlet, useLocation } from "react-router-dom"; 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 Banner from "./Banner.tsx";
import siteLogo from "../assets/logos/NGU_Logo.svg"; import siteLogo from "../assets/logos/NGU_Logo.svg";
import Footer from "./Footer.tsx"; import Footer from "./Footer.tsx";
@ -76,23 +77,18 @@ const navActions = NAV_ACTIONS as NavActionItem[];
export default function Layout() { export default function Layout() {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const [activeSection, setActiveSection] = useState<string | null>(null); // Measured below; this first guess keeps the content from jumping
// Measured below; this first guess (nav, plus the section strip on // when it lands.
// pages that have one) keeps the content from jumping when it lands. const [headerHeight, setHeaderHeight] = useState(72);
const [headerHeight, setHeaderHeight] = useState(() =>
72 + ((PAGE_SECTIONS[window.location.pathname] ?? []).length ? 36 : 0),
);
const headerRef = useRef<HTMLElement>(null); const headerRef = useRef<HTMLElement>(null);
const closeMenuRef = useRef<HTMLButtonElement>(null); const closeMenuRef = useRef<HTMLButtonElement>(null);
const location = useLocation(); const location = useLocation();
const sections = PAGE_SECTIONS[location.pathname] ?? []; const sectionsOf = useNavSections();
const activePage = PAGE_LINKS.find((p) => p.path === location.pathname);
// Close the mobile menu whenever the route changes // Close the mobile menu whenever the route changes
useEffect(() => { useEffect(() => {
setMobileMenuOpen(false); setMobileMenuOpen(false);
setActiveSection(null);
}, [location.pathname]); }, [location.pathname]);
// The open menu is modal: focus starts on its close button, Escape // 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); return () => window.removeEventListener("keydown", onKey);
}, [mobileMenuOpen]); }, [mobileMenuOpen]);
// The header grows and shrinks: the banner can be dismissed and the // The header grows and shrinks: the banner can be dismissed, and
// subnav only exists on some pages. Measure it instead of guessing, // wraps on a narrow screen. Measure it instead of guessing, so the
// so the spacer below always matches. // spacer below always matches.
useEffect(() => { useEffect(() => {
const el = headerRef.current; const el = headerRef.current;
if (!el) return; if (!el) return;
@ -132,33 +128,6 @@ export default function Layout() {
window.scrollTo({ top: 0 }); window.scrollTo({ top: 0 });
}, [location.pathname, location.hash, location.key]); }, [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 ( return (
// overflow-x-clip, not -hidden: hidden makes this div a scroll // overflow-x-clip, not -hidden: hidden makes this div a scroll
// container, and then nothing inside it can be position: sticky // container, and then nothing inside it can be position: sticky
@ -195,14 +164,19 @@ export default function Layout() {
<img src={siteLogo} alt="Next Generation of Unity" className="h-10 w-auto" /> <img src={siteLogo} alt="Next Generation of Unity" className="h-10 w-auto" />
</Link> </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"> <div className="hidden lg:flex items-center gap-6">
{PAGE_LINKS.map((page) => ( {PAGE_LINKS.map((page) => {
const pageSections = sectionsOf(page.path);
return (
<div key={page.path} className="group relative">
<NavLink <NavLink
key={page.path}
to={page.path} to={page.path}
end={page.path === "/"} end={page.path === "/"}
className={({ isActive }) => className={({ isActive }) =>
`text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${ `block text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${
isActive isActive
? "text-white border-[#9cc47c]" ? "text-white border-[#9cc47c]"
: "text-white/75 hover:text-white border-transparent" : "text-white/75 hover:text-white border-transparent"
@ -211,7 +185,30 @@ export default function Layout() {
> >
{page.label} {page.label}
</NavLink> </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>
</div> </div>
@ -235,43 +232,6 @@ export default function Layout() {
</div> </div>
</nav> </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> </header>
<PageBackdrop /> <PageBackdrop />
@ -313,7 +273,7 @@ export default function Layout() {
<div className="w-64"> <div className="w-64">
{PAGE_LINKS.map((page) => { {PAGE_LINKS.map((page) => {
const pageSections = PAGE_SECTIONS[page.path] ?? []; const pageSections = sectionsOf(page.path);
const isActive = location.pathname === page.path; const isActive = location.pathname === page.path;
return ( return (

View file

@ -5,6 +5,11 @@
heading with a blurb and rule. Sections paint no background of heading with a blurb and rule. Sections paint no background of
their own: the page's (PageBackdrop.tsx) runs behind all of them. their own: the page's (PageBackdrop.tsx) runs behind all of them.
`sideNav` adds an "On this page" 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 Whatever goes inside a section is passed as `content`, the shell
doesn't care what it is. doesn't care what it is.
@ -33,6 +38,7 @@ import { useEffect, type ReactNode } from "react";
import { documentTitle } from "../lib/site.ts"; import { documentTitle } from "../lib/site.ts";
import { accentText, BRAND } from '../lib/color.ts' import { accentText, BRAND } from '../lib/color.ts'
import { SectionNav } from "./admin/SectionNav.tsx";
export type ShellSection = { export type ShellSection = {
@ -48,6 +54,8 @@ type PageShellProps = {
title: ReactNode; title: ReactNode;
intro?: ReactNode; intro?: ReactNode;
sections: ShellSection[]; sections: ShellSection[];
/** An "On this page" column beside the sections, from lg up. */
sideNav?: boolean;
}; };
export function Section({ section }: { section: ShellSection }) { 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 // 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 // comes from the server (pageMeta.js), which also sets the page's
// description and preview for search and link sharing. // 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); if (typeof title === "string") document.title = documentTitle(title);
}, [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 ( return (
<> <>
{/* Page header */} {/* Page header */}
@ -109,16 +126,18 @@ export default function PageShell({ title, intro, sections }: PageShellProps) {
</div> </div>
</div> </div>
{sections.map((section, i) => ( {sideNav ? (
<div key={section.id}> <div className="lg:grid lg:grid-cols-[13rem_minmax(0,1fr)]">
{/* Thin solid banner between sections */} <aside className="hidden lg:block">
<div className="h-2" style={{ background: section.accent }} /> <div className="sticky pt-8 pl-6" style={{ top: "calc(var(--header-h, 5rem) + 1rem)" }}>
<Section section={section} /> <SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} />
{i === sections.length - 1 && (
<div className="h-2" style={{ background: section.accent }} />
)}
</div> </div>
))} </aside>
<div className="min-w-0">{bands}</div>
</div>
) : (
bands
)}
</> </>
); );

View file

@ -1,7 +1,8 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
EDITOR SECTION NAV 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 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 with a "Jump to" menu. Both list the same sections, which
EntityEdit derives from the manifest (field groups, then child EntityEdit derives from the manifest (field groups, then child

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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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