Page updates: v1.10.3 to v1.10.6 #20
16 changed files with 283 additions and 237 deletions
|
|
@ -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. |
|
||||
|
|
|
|||
|
|
@ -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}>
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)}
|
||||
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
38
src/lib/frontPageBands.ts
Normal file
38
src/lib/frontPageBands.ts
Normal 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
34
src/lib/navSections.ts
Normal 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],
|
||||
)
|
||||
}
|
||||
|
|
@ -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" },
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ export default function CommunityPage() {
|
|||
|
||||
return (
|
||||
<PageShell
|
||||
sideNav
|
||||
title={PAGE.title}
|
||||
intro={PAGE.description}
|
||||
sections={sections}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ export default function History() {
|
|||
|
||||
return (
|
||||
<PageShell
|
||||
sideNav
|
||||
title={PAGE.title}
|
||||
intro={PAGE.description}
|
||||
sections={[
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ const SECTIONS = [
|
|||
export default function ResourcesPage() {
|
||||
return (
|
||||
<PageShell
|
||||
sideNav
|
||||
title={PAGE.title}
|
||||
intro={PAGE.description}
|
||||
sections={SECTIONS}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ export default function RetreatsPage() {
|
|||
|
||||
return (
|
||||
<PageShell
|
||||
sideNav
|
||||
title={PAGE.title}
|
||||
intro={PAGE.description}
|
||||
sections={sections}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue