Compare commits

...

20 commits

Author SHA1 Message Date
3e4a725c99 Merge page-updates (v1.10.3 to v1.10.6) 2026-10-01 09:23:30 +01:00
Zaldimmar
af58e8fab5 Version v1.10.6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 01:21:59 -05:00
Zaldimmar
e8ac242e6d Newsletter drafts with content blocks, a footer and Post as blog post; Home has no header dropdown
Tools → Newsletter saves drafts (migration 057: newsletters, with
content blocks owned 'newsletter'), adds blocks written for the issue
and an editable footer (no unsubscribe link: Mailchimp adds one), and
turns a draft into an unpublished blog post. The admin engine binds
child owner ids as text, so an auto-numbered record's blocks are
owned by '1', not '1.0'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 00:21:32 -05:00
Zaldimmar
9daf7b1a4f Page editors: Retreats, Community, Resources, Organization and History built from sections
Each page is now a list of sections edited in Admin → Pages: a title
(30 characters at most, for the side nav), URL ID, blurb and accent,
its own content blocks, and an optional preset (Community blog, groups
map, region list, partner cards, events, timeline, NGU's details).
Migration 056 seeds every page as the code drew it and moves the
Organization editor's blocks and volunteering into its sections. The
Community blog's settings move into the Community editor. The header,
footer and side nav read each page's sections from the API.

The admin engine reads and writes nested collections to any depth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 00:15:30 -05:00
Zaldimmar
4a1d6fd6e9 Footer site map full width; side nav fits 30-character titles over full-width dividers; Timeline under Data
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 00:04:29 -05:00
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
Zaldimmar
1da79c128b Version v1.10.4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 23:18:52 -05:00
Zaldimmar
8d319bcaaa Mobile: community map, cards, schedule, stats, banner, tap targets
- The community map keeps a readable size on a phone and scrolls
  sideways in its own box; group cards wrap their controls under the
  name, with smaller logos and 40px buttons; group details likewise.
- Org list cards, the stats numbers and the front page timeline rail
  cards size down on phones (the stats band unchanged from sm up).
- Schedule entries put the time on its own line on a phone; 40px
  fold-out toggles.
- The banner gives its text the room on a phone, with a 40px
  dismiss button.
- Email addresses may break anywhere (one rule for every mailto:
  link), so a long one can't push past the screen.
- Footer site-map links, the arrow links and the accessibility
  panel's close button are larger targets; the open accessibility
  panel sits above the privacy notice; the timeline's "still to
  come" list reads in full on touch screens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:44:27 -05:00
Zaldimmar
a907a47c24 Mobile: menu, page titles, hero, retreat carousel, people tiles
- The mobile menu centers when it fits and starts at the top when
  it's taller than the screen (safe center), so its top is
  reachable; its close button is a 44px target.
- Page titles and the hero headline start a size smaller on phones
  and break long words instead of being cut off.
- Hero: the split buttons stack on a phone (the slash from sm); the
  slide dots and pause button are 40px targets and wrap; photo heroes
  leave room for the caption above the buttons.
- Retreat carousel: phone-sized padding and type; on a phone the
  arrows sit beside the dots instead of over the text, dots are 40px
  targets, and a swipe turns it. The narrow event card layout gives
  the logo its own row (it had made a stray column).
- People tiles: the details panel slides to stay on screen with its
  notch under the tile; a third column only when tiles keep 60% of
  their width; a 40px close button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:42:20 -05:00
Zaldimmar
2a926971f7 A newsletter builder (Tools → Newsletter)
Tick upcoming events, published blog posts and the front page's
featured cards, write a title and intro, and copy an email-ready
newsletter (table layout, inline styles, the palette in hex, a
plain-text copy alongside) into Mailchimp, Gmail or Church Center,
or download it. Picked posts are read from their public pages, so
only live posts make it in; links and images point at the live
site. Nothing is sent or stored. The builder is src/lib/newsletter.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:38:04 -05:00
Zaldimmar
177a65005e An accessibility button: a dyslexia-friendly font and a reading mode
A button fixed to the bottom right of every public page opens two
switches. Dyslexia-friendly font swaps every typeface for
OpenDyslexic (self-hosted, @fontsource/opendyslexic, downloaded
only when chosen). Reading mode steps the design back: no background
circles, motion or shadows, every layout one column, larger text and
underlined links. Both are data attributes on <html>, remembered in
the browser and set before the first paint like the theme. On a
phone the privacy notice sits above the button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:34:40 -05:00
Zaldimmar
0f62b67ee0 Privacy: Church Center's page and its analytics; self-hosted Plausible
The Giving entry links ngu.churchcenteronline.com and says Church
Center's script loads with the Giving page and may use Google
Analytics in its form. Cookies and storage now say the site uses
self-hosted, cookieless Plausible Analytics and not Google
Analytics. Last updated September 30, 2026.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:29:40 -05:00
Zaldimmar
01de6272f3 People tiles: a whole list shares one row when it fits
When every group (a team's leads and members alike) fits side by
side with tiles at three quarters of full width or wider, 10 at most,
they share one line, each group's width following its head count; a
board of 7 is one row rather than 5 and 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:28:42 -05:00
Zaldimmar
bc88b45ee1 Version v1.10.3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 21:12:13 -05:00
Zaldimmar
af7e99895a Request form: short field titles with a help line, and why to send a file
Detail fields can carry a help line under the title (RequestField
help). The blog post's card field is now Short description, saying
where it shows; other long titles became short ones with the detail
in the help. The Files note explains that a blog post sent as a
.docx can be imported straight onto the site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 20:33:20 -05:00
Zaldimmar
79c4b243f5 A 404 page that suggests what the address was for
The closest static pages and public records to the failed address
(suggest.ts: letter-pair likeness of the address's last part to each
URL ID and name, and of the whole address to each path), so a typo,
a missing hyphen or an old /chapters/ link still finds its page; the
main pages below to start from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 20:32:00 -05:00
Zaldimmar
499662b59a Leadership becomes the Organization page, at /organization
Three sections: Mission, Vision & Values from the national
organization record's own description and content blocks;
Leadership as that record's teams with their people; Details &
Contact with NGU's address, nonprofit status, email and the
record's contact links. /leadership answers with a 301 to
/organization (MOVED in routes/pages.js), and a page title or intro
saved for it in Site settings moves with it (migration 054).

OrganizationDetail's team list and contact buttons are now shared
components (OrgTeams, OrgContact), and NGU's address and email live
once in src/data/organizationDetails.ts for the footer, the page and
ComingSoon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 20:30:18 -05:00
Zaldimmar
7c7cdaac14 People blocks and host teams
- A "People" content block: a team's members as people tiles, people
  picked one by one as items (each with a title), or both.
  content_blocks gains team_id (migration 054 rebuilds it for the
  type CHECK); a picked person rides on the item's person_id.
- An organization host can name a team (any organization's) to show
  in its place: event_hosts.team_id, carried by v_event_hosts. The
  event page reads "Hosted by" the team, linked to its page.
- Admin fields can show on `when: { path, filled: true }`.
- The showcase post has a people block; the past showcase event is
  hosted by the region shown as its team.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 20:26:26 -05:00
87 changed files with 3547 additions and 1364 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

@ -29,10 +29,11 @@ what a dropdown in the admin editor says.
| ------------------------------------------------------------ | ---------------- | ------------------------------------ |
| A record: an event, organization, person, team, award, timeline entry | the database | editing it in the admin |
| The front page's words, photos, bands, stats and paths | the database | Admin → Pages → Front page |
| Blog posts, and the Community page's blog section (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community blog section |
| Blog posts, and the Community page's blog settings (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community |
| The sections of Retreats, Community, Resources, Organization and History: titles, blurbs, accents, their content blocks and presets (the blog, groups map, regions, partners, events, timeline, NGU's details) | the database | Admin → Pages → the page. A section title is 30 characters at most (it's listed in the side nav); a front page heading fits about 60. Preset names: `PRESETS` in `src/lib/adminSchema/sitePages.ts`, what each draws: `PRESETS` in `src/pages/SitePage.tsx` |
| The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) |
| The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) |
| Navigation, page section titles, colors, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) |
| Navigation, colors, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) |
| A static page's title and intro (also its search title and description), the site's name, description, preview image, icons, search indexing, privacy contact email | the database, over `site.json` | Admin → Panel → Site settings (superadmins). Blank uses `site.json`, which also holds the site's address and the pages' defaults. See `docs/seo.md` |
| Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` |
@ -185,7 +186,7 @@ also in `server/src/admin-schema/` and a CHECK):
| Front page → Feature | none, livestream, video, event | **yes** | `HeroStage.tsx`; the event is picked in `server/src/routes/home.js` |
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect, featured | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) |
| Front page → Stats → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) |
| Front page → Featured cards → Card type (Community blog section → Pinned community posts offers link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` |
| Front page → Featured cards → Card type (Community → Community blog: pinned community posts offers link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` |
| Front page → Featured cards → Record type | event, organization, person, team, award | no | `FEATURED_REFS` in `server/src/shape.js` (what each fills the card with); the triggers in `030_featured_cards.sql` |
| Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a |
@ -201,7 +202,7 @@ code):
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) |
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labeled by name |
| Event hosts / event people / team members / timeline people → Person | `people` | people |
| Community blog section → Pinned posts → Post | `blog_posts` | blog posts, newest first |
| Community → Community blog: pinned posts (ours) → Post | `blog_posts` | blog posts, newest first |
| Timeline → Record; Featured cards → Record | `record_refs` | every event, organization, award, person and team, narrowed by the type picked beside it |
| Affiliations → Team | `teams` | teams, filtered to the chosen organization |
| Person awards → Award | `awards` | awards, labeled "Award (Organization)" |
@ -219,7 +220,7 @@ each is changed in a different place:
| **The heading on the page** ("National Retreats", "What's on") | **Admin → Pages → Front page → Page sections → Heading.** Blank uses the default below. |
| The default heading when that field is blank | `SECTIONS` in `src/pages/Home.tsx`, the `title` of each entry |
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema/frontPage.ts` |
| The subnav links under the header ("#Retreats", "#Calendar") | `PAGE_SECTIONS["/"]` in `src/navConfig.ts` |
| The links in the header's Home dropdown | the bands shown, under their headings (`src/lib/navSections.ts`) |
To rename a band **for visitors**, use the admin. To rename how it
reads **in the editor's dropdown**, edit `FRONT_PAGE_SECTIONS`:
@ -267,8 +268,8 @@ 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`. |
| Section titles, blurbs and colors on Retreats, Community, Leadership, 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`. |
| Header and footer navigation, each page's sections (the header dropdowns, mobile menu and footer site map) | `src/navConfig.ts` | `PAGE_LINKS` (order), `NAV_ACTIONS`. Each page's sections aren't listed there: they follow the page itself, through `src/lib/navSections.ts` (the site pages' sections from Admin → Pages; the front page's bands it shows, with `src/lib/frontPageBands.ts` giving each band's anchor and default heading). A new page also needs a route in `src/App.tsx`. |
| Section titles, blurbs and colors on Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. |
| Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. |
| History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |
| Group map tiles and area names | `src/data/mapGrid.ts` | `AREAS` (tile positions) and `AREA_NAMES`. Which region paints which tile is in the database (Admin → Data → Organizations → a region → Map areas). |

View file

@ -9,22 +9,16 @@
<meta name="theme-color" content="#073d4a" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#0c1d21" media="(prefers-color-scheme: dark)" />
<!-- Theme before first paint, so a dark visitor never sees a white
flash: this browser's choice (ThemeToggle), else the system. -->
flash: this browser's choice (ThemeToggle), else the system;
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";
// The accessibility panel's choices (AccessibilityPanel.tsx).
if (localStorage.getItem("site-font") === "dyslexic") document.documentElement.dataset.font = "dyslexic";
if (localStorage.getItem("site-reading") === "on") document.documentElement.dataset.reading = "on";
} catch (e) {}
</script>
<!-- site:head-end -->

View file

@ -11,6 +11,7 @@
},
"dependencies": {
"@fontsource/montserrat": "^5.3.0",
"@fontsource/opendyslexic": "^5.3.0",
"@fontsource/poppins": "^5.3.0",
"@phosphor-icons/react": "^2.1.10",
"qrcode": "^1.5.4",

8
pnpm-lock.yaml generated
View file

@ -11,6 +11,9 @@ importers:
'@fontsource/montserrat':
specifier: ^5.3.0
version: 5.3.0
'@fontsource/opendyslexic':
specifier: ^5.3.0
version: 5.3.0
'@fontsource/poppins':
specifier: ^5.3.0
version: 5.3.0
@ -66,6 +69,9 @@ packages:
'@fontsource/montserrat@5.3.0':
resolution: {integrity: sha512-iQPDtZOnmM5ih4JBGaMSXisRap0ixb9bAUw2hDtY7EjVfaqiiNlKtVuJl9XclxUwtwMMHNcWXfQR6zI9x05+Tg==}
'@fontsource/opendyslexic@5.3.0':
resolution: {integrity: sha512-BVYIW/ghc1U2iAghhYTN+GFWiZ3lnCy8Jf2KkZC23aHQHBNcMqKT718zckfqVxRx4qsXJmIMPWvczirRuhmtsg==}
'@fontsource/poppins@5.3.0':
resolution: {integrity: sha512-cms1nM7U6SN8epIV1WMVOV8VsA645aSm3wHfzIQnkk188U341ThbJGSl2Sv54V29gnDbT2arMPfLzvVIIVCceQ==}
@ -786,6 +792,8 @@ snapshots:
'@fontsource/montserrat@5.3.0': {}
'@fontsource/opendyslexic@5.3.0': {}
'@fontsource/poppins@5.3.0': {}
'@jridgewell/gen-mapping@0.3.13':

View file

@ -189,8 +189,9 @@ export function readRow(db, entity, rawId) {
row[ext.key] = readExtension(db, ext, id);
}
// As text, for the reason readChildren gives its nested ids.
for (const child of entity.children ?? []) {
row[child.key] = readChildren(db, child, id);
row[child.key] = readChildren(db, child, String(id));
}
return row;
@ -236,15 +237,13 @@ function readChildren(db, child, ownerId) {
)
.all(...params);
// Nested collections, to any depth: a page's sections, each
// section's blocks, each block's items. The id goes as text: a JS
// number binds as REAL, which a TEXT owner column (a section's
// blocks) holds as '13.0'; text suits an INTEGER owner just as well.
for (const child2 of child.children ?? []) {
for (const row of rows) {
row[child2.key] = db
.prepare(
`SELECT * FROM ${child2.table}
WHERE ${child2.owner.column} = ?
ORDER BY ${child2.order}`,
)
.all(row.id);
row[child2.key] = readChildren(db, child2, String(row.id));
}
}
@ -378,6 +377,14 @@ export function updateRow(db, entity, rawId, payload) {
`UPDATE ${entity.table} SET ${sets.join(", ")}
WHERE ${entity.idColumn} = ?`,
).run(...Object.values(values), id);
} else if (entity.concurrency) {
// A row that is only its collections (a site page and its
// sections) still marks the save, or the next stale save
// would pass the check above.
db.prepare(
`UPDATE ${entity.table} SET ${entity.concurrency} = datetime('now')
WHERE ${entity.idColumn} = ?`,
).run(id);
}
writeExtensions(db, entity, id, payload, merged);
@ -507,7 +514,10 @@ function keyedDbErrors(prefix, fn) {
}
}
function writeChildren(db, entity, id, payload, parentValues) {
function writeChildren(db, entity, rawId, payload, parentValues) {
// As text: an auto id is a JS number, which binds as REAL and
// lands in a TEXT owner column (a newsletter's blocks) as '1.0'.
const id = String(rawId);
for (const child of entity.children ?? []) {
if (!applies(child.when, parentValues)) {
deleteChildren(db, child, id);
@ -516,80 +526,63 @@ function writeChildren(db, entity, id, payload, parentValues) {
if (payload[child.key] === undefined) continue; // not sent, not touched
deleteChildren(db, child, id);
writeRows(db, child, id, payload[child.key], `${child.key}.`, parentValues);
}
}
const incoming = Array.isArray(payload[child.key]) ? payload[child.key] : [];
/* One collection's rows under one owner, then each row's own nested
collections under it, to any depth. Only the top level is deleted
first (writeChildren): a nested row goes with its owner, by a
foreign key's cascade or, for a polymorphic owner like a section's
blocks, by the owner table's cleanup trigger. */
function writeRows(db, child, ownerId, incomingRaw, prefix, parentValues) {
const incoming = Array.isArray(incomingRaw) ? incomingRaw : [];
// index is the row's place in what the client sent, so a
// validation error still points at the row the user is looking
// at. position counts only the rows that survive, so dropping a
// blank in the middle doesn't leave a gap in sort_order.
const rows = incoming
.map((raw, index) => ({ raw, index }))
.filter(({ raw }) => child.allowBlank || !isBlankChildRow(child, raw));
// index is the row's place in what the client sent, so a
// validation error still points at the row the user is looking
// at. position counts only the rows that survive, so dropping a
// blank in the middle doesn't leave a gap in sort_order.
const rows = incoming
.map((raw, index) => ({ raw, index }))
.filter(({ raw }) => child.allowBlank || !isBlankChildRow(child, raw));
rows.forEach(({ raw, index }, position) => {
const { values, errors } = coerceRow(child.columns, raw, {
prefix: `${child.key}.${index}.`,
});
if (Object.keys(errors).length) {
throw new HttpError(422, "Validation failed", errors);
}
rows.forEach(({ raw, index }, position) => {
const rowPrefix = `${prefix}${index}.`;
const { values, errors } = coerceRow(child.columns, raw, { prefix: rowPrefix });
if (Object.keys(errors).length) {
throw new HttpError(422, "Validation failed", errors);
}
const names = [child.owner.column, ...Object.keys(values)];
const params = [id, ...Object.values(values)];
const names = [child.owner.column, ...Object.keys(values)];
const params = [ownerId, ...Object.values(values)];
if (child.owner.kindColumn) {
names.push(child.owner.kindColumn);
params.push(child.owner.kindValue);
}
for (const [column, from] of Object.entries(child.owner.inherit ?? {})) {
if (names.includes(column)) continue;
names.push(column);
params.push(parentValues[from] ?? id);
}
if (child.order === "sort_order" && !names.includes("sort_order")) {
names.push("sort_order");
params.push(position);
}
if (child.owner.kindColumn) {
names.push(child.owner.kindColumn);
params.push(child.owner.kindValue);
}
for (const [column, from] of Object.entries(child.owner.inherit ?? {})) {
if (names.includes(column)) continue;
names.push(column);
params.push(parentValues[from] ?? ownerId);
}
if (child.order === "sort_order" && !names.includes("sort_order")) {
names.push("sort_order");
params.push(position);
}
const result = keyedDbErrors(`${child.key}.${index}.`, () =>
db
const result = keyedDbErrors(rowPrefix, () =>
db
.prepare(
`INSERT INTO ${child.table} (${names.join(", ")})
VALUES (${names.map(() => "?").join(", ")})`,
)
.run(...params),
);
);
for (const child2 of child.children ?? []) {
const incomingNested = Array.isArray(raw[child2.key]) ? raw[child2.key] : [];
const nested = incomingNested
.map((rawItem, i) => ({ rawItem, i }))
.filter(({ rawItem }) => child2.allowBlank || !isBlankChildRow(child2, rawItem));
nested.forEach(({ rawItem, i }, nestedPosition) => {
const item = coerceRow(child2.columns, rawItem, {
prefix: `${child.key}.${index}.${child2.key}.${i}.`,
});
if (Object.keys(item.errors).length) {
throw new HttpError(422, "Validation failed", item.errors);
}
const itemNames = [child2.owner.column, ...Object.keys(item.values)];
const itemParams = [result.lastInsertRowid, ...Object.values(item.values)];
if (!itemNames.includes("sort_order")) {
itemNames.push("sort_order");
itemParams.push(nestedPosition);
}
db.prepare(
`INSERT INTO ${child2.table} (${itemNames.join(", ")})
VALUES (${itemNames.map(() => "?").join(", ")})`,
).run(...itemParams);
});
}
});
}
for (const child2 of child.children ?? []) {
writeRows(db, child2, String(result.lastInsertRowid), raw[child2.key], `${rowPrefix}${child2.key}.`, values);
}
});
}
function deleteChildren(db, child, ownerId) {

View file

@ -49,8 +49,16 @@ import { teams } from "./admin-schema/teams.js";
import { awards } from "./admin-schema/awards.js";
import { timeline } from "./admin-schema/timeline.js";
import { frontPage } from "./admin-schema/frontPage.js";
import { blogPosts, communityPage } from "./admin-schema/blog.js";
import { blogPosts } from "./admin-schema/blog.js";
import { siteSettings } from "./admin-schema/siteSettings.js";
import { newsletters } from "./admin-schema/newsletters.js";
import {
communityPage,
retreatsPage,
resourcesPage,
organizationPage,
historyPage,
} from "./admin-schema/sitePages.js";
export const ENTITIES = {
organizations,
@ -62,7 +70,12 @@ export const ENTITIES = {
front_page: frontPage,
blog_posts: blogPosts,
community_page: communityPage,
retreats_page: retreatsPage,
resources_page: resourcesPage,
organization_page: organizationPage,
history_page: historyPage,
site_settings: siteSettings,
newsletters,
};
/* ── Options for the form's select inputs ────────────────────── */

View file

@ -1,11 +1,10 @@
import { text, url, int, bool, date, featuredCardsChild, blocksChild } from "./columns.js";
import { text, bool, date, blocksChild } from "./columns.js";
/* ── Blog (031_blog.sql) ─────────────────────────────────────────
Posts of our own, with a content-block body and people as
authors, and the Community page's blog section, a singleton like
the front page. The section's community posts are featured cards
owned by 'community_page'. ─────────────────────────────────── */
authors. The Community page's blog section is edited with that
page (sitePages.js). ──────────────────────────────────────── */
export const blogPosts = {
key: "blog_posts",
@ -46,48 +45,3 @@ export const blogPosts = {
blocksChild("blog_post"),
],
};
export const communityPage = {
key: "community_page",
table: "community_page",
idColumn: "id",
idKind: "slug",
singleton: "community",
concurrency: "updated_at",
list: {
columns: ["id", "blog_title", "updated_at"],
filters: [],
search: [],
order: "id",
},
columns: [
text("blog_title"),
text("blog_blurb"),
text("internal_title"),
int("internal_slots"),
text("external_title"),
int("external_slots"),
url("external_url"),
text("external_label"),
],
children: [
{
key: "pinned_posts",
table: "community_page_pinned_posts",
owner: { column: "page_id" },
order: "sort_order",
columns: [text("post_id", { required: true })],
},
featuredCardsChild("community_page"),
{
key: "feeds",
table: "community_page_feeds",
owner: { column: "page_id" },
order: "sort_order",
columns: [url("url", { required: true }), text("label")],
},
],
};

View file

@ -150,6 +150,7 @@ export const blocksChild = (ownerKind) => ({
"schedule",
"table",
"cards",
"people",
],
{ required: true },
),
@ -158,6 +159,8 @@ export const blocksChild = (ownerKind) => ({
url("href"),
text("alt"),
text("cite"),
// People blocks only (054): whose team's tiles to show.
text("team_id"),
],
children: [
{
@ -200,5 +203,6 @@ export const hostsChild = {
table: "event_hosts",
owner: { column: "event_id" },
order: "sort_order",
columns: [text("org_id"), text("person_id")],
// team_id (054): an organization host's team, shown in its place.
columns: [text("org_id"), text("person_id"), text("team_id")],
};

View file

@ -0,0 +1,27 @@
import { text, blocksChild } from "./columns.js";
/* ── Newsletter drafts (057_newsletters.sql) ─────────────────────
Saved from Tools → Newsletter (AdminNewsletter.tsx), which is
their only editor: there is no list or form for them in Data.
`picks` is the builder's JSON of what's ticked. Deleting a draft
takes its blocks with it (newsletters_cleanup). */
export const newsletters = {
key: "newsletters",
table: "newsletters",
idColumn: "id",
idKind: "auto",
concurrency: "updated_at",
list: {
columns: ["id", "title", "updated_at"],
filters: [],
search: ["title"],
order: "updated_at DESC, id DESC",
},
columns: [text("title"), text("intro"), text("footer"), text("picks")],
children: [blocksChild("newsletter")],
};

View file

@ -0,0 +1,95 @@
import { text, url, int, enumeration, featuredCardsChild, blocksChild } from "./columns.js";
/* ── The site's own pages (056_site_pages.sql) ───────────────────
Community, Retreats, Resources, Organization and History: one
site_pages row each, edited as its own singleton, with its
sections nested under it and each section's blocks under that
(the blocks' items under them, as on any record). A section is
either its blocks or a preset, a prebuilt part of the site
(SitePage.tsx draws both).
Community also carries the blog section's settings: the
community_page row (same id) as an extension, and its pinned
posts, cards and feeds, all owned by that id. */
const sectionsChild = {
key: "sections",
table: "page_sections",
owner: { column: "page_id" },
order: "sort_order",
columns: [
text("anchor", { required: true }),
text("title", { required: true }),
text("blurb"),
enumeration("accent", ["teal", "deep", "green", "amber"]),
enumeration("preset", [
"community_blog",
"group_map",
"region_list",
"partner_list",
"events",
"timeline",
"organization_details",
]),
text("scope_id"),
enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]),
enumeration("view", ["carousel", "grid", "map"]),
],
children: [blocksChild("page_section")],
};
const sitePage = (id, more = {}) => ({
key: `${id}_page`,
table: "site_pages",
idColumn: "id",
idKind: "slug",
singleton: id,
concurrency: "updated_at",
list: { columns: ["id", "updated_at"], filters: [], search: [], order: "id" },
columns: [],
...more,
children: [sectionsChild, ...(more.children ?? [])],
});
export const communityPage = sitePage("community", {
extensions: [
{
key: "blog",
table: "community_page",
idColumn: "id",
columns: [
text("internal_title"),
int("internal_slots"),
text("external_title"),
int("external_slots"),
url("external_url"),
text("external_label"),
],
},
],
children: [
{
key: "pinned_posts",
table: "community_page_pinned_posts",
owner: { column: "page_id" },
order: "sort_order",
columns: [text("post_id", { required: true })],
},
featuredCardsChild("community_page"),
{
key: "feeds",
table: "community_page_feeds",
owner: { column: "page_id" },
order: "sort_order",
columns: [url("url", { required: true }), text("label")],
},
],
});
export const retreatsPage = sitePage("retreats");
export const resourcesPage = sitePage("resources");
export const organizationPage = sitePage("organization");
export const historyPage = sitePage("history");

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 sitePages from "./routes/sitePages.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", sitePages);
// 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,140 @@
-- ═══════════════════════════════════════════════════════════════
-- 054 PEOPLE BLOCKS, HOST TEAMS, THE ORGANIZATION PAGE
--
-- A content block of type 'people': a team's people tiles, people
-- picked one by one (items, each with a title), or both. The team
-- is a new column, content_blocks.team_id; a picked person rides on
-- the item's person_id, as a schedule entry's does. ContentBlocks.tsx
-- draws it with PeopleTiles. The type CHECK changes, so the table is
-- rebuilt as 045 did (legacy_alter_table around the rename, then its
-- index and owner trigger again).
--
-- An event's organization host can name a team to show instead:
-- event_hosts.team_id, any organization's team. The event page then
-- reads "Hosted by <team>" linked to the team's page. v_event_hosts
-- carries it (and v_events, which reads v_event_hosts, is made again
-- around it, unchanged).
--
-- The Leadership page is now the Organization page, at /organization:
-- a page title or intro saved for /leadership in Site settings moves
-- with it.
-- ═══════════════════════════════════════════════════════════════
-- ── Host teams ─────────────────────────────────────────────────
ALTER TABLE event_hosts ADD COLUMN team_id TEXT REFERENCES teams (id) ON DELETE SET NULL;
DROP VIEW v_events;
DROP VIEW v_event_hosts;
CREATE VIEW v_event_hosts AS
SELECT
eh.id,
eh.event_id,
eh.sort_order,
CASE WHEN eh.person_id IS NULL THEN 'organization' ELSE 'person' END
AS host_kind,
COALESCE(eh.org_id, eh.person_id) AS host_id,
COALESCE(o.name, p.display_name) AS host_name,
o.kind AS host_org_kind,
o.logo AS host_logo,
o.color AS host_color,
p.photo AS host_photo,
COALESCE(o.is_published, p.is_published) AS host_is_published,
t.id AS host_team_id,
t.name AS host_team_name
FROM event_hosts eh
LEFT JOIN organizations o ON o.id = eh.org_id
LEFT JOIN people p ON p.id = eh.person_id
LEFT JOIN teams t ON t.id = eh.team_id AND eh.org_id IS NOT NULL AND t.is_published = 1;
CREATE VIEW v_events AS
SELECT
e.*,
h.host_kind,
h.host_id,
h.host_name,
h.host_org_kind,
COALESCE(e.org_logo, h.host_logo) AS effective_org_logo,
COALESCE(e.color, h.host_color) AS effective_color,
COALESCE(
e.status,
CASE WHEN e.ends_on IS NOT NULL AND e.ends_on < date('now')
THEN 'past' ELSE 'upcoming' END
) AS effective_status
FROM events e
LEFT JOIN v_event_hosts h
ON h.id = (
SELECT x.id
FROM v_event_hosts x
WHERE x.event_id = e.id
ORDER BY x.sort_order, x.id
LIMIT 1
);
-- ── People blocks ──────────────────────────────────────────────
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')),
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)
SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite
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);
-- ── The Organization page ──────────────────────────────────────
UPDATE site_setting_pages SET path = '/organization' WHERE path = '/leadership';
-- ── Triggers last (see CLAUDE.md, Migrations) ──
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')
END;
END;

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,221 @@
-- ═══════════════════════════════════════════════════════════════
-- 056 PAGE EDITORS: SECTIONS FOR THE SITE'S OWN PAGES
--
-- Community, Retreats, Resources, Organization and History are
-- built in the admin (Pages → each page) as a list of sections. A
-- section is its title (30 characters at most: it's listed in the
-- page's side nav), an optional blurb, an accent and the anchor it
-- sits at, and then either
--
-- its own content blocks content_blocks owned 'page_section',
-- owner_id the section's id
-- a preset a prebuilt part of the site, drawn by
-- the page (SitePage.tsx): the Community
-- blog, the group map, the region list,
-- the partner cards, an event list (scope,
-- type and the view it opens in), the
-- timeline, NGU's address and tax details
--
-- Every page's sections are seeded as the code drew them, so nothing
-- moves on the site. Organization takes what 055's editor held: its
-- Mission and Leadership blocks, with the Volunteering title, blurb
-- and links appended to the Leadership section as a heading, a
-- paragraph and link buttons; 055's tables go.
--
-- The Community blog's own settings (its slots, pinned posts, feeds)
-- stay in community_page, now edited inside the Community page
-- editor; its heading and blurb become the blog section's own, so
-- community_page loses blog_title and blog_blurb.
--
-- content_blocks is rebuilt for its owner_kind CHECK (as 055 did),
-- moving 055's blocks across on the way. A section deleted (every
-- save rewrites them) takes its blocks with it, by trigger, since
-- the owner is polymorphic and can't be a foreign key.
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE site_pages (
id TEXT PRIMARY KEY
CHECK (id IN ('community', 'retreats', 'resources', 'organization', 'history')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
) STRICT;
INSERT INTO site_pages (id) VALUES ('community'), ('retreats'), ('resources'), ('organization'), ('history');
CREATE TABLE page_sections (
id INTEGER PRIMARY KEY AUTOINCREMENT,
page_id TEXT NOT NULL REFERENCES site_pages (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
anchor TEXT NOT NULL
CONSTRAINT "A section's URL ID can use only lowercase letters, numbers and hyphens, eg. leadership."
CHECK (anchor <> '' AND anchor NOT GLOB '*[^a-z0-9-]*'),
title TEXT NOT NULL
CONSTRAINT "A section title can be 30 characters at most (it's listed in the page's side nav)."
CHECK (length(title) <= 30),
blurb TEXT,
accent TEXT CHECK (accent IN ('teal', 'deep', 'green', 'amber')),
preset TEXT CHECK (preset IN ('community_blog', 'group_map', 'region_list', 'partner_list',
'events', 'timeline', 'organization_details')),
-- An events preset's filter and first view.
scope_id TEXT REFERENCES event_scopes (id) ON DELETE SET NULL,
event_type TEXT CHECK (event_type IN ('retreat', 'class', 'workshop', 'meeting', 'other')),
view TEXT CHECK (view IN ('carousel', 'grid', 'map')),
UNIQUE (page_id, anchor)
) STRICT;
CREATE INDEX page_sections_page_idx ON page_sections (page_id, sort_order);
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view)
SELECT 'community', 0, 'blog', COALESCE(blog_title, 'Community Blog'), blog_blurb, 'teal', 'community_blog', NULL, NULL, NULL
FROM community_page WHERE id = 'community';
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view) VALUES
('community', 1, 'groups', 'Local Groups',
'Young adult groups meeting in person and online across the movement.', 'teal', 'group_map', NULL, NULL, 'map'),
('community', 2, 'regions', 'Unity Regions',
'The regional organizations that support groups and host their own gatherings.', 'deep', 'region_list', NULL, NULL, NULL),
('community', 3, 'partners', 'Partner Organizations',
'Organizations we collaborate with across the Unity movement and beyond.', 'amber', 'partner_list', NULL, NULL, NULL),
('retreats', 0, 'national', 'National Retreats',
'Our flagship gatherings, open to young adults across the country.', 'teal', 'events', 'national', 'retreat', 'carousel'),
('retreats', 1, 'regional', 'Regional Retreats',
'Smaller gatherings hosted by regions throughout the year.', 'green', 'events', 'regional', 'retreat', 'grid'),
('retreats', 2, 'partner', 'Partner Events',
'Retreats hosted by organizations we collaborate with.', 'amber', 'events', 'partner', 'retreat', 'grid'),
('resources', 0, 'unity', 'Unity Teachings',
'Core principles, readings, and study material from the Unity movement.', 'teal', NULL, NULL, NULL, NULL),
('resources', 1, 'branding', 'Branding & Marketing',
'Logos, colors, templates, and guidelines for representing NGU.', 'green', NULL, NULL, NULL, NULL),
('resources', 2, 'partner', 'Partner Resources',
'Material for the organizations we collaborate with.', 'amber', NULL, NULL, NULL, NULL),
('history', 0, 'timeline', 'NGU Timeline', 'Open a year to see what happened.', 'teal', 'timeline', NULL, NULL, NULL),
('organization', 2, 'contact', 'Details & Contact', NULL, 'deep', 'organization_details', NULL, NULL, NULL);
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, accent)
SELECT 'organization', 0, 'mission', substr(COALESCE(mission_title, 'Mission, Vision & Values'), 1, 30), NULL, 'teal'
FROM organization_page WHERE id = 'organization';
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, accent)
SELECT 'organization', 1, 'leadership', substr(COALESCE(leadership_title, 'Leadership'), 1, 30), leadership_blurb, 'green'
FROM organization_page WHERE id = 'organization';
ALTER TABLE community_page DROP COLUMN blog_title;
ALTER TABLE community_page DROP COLUMN blog_blurb;
-- ── Blocks: the new owner kind, 055's blocks moved across ──────
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', 'page_section')),
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 b.id,
CASE WHEN b.owner_kind IN ('org_page_mission', 'org_page_leadership') THEN 'page_section' ELSE b.owner_kind END,
CASE b.owner_kind
WHEN 'org_page_mission' THEN
(SELECT CAST(s.id AS TEXT) FROM page_sections s WHERE s.page_id = 'organization' AND s.anchor = 'mission')
WHEN 'org_page_leadership' THEN
(SELECT CAST(s.id AS TEXT) FROM page_sections s WHERE s.page_id = 'organization' AND s.anchor = 'leadership')
ELSE b.owner_id
END,
b.slot, b.sort_order, b.type, b.text, b.media, b.href, b.alt, b.cite, b.team_id
FROM content_blocks b;
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);
-- Volunteering, appended to the Leadership section where 055 had it.
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text)
SELECT 'page_section', CAST(s.id AS TEXT), 'body', 1000, 'heading', COALESCE(p.volunteer_title, 'Volunteering')
FROM organization_page p
JOIN page_sections s ON s.page_id = 'organization' AND s.anchor = 'leadership'
WHERE p.volunteer_title IS NOT NULL OR p.volunteer_blurb IS NOT NULL
OR EXISTS (SELECT 1 FROM organization_page_links);
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text)
SELECT 'page_section', CAST(s.id AS TEXT), 'body', 1001, 'paragraph', p.volunteer_blurb
FROM organization_page p
JOIN page_sections s ON s.page_id = 'organization' AND s.anchor = 'leadership'
WHERE p.volunteer_blurb IS NOT NULL;
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type)
SELECT 'page_section', CAST(s.id AS TEXT), 'body', 1002, 'links'
FROM page_sections s
WHERE s.page_id = 'organization' AND s.anchor = 'leadership'
AND EXISTS (SELECT 1 FROM organization_page_links);
INSERT INTO content_block_items (block_id, sort_order, text, url)
SELECT b.id, l.sort_order, l.label, l.url
FROM organization_page_links l
JOIN content_blocks b ON b.owner_kind = 'page_section' AND b.type = 'links' AND b.sort_order = 1002;
DROP TABLE organization_page_links;
DROP TABLE organization_page;
-- ── Triggers last (see CLAUDE.md, Migrations) ──
CREATE TRIGGER site_pages_touch
AFTER UPDATE ON site_pages
FOR EACH ROW WHEN new.updated_at = old.updated_at
BEGIN
UPDATE site_pages SET updated_at = datetime('now') WHERE id = new.id;
END;
CREATE TRIGGER page_sections_cleanup
AFTER DELETE ON page_sections
BEGIN
DELETE FROM content_blocks WHERE owner_kind = 'page_section' AND owner_id = CAST(old.id AS TEXT);
END;
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 = 'page_section'
AND NOT EXISTS (SELECT 1 FROM page_sections WHERE CAST(id AS TEXT) = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such page section')
END;
END;

View file

@ -0,0 +1,111 @@
-- ═══════════════════════════════════════════════════════════════
-- 057 NEWSLETTER DRAFTS
--
-- Tools → Newsletter saves what it builds as a draft, to come back
-- to, copy into Mailchimp again, or post as a blog post:
--
-- title, intro the email's heading and opening lines
-- footer the closing lines (blank: the site's name and
-- address); no unsubscribe link, since Mailchimp
-- adds its own
-- picks what's ticked, as JSON: event ids, blog post
-- ids, and the front page cards by their link
-- ({"events": [...], "posts": [...], "cards": [...]})
-- blocks content_blocks owned 'newsletter': whatever is
-- written for this issue, under the intro
--
-- content_blocks is rebuilt for its owner_kind CHECK (as 056 did). A
-- draft deleted takes its blocks with it, by trigger.
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE newsletters (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT,
intro TEXT,
footer TEXT,
picks TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(picks)),
created_at TEXT NOT NULL DEFAULT (datetime('now')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
) STRICT;
-- ── Blocks: the new owner kind ─────────────────────────────────
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', 'page_section',
'newsletter')),
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);
-- ── Triggers last (see CLAUDE.md, Migrations) ──
CREATE TRIGGER newsletters_touch
AFTER UPDATE ON newsletters
FOR EACH ROW WHEN new.updated_at = old.updated_at
BEGIN
UPDATE newsletters SET updated_at = datetime('now') WHERE id = new.id;
END;
CREATE TRIGGER newsletters_cleanup
AFTER DELETE ON newsletters
BEGIN
DELETE FROM content_blocks WHERE owner_kind = 'newsletter' AND owner_id = CAST(old.id AS TEXT);
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 = 'page_section'
AND NOT EXISTS (SELECT 1 FROM page_sections WHERE CAST(id AS TEXT) = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such page section')
WHEN new.owner_kind = 'newsletter'
AND NOT EXISTS (SELECT 1 FROM newsletters WHERE CAST(id AS TEXT) = new.owner_id)
THEN RAISE(ABORT, 'content_blocks: no such newsletter')
END;
END;

View file

@ -191,8 +191,6 @@ blog.get("/community-blog", async (c) => {
return json(c, {
community_blog: {
title: page.blog_title,
blurb: page.blog_blurb,
internal: {
title: page.internal_title,
posts: posts.map((row) =>

View file

@ -88,7 +88,8 @@ function loadHosts(db, ids) {
const rows = db
.prepare(
`SELECT event_id, host_kind, host_id, host_name, host_org_kind
`SELECT event_id, host_kind, host_id, host_name, host_org_kind,
host_team_id, host_team_name
FROM v_event_hosts
WHERE event_id IN (${marks(ids.length)})
AND host_is_published = 1
@ -115,6 +116,9 @@ function shapeHost(row) {
// Which of /regions, /groups, /partners the slug belongs to.
// Null for a person, whose route needs no disambiguating.
org_kind: row.host_org_kind,
// The team an organization host is shown as, when one is set
// (and published): the event page names and links it instead.
team: row.host_team_id ? { id: row.host_team_id, name: row.host_team_name } : null,
};
}

View file

@ -0,0 +1,57 @@
/* ═══════════════════════════════════════════════════════════════
SITE PAGE ROUTES: read-only, mounted under /api
GET /site-pages every site page's section headings, for
the header's dropdowns and the side nav
GET /site-pages/:id one page's sections, in order: heading,
accent, preset (and an events preset's
filter and view), and its blocks
Edited in the admin as Pages → each page
(admin-schema/sitePages.js). Blocks are shaped as on any record
page (loadBlocks), so ContentBlocks draws them.
═══════════════════════════════════════════════════════════════ */
import { Hono } from "hono";
import { json, loadBlocks } from "../shape.js";
const sitePages = new Hono();
sitePages.get("/site-pages", (c) => {
const rows = c
.get("db")
.prepare(`SELECT page_id, anchor, title FROM page_sections ORDER BY page_id, sort_order, id`)
.all();
const pages = {};
for (const row of rows) (pages[row.page_id] ??= []).push({ anchor: row.anchor, title: row.title });
return json(c, { pages });
});
sitePages.get("/site-pages/:id", (c) => {
const db = c.get("db");
const id = c.req.param("id");
if (!db.prepare(`SELECT 1 FROM site_pages WHERE id = ?`).get(id)) {
return c.json({ error: "No such page." }, 404);
}
const rows = db
.prepare(
`SELECT id, anchor, title, blurb, accent, preset, scope_id, event_type, view
FROM page_sections WHERE page_id = ? ORDER BY sort_order, id`,
)
.all(id);
const blocks = loadBlocks(db, "page_section", rows.map((row) => String(row.id)));
return json(c, {
page: {
id,
sections: rows.map(({ id: sectionId, ...section }) => ({
...section,
blocks: blocks.get(String(sectionId)) ?? [],
})),
},
});
});
export default sitePages;

View file

@ -144,6 +144,10 @@ const ALL_BLOCKS = [
{ text: "A card with a picture", detail: "Its description, up to three lines, under the title. The whole card is the link.", url: "/retreats", media: IMAGE },
{ text: "An outside link, text only", detail: "The card shows the site it goes to above the title.", url: "https://example.org" },
]],
["subheading", { text: "People" }],
["people", { team_id: TEAM }, [
{ person_id: PERSON, text: "Picked as an item, with a title" },
]],
];
/* A record page's body: a handful of types, so it reads like a
@ -426,7 +430,8 @@ tx(db, () => {
is_published: 1,
is_listed: LISTED,
});
insert("event_hosts", { event_id: PAST, org_id: REGION, sort_order: 0 });
// Hosted by the region, shown as its team (054).
insert("event_hosts", { event_id: PAST, org_id: REGION, team_id: TEAM, sort_order: 0 });
insert("event_people", { event_id: PAST, person_id: PERSON, role: "host", is_public: 1, sort_order: 0 });
blocks("event", PAST, "card", cardText("past event"));

View file

@ -66,7 +66,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
const blockRows = db
.prepare(
`SELECT id, owner_id, type, text, media, href, alt, cite
`SELECT id, owner_id, type, text, media, href, alt, cite, team_id
FROM content_blocks
WHERE owner_kind = ? AND slot = ? AND owner_id IN (${placeholders(ids.length)})
ORDER BY owner_id, sort_order`,
@ -85,6 +85,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
href: row.href,
alt: row.alt,
cite: row.cite,
team_id: row.team_id,
items: [],
};
byId.set(row.id, block);

View file

@ -22,9 +22,9 @@
"title": "Community",
"description": "Groups, regions and the people who make up Next Generation of Unity."
},
"/leadership": {
"title": "Leadership",
"description": "The board, staff, and volunteers who keep Next Generation of Unity running."
"/organization": {
"title": "Organization",
"description": "Our mission, vision and values, the people who lead Next Generation of Unity, and how to reach us."
},
"/resources": {
"title": "Resources",

View file

@ -49,11 +49,9 @@ const lazyPage = (load) =>
throw err
}),
)
const Retreats = lazyPage(() => import("./pages/Retreats.tsx"))
const Community = lazyPage(() => import("./pages/Community.tsx"))
const Leadership = lazyPage(() => import("./pages/Leadership.tsx"))
const Resources = lazyPage(() => import("./pages/Resources.tsx"))
const History = lazyPage(() => import("./pages/History.tsx"))
// Community, Retreats, Resources, Organization and History: each
// built in the admin from sections.
const SitePage = lazyPage(() => import("./pages/SitePage.tsx"))
const Feedback = lazyPage(() => import("./pages/Feedback.tsx"))
const Request = lazyPage(() => import("./pages/Request.tsx"))
const Giving = lazyPage(() => import("./pages/Giving.tsx"))
@ -80,6 +78,7 @@ const AdminHome = lazyPage(() => import("./pages/admin/AdminHome.tsx"))
const AdminFeedback = lazyPage(() => import("./pages/admin/AdminFeedback.tsx"))
const AdminMedia = lazyPage(() => import("./pages/admin/AdminMedia.tsx"))
const AdminClips = lazyPage(() => import("./pages/admin/AdminClips.tsx"))
const AdminNewsletter = lazyPage(() => import("./pages/admin/AdminNewsletter.tsx"))
const EntityList = lazyPage(() => import("./pages/admin/EntityList.tsx"))
const EntityEdit = lazyPage(() => import("./pages/admin/EntityEdit.tsx"))
@ -90,9 +89,9 @@ export default function App() {
{/* Layout renders the nav once and swaps page content into <Outlet /> */}
<Route element={<Layout />}>
<Route index element={<Home />} />
<Route path="retreats" element={<Retreats />} />
<Route path="retreats" element={<SitePage key="retreats" id="retreats" />} />
<Route path="/events/:id" element={<EventDetail />} />
<Route path="community" element={<Community />} />
<Route path="community" element={<SitePage key="community" id="community" />} />
<Route path="/regions/:id" element={<OrganizationDetail />} />
<Route path="/groups/:id" element={<OrganizationDetail />} />
<Route path="/partners/:id" element={<OrganizationDetail />} />
@ -101,9 +100,9 @@ export default function App() {
<Route path="/awards/:id" element={<AwardDetail />} />
<Route path="/people/:id" element={<PersonDetail />} />
<Route path="/blog/:id" element={<BlogPost />} />
<Route path="leadership" element={<Leadership />} />
<Route path="resources" element={<Resources />} />
<Route path="history" element={<History />} />
<Route path="organization" element={<SitePage key="organization" id="organization" />} />
<Route path="resources" element={<SitePage key="resources" id="resources" />} />
<Route path="history" element={<SitePage key="history" id="history" />} />
<Route path="feedback" element={<Feedback />} />
<Route path="request" element={<Request />} />
<Route path="qr" element={<QrCodes />} />
@ -133,6 +132,7 @@ export default function App() {
<Route path="data-requests" element={<AdminFeedback kind="privacy" />} />
<Route path="requests" element={<AdminFeedback kind="content" />} />
<Route path="media" element={<AdminMedia />} />
<Route path="newsletter" element={<AdminNewsletter />} />
<Route element={<RequireRole role="admin" />}>
<Route path="clips" element={<AdminClips />} />
</Route>

View file

@ -0,0 +1,168 @@
/* ═══════════════════════════════════════════════════════════════
ACCESSIBILITY PANEL
A button fixed to the bottom right of every public page, opening
two switches that change how the whole site reads:
Dyslexia-friendly font every typeface becomes OpenDyslexic
(self-hosted, index.css)
Reading mode the design steps back: no background
circles, motion or shadows, one column,
larger text and plain underlined links,
the same content throughout
Each is a data attribute on <html> (data-font, data-reading) that
index.css styles, saved in this browser (site-font, site-reading)
and set again before the first paint by index.html, so a page
never flashes the other look. Blocked storage just means the
choice lasts until the tab closes.
The panel closes on Escape, on the button again, or a click
anywhere else, and gives focus back to the button.
═══════════════════════════════════════════════════════════════ */
import { PersonArmsSpread, X } from '@phosphor-icons/react'
import { useEffect, useId, useRef, useState } from 'react'
/* A setting: its <html> attribute, storage key, the value that turns
it on, and its words. */
const SETTINGS = [
{
attribute: 'font',
key: 'site-font',
on: 'dyslexic',
label: 'Dyslexia-friendly font',
help: 'Letters shaped to be easier to tell apart.',
},
{
attribute: 'reading',
key: 'site-reading',
on: 'on',
label: 'Reading mode',
help: 'A plain, single column with larger text and no motion.',
},
] as const
type Setting = (typeof SETTINGS)[number]
const isOn = (setting: Setting) => document.documentElement.dataset[setting.attribute] === setting.on
function apply(setting: Setting, on: boolean) {
const root = document.documentElement
if (on) root.dataset[setting.attribute] = setting.on
else delete root.dataset[setting.attribute]
try {
if (on) localStorage.setItem(setting.key, setting.on)
else localStorage.removeItem(setting.key)
} catch {
// Storage blocked: the choice holds for this page view.
}
}
export default function AccessibilityPanel() {
const [open, setOpen] = useState(false)
const [state, setState] = useState(() => Object.fromEntries(SETTINGS.map((s) => [s.key, isOn(s)])))
const rootRef = useRef<HTMLDivElement>(null)
const buttonRef = useRef<HTMLButtonElement>(null)
const panelId = useId()
useEffect(() => {
if (!open) return undefined
const close = () => {
setOpen(false)
buttonRef.current?.focus()
}
const onKey = (event: KeyboardEvent) => {
if (event.key === 'Escape') close()
}
const onPointer = (event: PointerEvent) => {
if (!rootRef.current?.contains(event.target as Node)) setOpen(false)
}
document.addEventListener('keydown', onKey)
document.addEventListener('pointerdown', onPointer)
return () => {
document.removeEventListener('keydown', onKey)
document.removeEventListener('pointerdown', onPointer)
}
}, [open])
const toggle = (setting: Setting) => {
const next = !state[setting.key]
apply(setting, next)
setState((current) => ({ ...current, [setting.key]: next }))
}
return (
<div ref={rootRef} className="fixed right-4 bottom-4 z-50 print:hidden">
{open && (
<div
id={panelId}
role="region"
aria-label="Accessibility"
className="absolute right-0 bottom-full mb-3 w-[min(20rem,calc(100vw-2rem))] border border-brand/20 bg-raised p-4 shadow-xl"
>
<div className="flex items-center justify-between gap-4">
<h2 className="font-display text-base font-bold text-ink">Accessibility</h2>
<button
type="button"
onClick={() => {
setOpen(false)
buttonRef.current?.focus()
}}
className="btn flex h-10 w-10 items-center justify-center text-muted hover:bg-tint"
aria-label="Close accessibility options"
>
<X size={18} weight="bold" aria-hidden="true" />
</button>
</div>
<ul className="mt-3 space-y-3">
{SETTINGS.map((setting) => {
const on = state[setting.key]
const labelId = `${panelId}-${setting.attribute}`
return (
<li key={setting.key} className="flex items-start gap-3">
<button
type="button"
role="switch"
aria-checked={on}
aria-labelledby={labelId}
onClick={() => toggle(setting)}
className={`relative mt-0.5 h-6 w-11 shrink-0 rounded-full border-2 transition-colors ${
on ? 'border-action bg-action' : 'border-muted/50 bg-surface'
}`}
>
<span
aria-hidden="true"
className={`absolute top-0.5 h-4 w-4 rounded-full transition-transform ${
on ? 'translate-x-5 bg-white' : 'translate-x-0.5 bg-muted'
}`}
/>
</button>
<span>
<span id={labelId} className="block font-semibold text-ink">
{setting.label}
</span>
<span className="block text-sm text-muted">{setting.help}</span>
</span>
</li>
)
})}
</ul>
</div>
)}
<button
ref={buttonRef}
type="button"
onClick={() => setOpen((value) => !value)}
aria-expanded={open}
aria-controls={open ? panelId : undefined}
aria-label="Accessibility options"
className="btn flex h-12 w-12 items-center justify-center bg-action text-white shadow-lg transition-colors hover:bg-action-hover"
>
<PersonArmsSpread size={26} weight="bold" aria-hidden="true" />
</button>
</div>
)
}

View file

@ -5,7 +5,7 @@ import { Link } from "react-router-dom";
ARROW LINK
═══════════════════════════════════════════════════════════════ */
export default function ArrowLink({ to, label, color, size = "h-9 w-9" }) {
export default function ArrowLink({ to, label, color, size = "h-10 w-10" }) {
return (
<Link
to={to}

View file

@ -29,12 +29,12 @@ export default function Banner() {
return (
<div
className="relative w-full px-12 py-2.5 text-center"
style={{ background: "rgba(0, 47, 57, 0.95)" }}
className="relative w-full py-2.5 pr-12 pl-4 text-center sm:px-12"
style={{ background: "rgba(0, 16, 17, 0.95)" }}
role="region"
aria-label="Site announcement"
>
<p className="text-sm text-white/85">
<p className="text-xs text-white/85 sm:text-sm">
{SITE_BANNER.content.map((part, i) => {
if (!part.href) return <span key={i}>{part.text}</span>;
return part.external ? (
@ -53,7 +53,7 @@ export default function Banner() {
<button
onClick={dismiss}
aria-label="Dismiss announcement"
className="absolute right-3 top-1/2 -translate-y-1/2 p-1.5 text-white/50 hover:text-white hover:bg-white/10 transition-colors"
className="absolute right-1 top-1/2 -translate-y-1/2 p-3 text-white/50 hover:text-white hover:bg-white/10 transition-colors"
>
<X className="w-4 h-4" weight="bold" aria-hidden="true" />
</button>

View file

@ -7,7 +7,9 @@
some.
═══════════════════════════════════════════════════════════════ */
const CONTACT = 'info@nextgenerationofunity.org'
import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts'
const CONTACT = ORGANIZATION_DETAILS.email
export default function ComingSoon({ what }: { what: string }) {
return (

View file

@ -27,6 +27,9 @@
cards items as link cards, up to three in a row:
text the title, detail, url, media the
picture
people team_id's members as people tiles, then
items as more tiles: person, text their
title (an unpublished person is left out)
divider nothing
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
@ -38,6 +41,7 @@
═══════════════════════════════════════════════════════════════ */
import { mediaUrl } from '../lib/media.ts'
import PeopleTiles from './PeopleTiles.tsx'
import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts'
import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
import VideoPlayer from './VideoPlayer.tsx'
@ -326,6 +330,19 @@ function Block({ block, accent, anchor }: { block: ContentBlock; accent: string;
if (!block.items?.length) return null
return <ScheduleBlock items={block.items} intro={block.text} accent={accent} />
case 'people': {
const picked = (block.items ?? [])
.filter((item) => item.person)
.map((item) => ({ peopleslug: item.person!.id, title: item.text || null }))
if (!block.team_id && picked.length === 0) return null
return (
<div className="space-y-6">
{block.team_id && <PeopleTiles size="lg" teams={block.team_id} accent={accent} />}
{picked.length > 0 && <PeopleTiles size="lg" people={picked} accent={accent} />}
</div>
)
}
case 'divider':
return <hr className="border-0 h-px" style={{ background: accent, opacity: 0.3 }} />

View file

@ -1,7 +1,9 @@
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";
const Social_Links = [
{ label: "Instagram", href: "https://www.instagram.com/nextgenerationunity/", platform: "instagram" },
@ -22,19 +24,9 @@ type TouchLink = { label: string } & (
const Get_In_Touch: TouchLink[] = [
{ label: "Feedback", to: "/feedback"},
{ label: "Request", to: "/request" },
{ label: "Contact Us", to: "/leadership#contact" },
{ label: "Contact Us", to: "/organization#contact" },
];
/* Under the logo. The street address is where NGU is, not where
to send post, and says so. */
const Organization_Details = {
street: "1901 NW Blue Parkway",
cityLine: "Unity Village, MO 64065",
addressNote: "Physical address, not for mail",
nonprofit: "Next Generation of Unity is a qualified 501(c)(3) nonprofit organization.",
taxId: "33-2819320",
};
const Footer_Links = [
{ label: "Privacy Policy", to: "/privacy" },
{ label: "Terms of Service", to: "/terms" },
@ -43,21 +35,23 @@ const Footer_Links = [
const footerLinkClass =
"text-white/65 hover:text-[#9cc47c] text-sm transition-colors";
// inline-block with a little height of its own, so a finger can hit it.
const pageLinkClass =
"text-white/80 hover:text-[#9cc47c] text-sm font-semibold transition-colors";
"inline-block py-1 text-white/80 hover:text-[#9cc47c] text-sm font-semibold transition-colors";
const sectionLinkClass =
"text-white/65 hover:text-[#9cc47c] text-sm transition-colors";
"inline-block py-1 text-white/65 hover:text-[#9cc47c] text-sm transition-colors";
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">
<div className="grid grid-cols-1 md:grid-cols-12 gap-10 md:gap-8 mb-12">
{/* Brand and details on top, the site map across the full
width below them. */}
{/* Brand and details, beside the socials and contact links;
the site map spans the full width below them all. */}
<div className="md:col-span-9 text-center md:text-left">
{/* The logo, and Give beside it. */}
<div className="flex flex-wrap items-center justify-center gap-6 md:justify-start">
@ -88,37 +82,6 @@ export default function Footer() {
{Organization_Details.nonprofit} Tax ID: {Organization_Details.taxId}.
</p>
{/* Site map: mirrors both nav tiers */}
<nav aria-label="Site map" className="mt-10">
<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] ?? [];
return (
<li key={page.path}>
<Link to={page.path} className={pageLinkClass}>
{page.label}
</Link>
{sections.length > 0 && (
<ul className="mt-2 flex flex-col gap-1.5">
{sections.map((section) => (
<li key={section.hash}>
<Link
to={`${page.path}${section.hash}`}
className={sectionLinkClass}
>
{section.label.replace(/^#/, "")}
</Link>
</li>
))}
</ul>
)}
</li>
);
})}
</ul>
</nav>
</div>
@ -164,6 +127,38 @@ export default function Footer() {
</div>
</div>
{/* Site map: every page and its sections, across the full width. */}
<nav aria-label="Site map" className="mb-12 border-t border-white/10 pt-10">
<h2 className={headingClass}>Site Map</h2>
<ul className="grid grid-cols-2 gap-x-6 gap-y-6 sm:grid-cols-3 lg:grid-cols-6">
{PAGE_LINKS.map((page) => {
const sections = sectionsOf(page.path);
return (
<li key={page.path}>
<Link to={page.path} className={pageLinkClass}>
{page.label}
</Link>
{sections.length > 0 && (
<ul className="mt-1 flex flex-col">
{sections.map((section) => (
<li key={section.hash}>
<Link
to={`${page.path}${section.hash}`}
className={sectionLinkClass}
>
{section.label.replace(/^#/, "")}
</Link>
</li>
))}
</ul>
)}
</li>
);
})}
</ul>
</nav>
<div className="border-t border-white/10 pt-8 flex flex-col md:flex-row items-center justify-between gap-4">
<p className="text-white/65 text-sm">© 2026 Next Generation of Unity. All rights reserved.</p>
<div className="flex gap-6">

View file

@ -1,12 +1,14 @@
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";
import PrivacyNotice from "./PrivacyNotice.tsx";
import PageBackdrop from "./PageBackdrop.tsx";
import AccessibilityPanel from "./AccessibilityPanel.tsx";
import ThemeToggle from "./ThemeToggle.tsx";
import { scrollBehavior } from "../lib/motion.ts";
@ -75,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
@ -104,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;
@ -131,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
@ -194,23 +164,53 @@ 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. Home has
none: it's the logo's link too, and its bands are one
scroll away. */}
<div className="hidden lg:flex items-center gap-6">
{PAGE_LINKS.map((page) => (
<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 = page.path === "/" ? [] : 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>
@ -234,43 +234,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 />
@ -289,12 +252,13 @@ export default function Layout() {
<div inert={mobileMenuOpen} className="print:hidden">
<Footer />
<PrivacyNotice />
<AccessibilityPanel />
</div>
{/* Mobile menu */}
{mobileMenuOpen && (
<div
className="fixed inset-0 z-[60] flex flex-col items-center justify-center overflow-y-auto py-16"
className="fixed inset-0 z-[60] flex flex-col items-center [justify-content:safe_center] overflow-y-auto py-16"
style={{ background: "rgba(0, 58, 69, 0.97)" }}
role="dialog"
aria-modal="true"
@ -302,7 +266,7 @@ export default function Layout() {
>
<button
ref={closeMenuRef}
className="absolute top-5 right-6 text-white text-3xl"
className="absolute top-3 right-4 p-2 text-white text-3xl"
aria-label="Close menu"
onClick={() => setMobileMenuOpen(false)}
>
@ -311,7 +275,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

@ -0,0 +1,59 @@
/* ═══════════════════════════════════════════════════════════════
ORG CONTACT
An organization's ways to reach it, as buttons: its action links
filled in its accent, then its website, email and socials
outlined. Nothing at all when it has none. Used on an
organization's page and on the Organization page (NGU's own).
═══════════════════════════════════════════════════════════════ */
import PlatformIcon from './PlatformIcon.tsx'
import type { OrganizationRecord } from '../lib/useContent.ts'
import { accentText } from '../lib/color.ts'
export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) {
const hasAny =
org.links.length > 0 || org.socials.length > 0 || org.website || org.email
if (!hasAny) return null
return (
<div className="flex flex-wrap gap-3">
{org.links.map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-2 btn px-5 py-2 text-sm text-white transition-transform hover:scale-105"
style={{ background: accent }}
>
<PlatformIcon platform={link.platform} />
{link.label}
</a>
))}
{/* website and email arrive as bare strings (splitLinks in
shape.js); socials are whole link rows. */}
{[
org.website ? { url: org.website, label: 'Website', platform: null } : null,
org.email ? { url: `mailto:${org.email}`, label: org.email, platform: null } : null,
...org.socials,
]
.filter((link): link is NonNullable<typeof link> => Boolean(link))
.map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-2 btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
style={{ borderColor: accent, color: accentText(accent) }}
>
<PlatformIcon platform={link.platform} />
{link.label}
</a>
))}
</div>
)
}

143
src/components/OrgTeams.tsx Normal file
View file

@ -0,0 +1,143 @@
/* ═══════════════════════════════════════════════════════════════
ORG TEAMS
An organization's leadership as people tiles, one block per team:
the team's name (linked to its page) and tagline, then its people.
Leadership arrives flat with team_id and team_name on each row,
so grouping costs nothing; `teams` gives the order and lists a
team with nobody in it yet. Used on an organization's page and on
the Organization page (NGU's own Board, Retreat Team and the rest).
═══════════════════════════════════════════════════════════════ */
import { Link } from 'react-router-dom'
import PeopleTiles from './PeopleTiles.tsx'
import type { Leader, OrganizationRecord } from '../lib/useContent.ts'
import { teamHref } from '../lib/hrefs.ts'
import { mediaUrl } from '../lib/media.ts'
import { accentText } from '../lib/color.ts'
const BODY = 'var(--color-muted)'
/* Whether the organization has any leadership to show. */
export const hasTeams = (org: OrganizationRecord) => groupLeadership(org).length > 0
export default function OrgTeams({ org, accent }: { org: OrganizationRecord; accent: string }) {
const teamBlocks = groupLeadership(org)
return (
<div className="space-y-12">
{teamBlocks.map((block) => (
<div key={block.key}>
<div className="mb-4">
{block.teamId ? (
<h3 className="text-xl font-bold">
<Link
to={teamHref(block.teamId)}
className="hover:underline"
style={{ color: accentText(accent) }}
>
{block.label}
</Link>
</h3>
) : (
block.label && (
<h3 className="text-xl font-bold" style={{ color: accentText(accent) }}>
{block.label}
</h3>
)
)}
{block.tagline && (
<p className="mt-1 text-sm" style={{ color: BODY }}>
{block.tagline}
</p>
)}
</div>
{block.people.length > 0 ? (
<PeopleTiles
size="lg"
accent={block.accent || accent}
people={block.people.map((leader) => ({
id: leader.person_id,
name: leader.display_name,
title: leader.title,
pronouns: leader.pronouns,
public_email: leader.public_email,
photo: mediaUrl(leader.photo),
is_owner: leader.is_owner,
}))}
/>
) : (
<p className="text-sm italic" style={{ color: BODY }}>
No members listed yet.
</p>
)}
</div>
))}
</div>
)
}
/* ── Leadership → team blocks ────────────────────────────────── */
type TeamBlock = {
key: string
teamId: string | null
label: string | null
tagline?: string | null
accent?: string | null
people: Leader[]
}
/* Order comes from `teams` (the admin's sort_order), not from the
order people happen to appear in. Three cases to cover:
affiliations with no team at all, teams with nobody in them, and
people filed under a team that is no longer published. */
function groupLeadership(org: OrganizationRecord): TeamBlock[] {
const byTeam = new Map<string, Leader[]>()
const loose: Leader[] = []
for (const leader of org.leadership) {
if (!leader.team_id) {
loose.push(leader)
continue
}
const list = byTeam.get(leader.team_id)
if (list) list.push(leader)
else byTeam.set(leader.team_id, [leader])
}
const blocks: TeamBlock[] = []
// People who hold a role in the organization without sitting on a
// team. Usually the leads. No heading, they are the page.
if (loose.length > 0) {
blocks.push({ key: 'loose', teamId: null, label: null, people: loose })
}
for (const team of org.teams) {
blocks.push({
key: team.id,
teamId: team.id,
label: team.name,
tagline: team.tagline,
accent: team.color,
people: byTeam.get(team.id) ?? [],
})
byTeam.delete(team.id)
}
// Whatever is left is filed under an unpublished team. Its page
// isn't reachable, so the heading is plain text, but the people
// are real and shouldn't silently vanish from the org.
for (const [teamId, people] of byTeam) {
blocks.push({
key: teamId,
teamId: null,
label: people[0]?.team_name ?? null,
people,
})
}
return blocks
}

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,28 +105,44 @@ export default function PageShell({ title, intro, sections }: PageShellProps) {
if (typeof title === "string") document.title = documentTitle(title);
}, [title]);
// The thin solid banner between sections. With the side nav it runs
// the page's full width, under the nav column, rather than stopping
// at the content's edge.
const banner = (accent: string) => (
<div className={`h-2 ${sideNav ? "lg:-ml-[var(--side-nav-w)]" : ""}`} style={{ background: accent }} />
);
const bands = sections.map((section, i) => (
<div key={section.id}>
{banner(section.accent)}
<Section section={section} />
{i === sections.length - 1 && banner(section.accent)}
</div>
));
return (
<>
{/* Page header */}
<div className="pt-24 pb-12 px-6">
<div className="max-w-6xl mx-auto">
<h1 className="text-5xl md:text-6xl font-bold" style={{ color: accentText(BRAND) }}>
<h1 className="text-4xl sm:text-5xl md:text-6xl font-bold [overflow-wrap:anywhere] hyphens-auto" style={{ color: accentText(BRAND) }}>
{title}
</h1>
{intro && <p className="mt-3 text-lg text-muted max-w-2xl">{intro}</p>}
</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="[--side-nav-w:16rem] lg:grid lg:grid-cols-[var(--side-nav-w)_minmax(0,1fr)]">
<aside className="relative z-10 hidden lg:block">
<div className="sticky pt-8 pl-6 pr-2" style={{ top: "calc(var(--header-h, 5rem) + 1rem)" }}>
<SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} wrap />
</div>
</aside>
<div className="min-w-0">{bands}</div>
</div>
))}
) : (
bands
)}
</>
);

View file

@ -66,6 +66,16 @@
border-left: 1px solid var(--pl-rule);
}
/* Everyone on one line (fitsOneRow in PeopleTiles.tsx): the groups
share it by head count, and the tiles narrow to fit. */
.pl__groups[data-row="one"] {
flex-wrap: nowrap;
}
.pl__groups[data-row="one"] .pl__group {
flex: var(--pl-share) 1 0;
}
.pl__group-head {
display: flex;
flex-direction: column;
@ -304,27 +314,17 @@
box-shadow: var(--shadow-lg);
}
.pl__bio--anchored[data-align="end"] {
left: auto;
right: 0;
}
.pl__bio--anchored::before {
content: '';
position: absolute;
top: -11px;
left: calc(var(--pl-w) / 2 - 8px);
left: var(--pl-notch, calc(var(--pl-w) / 2 - 8px));
width: 16px;
height: 8px;
background: var(--pl-accent);
clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.pl__bio--anchored[data-align="end"]::before {
left: auto;
right: calc(var(--pl-w) / 2 - 8px);
}
.pl__bio {
display: flex;
flex-direction: column;
@ -356,8 +356,8 @@
.pl__close {
flex: 0 0 auto;
width: 1.75rem;
height: 1.75rem;
width: 2.5rem;
height: 2.5rem;
border: 1px solid var(--pl-frame-edge);
border-radius: var(--btn-radius);
background: var(--color-surface);

View file

@ -56,7 +56,10 @@ import "./PeopleTiles.css";
* Rows fill (balancedColumns): as many tiles across as fit, never
* fewer than 2 or more than 10, one fewer when that would leave a
* lone tile on the last row. When 2 don't fit at full size they
* shrink.
* shrink. And when everyone (every group, leads and members alike)
* fits on one line with tiles at ONE_ROW_SHRINK of full width or
* wider, they all share that one line instead (fitsOneRow): a
* board of 7 reads as one row, not 5 and 2.
*
* Details open in a panel right under the tile, over what follows
* (flipped to end at the tile's right edge when it would run off
@ -484,6 +487,9 @@ export function PeopleTilesView({
}
const open = openKey ? findByKey(resolvedGroups, openKey) : null;
const oneRow =
room !== null && overflow !== "scroll" &&
fitsOneRow(resolvedGroups.map((group) => group.people.length), room.width, room.tile, room.gap);
const anchored = overflow !== "scroll";
const closePanel = () => {
setOpenKey(null);
@ -537,13 +543,17 @@ export function PeopleTilesView({
{...rest}
>
<span ref={probeRef} className="pl__probe" aria-hidden="true" />
<div className="pl__groups">
<div className="pl__groups" data-row={oneRow ? "one" : undefined}>
{resolvedGroups.map((group) => (
<section
key={group.id}
className="pl__group"
style={
group.accent ? ({ "--pl-accent": group.accent } as CSSProperties) : undefined
{
...(group.accent ? { "--pl-accent": group.accent } : null),
// Sharing one line: each group's width follows its head count.
...(oneRow ? { "--pl-share": group.people.length } : null),
} as CSSProperties
}
aria-label={group.label || undefined}
>
@ -559,7 +569,9 @@ export function PeopleTilesView({
style={
room
? ({
"--pl-cols": balancedColumns(group.people.length, room.width, room.tile, room.gap),
"--pl-cols": oneRow
? group.people.length
: balancedColumns(group.people.length, room.width, room.tile, room.gap),
} as CSSProperties)
: undefined
}
@ -736,15 +748,23 @@ function DetailPanel({
onClose: () => void;
}) {
const panelRef = useRef<HTMLDivElement>(null);
const [alignEnd, setAlignEnd] = useState(false);
// How far the panel shifts from the tile's left edge, and where the
// notch sits on it, in px.
const [place, setPlace] = useState<{ shift: number; notch: number } | null>(null);
// Under the tile, starting at its left edge unless that would run
// off the right of the screen; then ending at its right edge.
// Under the tile, starting at its left edge, slid left just enough
// to stay 8px inside the screen on either side (a narrow phone
// included), with the notch kept under the tile's middle.
useLayoutEffect(() => {
if (!anchored || !panelRef.current) return;
const tile = panelRef.current.parentElement?.getBoundingClientRect();
if (!tile) return;
const width = panelRef.current.offsetWidth;
if (tile) setAlignEnd(tile.left + width > document.documentElement.clientWidth - 16);
const screen = document.documentElement.clientWidth;
let shift = Math.min(0, screen - 8 - (tile.left + width));
shift = Math.max(shift, 8 - tile.left);
const notch = Math.min(Math.max(tile.width / 2 - shift - 8, 8), width - 24);
setPlace({ shift, notch });
}, [anchored]);
const org = resolveOrg(person.org);
@ -758,10 +778,14 @@ function DetailPanel({
ref={panelRef}
id={id}
className={anchored ? "pl__bio pl__bio--anchored" : "pl__bio"}
data-align={alignEnd ? "end" : "start"}
style={
{
...(tint ? { "--pl-accent": tint } : null),
...(place ? { left: `${place.shift}px`, "--pl-notch": `${place.notch}px` } : null),
} as CSSProperties
}
role="region"
aria-label={`About ${person.name}`}
style={tint ? ({ "--pl-accent": tint } as CSSProperties) : undefined}
>
<div className="pl__bio-head">
<div>
@ -834,17 +858,36 @@ function Chevron() {
/* ── Helpers ─────────────────────────────────────────────────── */
/* How small a tile may get so a whole list shares one line. */
export const ONE_ROW_SHRINK = 0.75;
/* Whether every group fits side by side on one line, 10 tiles at most,
with tiles no smaller than ONE_ROW_SHRINK of full width. Groups are
divided by a gap, padding and a 1px rule (PeopleTiles.css). */
export function fitsOneRow(counts: number[], width: number, tile: number, gap: number): boolean {
const total = counts.reduce((sum, n) => sum + n, 0);
if (total < 2 || total > 10) return false;
const smallest = tile * ONE_ROW_SHRINK;
const tiles = counts.reduce((sum, n) => sum + n * smallest + (n - 1) * gap, 0);
const dividers = (counts.length - 1) * (gap * 3 + 1);
return tiles + dividers <= width;
}
/* Tiles across a row: as many as fit, at least 2 and at most 10
(never more than there are). If that would leave one tile alone on
the last row, one fewer across, so the last row has two: 7 that fit
6 across go 5 and 2. With only 2 across, a third, narrower column
takes the odd one instead (3 tiles on a phone go 3 across). */
takes the odd one instead, if tiles stay at least 60% of full
width; on a narrow phone a lone last tile beats three unreadable
ones. */
export function balancedColumns(count: number, width: number, tile: number, gap: number): number {
if (count <= 1) return 1;
const fit = Math.floor((width + gap) / (tile + gap));
const cols = Math.min(count, 10, Math.max(2, fit));
if (count % cols !== 1) return cols;
return cols > 2 ? cols - 1 : Math.min(count, 3);
if (cols > 2) return cols - 1;
const third = (width - 2 * gap) / 3;
return count >= 3 && third >= tile * 0.6 ? 3 : 2;
}
/* A string id is a people slug; a numeric or missing one is a

View file

@ -5,9 +5,10 @@
tracking cookies, and videos and maps from other companies wait
for a click (VideoPlayer, HeroStage, ScheduleBlock). Because
nothing loads before that, a notice is enough, rather than a
consent banner that blocks the page. If an embed ever loads on
its own, or analytics are added, this has to become a real
consent choice.
consent banner that blocks the page. Analytics are Plausible,
self-hosted and cookieless, which needs no consent either. If an
embed ever loads on its own, or anything sets a tracking cookie,
this has to become a real consent choice.
Closed is remembered in this browser; blocked storage just
means it shows again next time.
@ -42,7 +43,7 @@ export default function PrivacyNotice() {
<div
role="region"
aria-label="Privacy notice"
className="fixed bottom-4 left-4 right-4 z-40 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
className="fixed bottom-20 left-4 right-4 z-40 sm:bottom-4 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
>
<p>
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press

View file

@ -99,8 +99,10 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
return (
<li className="border-b border-brand/10 last:border-b-0">
<div className="flex gap-4 py-4 sm:gap-6">
<p className="w-24 shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
{/* On a phone the time sits on its own line above the entry,
leaving the title the full width. */}
<div className="flex flex-wrap gap-x-4 gap-y-1 py-4 sm:flex-nowrap sm:gap-6">
<p className="w-full shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
{entry.time}
</p>
@ -131,7 +133,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
aria-expanded={open}
aria-controls={panelId}
aria-label={open ? `Less about ${entry.text}` : `More about ${entry.text}`}
className="h-8 w-8 shrink-0 btn border text-sm transition-colors hover:bg-tint"
className="h-10 w-10 shrink-0 btn border text-sm transition-colors hover:bg-tint"
style={{ borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }}
>
<CaretDown

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
@ -67,10 +68,10 @@ function jump(id: string) {
document.getElementById(id)?.scrollIntoView({ behavior: scrollBehavior(), block: "start" });
}
function Label({ section }: { section: EditorSection }) {
function Label({ section, wrap }: { section: EditorSection; wrap?: boolean }) {
return (
<>
<span className="truncate">{section.label}</span>
<span className={wrap ? "" : "truncate"}>{section.label}</span>
{section.count != null && (
<span className="text-xs text-muted/70">({section.count})</span>
)}
@ -83,7 +84,9 @@ function Label({ section }: { section: EditorSection }) {
/* The desktop column. Place it in the grid's first track, in a cell
that is itself sticky (see EntityEdit). */
export function SectionNav({ sections }: { sections: EditorSection[] }) {
/* `wrap` lets a long label run onto a second line instead of being
cut short (the public pages' section titles, up to 30 characters). */
export function SectionNav({ sections, wrap = false }: { sections: EditorSection[]; wrap?: boolean }) {
const active = useActiveSection(sections);
return (
@ -106,7 +109,7 @@ export function SectionNav({ sections }: { sections: EditorSection[] }) {
: "border-transparent text-muted hover:border-brand/40 hover:text-link"
}`}
>
<Label section={section} />
<Label section={section} wrap={wrap} />
</button>
</li>
);

View file

@ -163,10 +163,14 @@ export function setPath(object, path, value) {
/* ── Conditional fields ──────────────────────────────────────── */
/* `when: { path, value }` shows a field when the other field holds
that value (or one of a list); `when: { path, filled: true }` when
it holds anything at all. */
export function fieldShown(field, row, parent?) {
if (!field.when) return true;
const want = Array.isArray(field.when.value) ? field.when.value : [field.when.value];
const source = field.when.scope === "parent" ? parent : row;
if (field.when.filled) return Boolean(source?.[field.when.path]);
const want = Array.isArray(field.when.value) ? field.when.value : [field.when.value];
return want.includes(source?.[field.when.path]);
}

View file

@ -0,0 +1,17 @@
/* ═══════════════════════════════════════════════════════════════
ORGANIZATION DETAILS
NGU's own address, nonprofit status and contact email, shown in
the footer and in the Organization page's Details & Contact. The
street address is where NGU is, not where to send post, and says
so.
═══════════════════════════════════════════════════════════════ */
export const ORGANIZATION_DETAILS = {
street: '1901 NW Blue Parkway',
cityLine: 'Unity Village, MO 64065',
addressNote: 'Physical address, not for mail',
nonprofit: 'Next Generation of Unity is a qualified 501(c)(3) nonprofit organization.',
taxId: '33-2819320',
email: 'info@nextgenerationofunity.org',
}

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

@ -32,7 +32,10 @@ export type RequestAction = "new" | "update";
export type RequestField = {
key: string;
/** A short title for the field. */
label: string;
/** A line under the title: what it's for, or where it shows. */
help?: string;
input?: "text" | "date" | "url" | "email" | "textarea";
placeholder?: string;
to?: { path: string } | { link: "website" | "email" | "action"; label: string } | { block: "card" };
@ -56,7 +59,7 @@ const STATE: RequestField = { key: "state", label: "State or province", placehol
const COUNTRY: RequestField = { key: "country", label: "Country", placeholder: "eg. US", to: { path: "country" } };
const WEBSITE: RequestField = { key: "website", label: "Website", input: "url", placeholder: "https://", to: { link: "website", label: "Website" } };
const EMAIL: RequestField = { key: "email", label: "Contact email", input: "email", to: { link: "email", label: "Email" } };
const DESCRIPTION: RequestField = { key: "description", label: "Short description", input: "textarea", to: { block: "card" } };
const DESCRIPTION: RequestField = { key: "description", label: "Short description", help: "A line or two shown on its card in lists and at the top of its page.", input: "textarea", to: { block: "card" } };
export const REQUEST_TYPES: RequestType[] = [
{
@ -68,8 +71,8 @@ export const REQUEST_TYPES: RequestType[] = [
entity: "blog_posts",
heading: "title",
fields: [
{ key: "author", label: "Author's name, as it should appear", to: { path: "guest_author" } },
{ key: "excerpt", label: "A line or two for the post's card", input: "textarea", to: { path: "excerpt" } },
{ key: "author", label: "Author", help: "Their name as it should appear on the post.", to: { path: "guest_author" } },
{ key: "excerpt", label: "Short description", help: "A line or two shown on the post's preview card, eg. in the Community blog.", input: "textarea", to: { path: "excerpt" } },
],
},
{
@ -100,11 +103,11 @@ export const REQUEST_TYPES: RequestType[] = [
heading: "name",
preset: { kind: "group" },
fields: [
{ key: "region", label: "Region it's in", placeholder: "eg. Great Lakes" },
{ key: "region", label: "Region", help: "The Unity region it's part of, if you know it.", placeholder: "eg. Great Lakes" },
CITY,
STATE,
COUNTRY,
{ key: "meets", label: "When it meets", placeholder: "eg. 2nd Sundays, 6:00pm", to: { path: "group.meets" } },
{ key: "meets", label: "Meeting time", placeholder: "eg. 2nd Sundays, 6:00pm", to: { path: "group.meets" } },
WEBSITE,
EMAIL,
DESCRIPTION,
@ -141,8 +144,8 @@ export const REQUEST_TYPES: RequestType[] = [
entity: "teams",
heading: "name",
fields: [
{ key: "organization", label: "Which organization it belongs to", placeholder: "eg. NGU national" },
{ key: "tagline", label: "What it does, in a line", to: { path: "tagline" } },
{ key: "organization", label: "Organization", help: "The organization the team belongs to.", placeholder: "eg. NGU national" },
{ key: "tagline", label: "Tagline", help: "What the team does, in a line.", to: { path: "tagline" } },
EMAIL,
DESCRIPTION,
],
@ -156,9 +159,9 @@ export const REQUEST_TYPES: RequestType[] = [
entity: "awards",
heading: "name",
fields: [
{ key: "organization", label: "Who gives it", placeholder: "eg. NGU national" },
{ key: "organization", label: "Given by", help: "The organization that gives the award.", placeholder: "eg. NGU national" },
{ key: "description", label: "What it's for", input: "textarea", to: { path: "description" } },
{ key: "recipients", label: "Who received it, and when", input: "textarea" },
{ key: "recipients", label: "Recipients", help: "Who received it, and in which year.", input: "textarea" },
],
},
{
@ -171,7 +174,7 @@ export const REQUEST_TYPES: RequestType[] = [
heading: "display_name",
fields: [
{ key: "pronouns", label: "Pronouns", placeholder: "eg. she/her", to: { path: "pronouns" } },
{ key: "tagline", label: "Role or title", to: { path: "tagline" } },
{ key: "tagline", label: "Role or title", help: "Shown under their name, eg. Retreat Team Lead.", to: { path: "tagline" } },
CITY,
STATE,
{ key: "email", label: "Public email", input: "email", to: { path: "public_email" } },

View file

@ -5,6 +5,8 @@
@import '@fontsource/poppins/600.css';
@import '@fontsource/poppins/700.css';
@import '@fontsource/poppins/800.css'; /* the front page's stat numbers only */
@import '@fontsource/opendyslexic/400.css'; /* the accessibility panel's font, */
@import '@fontsource/opendyslexic/700.css'; /* only downloaded when chosen */
@import 'tailwindcss';
@ -110,6 +112,13 @@ html {
scroll-behavior: smooth;
}
/* An email address is one long word: let it break anywhere rather
than push a button or card past a phone's edge. */
a[href^="mailto:"] {
overflow-wrap: anywhere;
max-width: 100%;
}
/* One visible focus ring for keyboard users, wherever a component
doesn't draw its own. */
:focus-visible {
@ -209,6 +218,62 @@ iframe[src*="churchcenter"] {
--btn-radius: 0.5rem;
}
/* ── Accessibility choices (AccessibilityPanel.tsx) ──────────────
Set on <html> before the first paint (index.html) and by the
panel. */
/* Dyslexia-friendly font: every typeface, headings and buttons too. */
:root[data-font="dyslexic"] {
--font-display: 'OpenDyslexic', sans-serif;
--font-body: 'OpenDyslexic', sans-serif;
}
:root[data-font="dyslexic"] body,
:root[data-font="dyslexic"] h1,
:root[data-font="dyslexic"] h2,
:root[data-font="dyslexic"] h3,
:root[data-font="dyslexic"] h4,
:root[data-font="dyslexic"] h5,
:root[data-font="dyslexic"] h6,
:root[data-font="dyslexic"] button,
:root[data-font="dyslexic"] input,
:root[data-font="dyslexic"] textarea,
:root[data-font="dyslexic"] select {
font-family: 'OpenDyslexic', sans-serif;
}
/* Reading mode: the same content with the design stepped back. No
background circles, motion or shadows; every layout one column,
narrower and larger, with plain underlined links. */
:root[data-reading="on"] {
font-size: 112.5%;
scroll-behavior: auto;
}
:root[data-reading="on"] .page-backdrop {
display: none;
}
:root[data-reading="on"] *,
:root[data-reading="on"] *::before,
:root[data-reading="on"] *::after {
animation: none !important;
transition: none !important;
box-shadow: none !important;
}
:root[data-reading="on"] main {
max-width: 48rem;
margin-inline: auto;
}
:root[data-reading="on"] main .grid {
grid-template-columns: minmax(0, 1fr) !important;
}
:root[data-reading="on"] main p,
:root[data-reading="on"] main li {
line-height: 1.75;
}
:root[data-reading="on"] main a {
text-decoration: underline;
text-underline-offset: 0.2em;
}
/* A notice where content would be (an empty section, a form's
note, "coming soon"): no box and no fill, just two thick brackets
at opposite corners, top left and bottom right, like a
@ -313,7 +378,10 @@ iframe[src*="churchcenter"] {
@container (max-width: 30rem) {
.ev-grid {
grid-template-columns: 1fr;
/* The logo gets its own row: without one, grid-area: image made
an extra column beside the text. */
grid-template-areas:
"image"
"org"
"info"
"desc";

View file

@ -25,8 +25,15 @@ import { teams } from "./adminSchema/teams.ts";
import { awards } from "./adminSchema/awards.ts";
import { timeline } from "./adminSchema/timeline.ts";
import { frontPage } from "./adminSchema/frontPage.ts";
import { blogPosts, communityPage } from "./adminSchema/blog.ts";
import { blogPosts } from "./adminSchema/blog.ts";
import { siteSettings } from "./adminSchema/siteSettings.ts";
import {
communityPage,
retreatsPage,
resourcesPage,
organizationPage,
historyPage,
} from "./adminSchema/sitePages.ts";
export const ADMIN_ENTITIES: Record<string, any> = {
organizations,
@ -38,6 +45,10 @@ export const ADMIN_ENTITIES: Record<string, any> = {
front_page: frontPage,
blog_posts: blogPosts,
community_page: communityPage,
retreats_page: retreatsPage,
resources_page: resourcesPage,
organization_page: organizationPage,
history_page: historyPage,
site_settings: siteSettings,
};

View file

@ -1,12 +1,9 @@
import { preview } from "../text.ts";
import { mediaUrl } from "../media.ts";
import { PUBLISHED_FIELD, LISTED_FIELD, FEATURED_KINDS, featuredCardsChild, blocksChild } from "./shared.ts";
import { PUBLISHED_FIELD, LISTED_FIELD, blocksChild } from "./shared.ts";
/* ── Blog (031_blog.sql) ─────────────────────────────────────────
Posts at /blog/:id, and the Community page's blog section. The
section's community posts reuse the featured cards, limited to
links: a pinned Substack post is a link card, and Fetch preview
fills it from the post. */
Posts at /blog/:id. The Community page's blog section is edited
with that page (sitePages.ts). */
/* A post's body is the content blocks without the card/body choice:
a post only has a body. */
@ -106,87 +103,3 @@ export const blogPosts = {
blogBlocksChild,
],
};
export const communityPage = {
key: "community_page",
label: "Community blog section",
singular: "community blog section",
idLabel: "Page",
singleton: "community",
list: { columns: [], filters: [] },
groups: [
{
legend: "Section",
note: "The first section of the Community page.",
fields: [
{ path: "blog_title", label: "Heading", help: "Default: Community Blog" },
{ path: "blog_blurb", label: "Blurb", widget: "textarea", full: true },
],
},
{
legend: "Our posts",
note: "Pinned posts first, then the newest published, listed posts, up to the number of slots.",
fields: [
{ path: "internal_title", label: "Heading", help: "Default: From NGU" },
{ path: "internal_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
],
},
{
legend: "Community posts",
note: "Pinned cards first, then the newest items from the feeds below, up to the number of slots.",
fields: [
{ path: "external_title", label: "Heading", help: "Default: From our community" },
{ path: "external_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
{ path: "external_url", label: "Button link", help: "eg. https://ngu.substack.com", full: true },
{ path: "external_label", label: "Button text", help: "Default: Read more on Substack" },
],
},
],
children: [
{
key: "pinned_posts",
label: "Pinned posts (ours)",
note: "Always shown, before the newest.",
addLabel: "Pin a post",
title: (row, options) =>
options?.blog_posts?.find((p) => p.id === row.post_id)?.label ?? "New pin",
blank: { post_id: "" },
fields: [
{
path: "post_id",
label: "Post",
widget: "select",
optionsFrom: "blog_posts",
required: true,
},
],
},
{
...featuredCardsChild,
label: "Pinned community posts",
note: "Always shown, before the feeds' newest. Paste a post's link and press Fetch preview.",
addLabel: "Pin a post",
blank: { kind: "", url: "", title: "" },
fields: featuredCardsChild.fields.map((field) =>
field.path === "kind"
? { ...field, options: FEATURED_KINDS.filter(([kind]) => kind !== "record") }
: field,
),
},
{
key: "feeds",
label: "Feeds",
note: "RSS or Atom feeds whose newest posts fill the community slots. Read about every 30 minutes.",
addLabel: "Add feed",
title: (row) => row.label || row.url || "New feed",
blank: { url: "", label: "" },
fields: [
{ path: "url", label: "Feed URL", required: true, full: true, help: "eg. https://ngu.substack.com/feed" },
{ path: "label", label: "Source name", help: "Shown on its cards. Default: the feed's own title" },
],
},
],
};

View file

@ -173,7 +173,7 @@ export const frontPage = {
options: FRONT_PAGE_SECTIONS,
required: true,
},
{ path: "title", label: "Heading", help: "Heading Override" },
{ path: "title", label: "Heading", help: "Default: the band's own name. Up to about 60 characters fit." },
{ path: "blurb", label: "Blurb", full: true },
{ path: "is_hidden", label: "Hidden", widget: "checkbox", help: "Hide for now" },
],

View file

@ -230,6 +230,11 @@ export const linksChild = {
The first row supplies the logo and color when the event sets
neither, so the order here is data rather than a display choice.
An organization host can name a team (any organization's) to show
in its place: the event page reads "Hosted by" that team, linked
to its page, while the logo and color still come from the
organization.
A person supplies neither: there is no color on a person and a
headshot is not a logo, so a person-hosted event with no color
of its own falls through to the section default. */
@ -259,6 +264,15 @@ export const hostsChild = {
blankLabel: "Default: none",
help: "Use if the host is an individual, choose between person and org host, not both.",
},
{
path: "team_id",
label: "Shown as team",
widget: "select",
optionsFrom: "teams",
blankLabel: "Default: the organization",
help: "Optional: a team to name as the host instead, eg. the retreat team. Any organization's team.",
when: { path: "org_id", filled: true },
},
],
};
@ -280,6 +294,7 @@ export const BLOCK_TYPES = [
["schedule", "Schedule", "Entries in one tab per day, each folding out for more. The text is an optional intro."],
["table", "Table", "A grid of text, eg. a comparison chart: one row per line, cells split by |, the first row the header."],
["cards", "Link cards", "Cards with a picture, title and description, each a link to a page or a file, like a link shared in a chat; up to three in a row. Paste a link and press Fetch preview, or Choose a file."],
["people", "People", "People tiles: a team's members, or people picked one by one as items (each with their title), or both."],
["divider", "Divider", "A thin line between parts."],
];
@ -288,6 +303,8 @@ export const SCHEDULE_ENTRY = { scope: "parent", path: "type", value: "schedule"
/* Item fields for a link card, and for every other kind of item. */
export const CARD_ITEM = { scope: "parent", path: "type", value: "cards" };
export const NOT_CARD_ITEM = { scope: "parent", path: "type", value: ["list", "links", "schedule"] };
/* An item that's a person on a people block. */
export const PEOPLE_ITEM = { scope: "parent", path: "type", value: "people" };
export const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type;
@ -384,13 +401,22 @@ export const blocksChild = {
when: { path: "type", value: "image" },
help: "Describes the picture for someone who can't see it, eg. Campers around a fire at dusk",
},
{
path: "team_id",
label: "Team",
widget: "select",
optionsFrom: "teams",
blankLabel: "Default: none, just the people below",
help: "Shows the team's members as tiles, its leads first. People added as items show after it.",
when: { path: "type", value: "people" },
},
],
children: [
{
key: "items",
label: "Items",
addLabel: "Add item",
when: { path: "type", value: ["list", "links", "schedule", "cards"] },
when: { path: "type", value: ["list", "links", "schedule", "cards", "people"] },
title: (row) => [row.day, row.time, row.text].filter(Boolean).join(" · ") || "New item",
blank: { text: "" },
fields: [
@ -412,7 +438,16 @@ export const blocksChild = {
help: "A page on this site (eg. /retreats), anywhere else, or a file (Choose a file). Fetch preview fills the title, description and picture from a page; a file fills its name and first-page picture.",
when: CARD_ITEM,
},
{ path: "text", label: "Text", required: true, help: "Schedules: the entry's title. Cards: the card's title" },
{
path: "person_id",
label: "Person",
widget: "select",
optionsFrom: "people",
required: true,
help: "Shown as a tile with their photo, linked to their page",
when: PEOPLE_ITEM,
},
{ path: "text", label: "Text", required: true, help: "Schedules: the entry's title. Cards: the card's title. People: their title on the tile, eg. Speaker" },
{
path: "location",
label: "Location",

View file

@ -0,0 +1,215 @@
/* ── The site's own pages (056_site_pages.sql) ───────────────────
Pages → Community, Retreats, Resources, Organization, History:
each page is its sections, in order, and each section is its
heading and its own content blocks, then a preset if it has one
(a prebuilt part of the site, drawn under the blocks). Server
side: server/src/admin-schema/sitePages.js; the page is
src/pages/SitePage.tsx.
The preset values are the CHECK list on page_sections.preset;
each page offers the ones that belong on it. */
import { FEATURED_KINDS, featuredCardsChild, blocksChild } from "./shared.ts";
const PRESETS = {
community_blog: "Community blog (its settings are below)",
group_map: "Local groups map",
region_list: "Unity Regions list",
partner_list: "Partner organization cards",
events: "Event carousel or grid",
timeline: "Timeline",
organization_details: "Address, tax ID and email",
};
const ACCENT_OPTIONS = [
["teal", "Teal"],
["deep", "Deep teal"],
["green", "Green"],
["amber", "Amber"],
];
const EVENT_TYPES = [
["retreat", "Retreat"],
["class", "Class"],
["workshop", "Workshop"],
["meeting", "Meeting"],
["other", "Other"],
];
const EVENTS = { path: "preset", value: "events" };
const sectionsChild = (presets: string[]) => ({
key: "sections",
label: "Sections",
note: "Top to bottom. Each is listed in the page's side nav and the header's menu under its title.",
addLabel: "Add section",
title: (row) => row.title || "New section",
blank: { anchor: "", title: "", blurb: "", accent: "", preset: "", content_blocks: [] },
fields: [
{
path: "title",
label: "Title",
required: true,
help: "Up to 30 characters, so it fits the side nav. eg. Mission, Vision & Values",
},
{
path: "anchor",
label: "URL ID",
required: true,
help: "The section's link after the #: lowercase letters, numbers and hyphens, eg. leadership",
},
{ path: "blurb", label: "Blurb", widget: "textarea", full: true, help: "A line under the title" },
{ path: "accent", label: "Accent", widget: "select", options: ACCENT_OPTIONS, blankLabel: "Default: Teal" },
...(presets.length
? [
{
path: "preset",
label: "Preset",
widget: "select",
options: presets.map((key) => [key, PRESETS[key]]),
blankLabel: "Default: none, just the blocks below",
help: "A prebuilt part of the site, shown under the section's blocks",
},
]
: []),
...(presets.includes("events")
? [
{
path: "scope_id",
label: "Events: scope",
widget: "select",
optionsFrom: "event_scopes",
blankLabel: "Default: every scope",
when: EVENTS,
},
{
path: "event_type",
label: "Events: type",
widget: "select",
options: EVENT_TYPES,
blankLabel: "Default: every type",
when: EVENTS,
},
{
path: "view",
label: "Opens as",
widget: "select",
options: [["carousel", "Carousel"], ["grid", "Grid"]],
blankLabel: "Default: Carousel",
when: EVENTS,
},
]
: []),
...(presets.includes("group_map")
? [
{
path: "view",
label: "Opens as",
widget: "select",
options: [["map", "Map"], ["grid", "Grid"]],
blankLabel: "Default: Map",
when: { path: "preset", value: "group_map" },
},
]
: []),
],
children: [
{
...blocksChild,
label: "Blocks",
note: "The section's own content: headings, paragraphs, people, links, whatever it needs.",
fields: blocksChild.fields.filter((field) => field.path !== "slot"),
},
],
});
const sitePage = (id: string, label: string, presets: string[], more: Record<string, any> = {}) => ({
key: `${id}_page`,
label,
singular: label.toLowerCase(),
idLabel: "Page",
singleton: id,
list: { columns: [], filters: [] },
groups: [],
...more,
children: [sectionsChild(presets), ...(more.children ?? [])],
});
export const communityPage = sitePage(
"community",
"Community page",
["community_blog", "group_map", "region_list", "partner_list"],
{
groups: [
{
legend: "Community blog: our posts",
note: "For the Community blog preset. Pinned posts first, then the newest published, listed posts, up to the number of slots.",
fields: [
{ path: "blog.internal_title", label: "Heading", help: "Default: From NGU" },
{ path: "blog.internal_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
],
},
{
legend: "Community blog: community posts",
note: "Pinned cards first, then the newest items from the feeds below, up to the number of slots.",
fields: [
{ path: "blog.external_title", label: "Heading", help: "Default: From our community" },
{ path: "blog.external_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
{ path: "blog.external_url", label: "Button link", help: "eg. https://ngu.substack.com", full: true },
{ path: "blog.external_label", label: "Button text", help: "Default: Read more on Substack" },
],
},
],
children: [
{
key: "pinned_posts",
label: "Community blog: pinned posts (ours)",
note: "Always shown, before the newest.",
addLabel: "Pin a post",
title: (row, options) =>
options?.blog_posts?.find((p) => p.id === row.post_id)?.label ?? "New pin",
blank: { post_id: "" },
fields: [
{
path: "post_id",
label: "Post",
widget: "select",
optionsFrom: "blog_posts",
required: true,
},
],
},
{
...featuredCardsChild,
label: "Community blog: pinned community posts",
note: "Always shown, before the feeds' newest. Paste a post's link and press Fetch preview.",
addLabel: "Pin a post",
blank: { kind: "", url: "", title: "" },
fields: featuredCardsChild.fields.map((field) =>
field.path === "kind"
? { ...field, options: FEATURED_KINDS.filter(([kind]) => kind !== "record") }
: field,
),
},
{
key: "feeds",
label: "Community blog: feeds",
note: "RSS or Atom feeds whose newest posts fill the community slots. Read about every 30 minutes.",
addLabel: "Add feed",
title: (row) => row.label || row.url || "New feed",
blank: { url: "", label: "" },
fields: [
{ path: "url", label: "Feed URL", required: true, full: true, help: "eg. https://ngu.substack.com/feed" },
{ path: "label", label: "Source name", help: "Shown on its cards. Default: the feed's own title" },
],
},
],
},
);
export const retreatsPage = sitePage("retreats", "Retreats page", ["events"]);
export const resourcesPage = sitePage("resources", "Resources page", []);
export const organizationPage = sitePage("organization", "Organization page", ["organization_details"]);
export const historyPage = sitePage("history", "History page", ["timeline"]);

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
}
}

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

@ -0,0 +1,41 @@
/* ═══════════════════════════════════════════════════════════════
NAV SECTIONS: the sections listed under each page in the header's
dropdowns, the mobile menu and the footer's site map
Every page's list comes from the page itself, so adding, moving
or renaming a section changes the menus too: the site pages'
sections (Pages → each page, GET /site-pages), and the front
page's bands it is showing, in the admin's order, each under its
heading (Front page → Sections).
═══════════════════════════════════════════════════════════════ */
import { useCallback } from 'react'
import { useSitePageHeadings } from './useSitePages.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()
const { data: sitePages } = useSitePageHeadings()
return useCallback(
(path: string) => {
if (path !== '/') {
return (sitePages?.[path.slice(1)] ?? []).map((section) => ({
label: section.title,
hash: `#${section.anchor}`,
}))
}
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, sitePages],
)
}

307
src/lib/newsletter.ts Normal file
View file

@ -0,0 +1,307 @@
/* ═══════════════════════════════════════════════════════════════
NEWSLETTER: email-ready HTML and plain text from picked items
The admin's Newsletter tool (AdminNewsletter.tsx) gathers events,
blog posts and featured cards, with content blocks written for the
issue; this turns them into one email to paste into Mailchimp,
Gmail or Church Center. Nothing is sent from here.
Blocks draw as their email-safe equivalent: headings, paragraphs
(with **bold**, *italic* and [links](url)), callouts, quotes,
lists, link and button rows, images, cards and dividers; a video
is its still linked to the video. Schedules, tables and people,
which need the site, are left out.
No unsubscribe link: Mailchimp adds its own to every send.
Email clients ignore stylesheets, CSS variables and most layout,
so the HTML is tables with inline styles at 600px, images with
width and alt, and the palette written out as hex (the one place
the site's colors are literals: an inbox has no theme tokens). A
plain-text copy goes alongside for clients that show no HTML.
═══════════════════════════════════════════════════════════════ */
export type NewsletterItem = {
title: string
/** A line under the title: dates and place, a byline. */
meta?: string | null
text?: string | null
/** An absolute image URL. */
image?: string | null
/** An absolute link. */
href: string
cta: string
}
export type NewsletterSection = { heading: string; items: NewsletterItem[] }
/* A content block as the block editor holds it. */
export type NewsletterBlock = {
type: string
text?: string | null
media?: string | null
href?: string | null
alt?: string | null
cite?: string | null
items?: Array<{ text?: string | null; detail?: string | null; url?: string | null; media?: string | null }>
}
export type Newsletter = {
title: string
intro?: string | null
/** Written for this issue, under the intro. */
blocks?: NewsletterBlock[]
sections: NewsletterSection[]
/** The closing lines. Blank: the site's name and address. */
footer?: string | null
/** The site's address, for the header link and footer. */
origin: string
siteName: string
/** An absolute URL of the logo for the header. */
logo?: string | null
/** A site path or upload as an absolute address (blocks hold paths and bare filenames). */
absolute: (pathOrFile: string, kind: 'link' | 'image') => string
}
/* The palette as an inbox needs it. */
const COLOR = {
ink: '#001011',
body: '#003a45',
muted: '#3b5456',
teal: '#00748a',
page: '#f5f9f8',
card: '#ffffff',
rule: '#d6f5fa',
}
const FONT = "'Poppins', Helvetica, Arial, sans-serif"
const BODY_FONT = "'Montserrat', Helvetica, Arial, sans-serif"
const escape = (value: string) =>
value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
/* A link an email can follow: the site's own paths made absolute,
anything but http, https and mailto refused. */
function safeHref(href: string, n: Newsletter): string | null {
const value = href.trim()
if (/^(https?:|mailto:)/i.test(value)) return value
if (value.startsWith('/')) return n.absolute(value, 'link')
return null
}
/* Escaped text with the editor's **bold**, *italic* and [text](url). */
function inline(text: string, n: Newsletter): string {
return escape(text)
.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (_whole, label, href) => {
const url = safeHref(href.replace(/&amp;/g, '&'), n)
return url ? `<a href="${escape(url)}" style="color:${COLOR.teal};">${label}</a>` : label
})
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
.replace(/\*([^*]+)\*/g, '<em>$1</em>')
}
/* Paragraphs from text with blank lines between them, formatted
when given the newsletter (its links need the site's address). */
const paragraphs = (text: string, style: string, n?: Newsletter) =>
text
.split(/\n\s*\n/)
.map((part) => part.trim())
.filter(Boolean)
.map((part) => `<p style="${style}">${(n ? inline(part, n) : escape(part)).replace(/\n/g, '<br>')}</p>`)
.join('')
const TEXT = `margin:12px 0 0;font-family:${BODY_FONT};font-size:15px;line-height:24px;color:${COLOR.body};`
const buttonHtml = (href: string, label: string) =>
`<a href="${escape(href)}" style="display:inline-block;margin:4px 8px 4px 0;padding:10px 20px;border-radius:8px;background:${COLOR.teal};color:#ffffff;font-family:${FONT};font-size:14px;font-weight:700;text-decoration:none;">${escape(label)}</a>`
function blockHtml(block: NewsletterBlock, n: Newsletter): string {
const text = block.text?.trim() ?? ''
const href = block.href ? safeHref(block.href, n) : null
const items = block.items ?? []
switch (block.type) {
case 'heading':
return text
? `<h2 style="margin:24px 0 0;font-family:${FONT};font-size:22px;line-height:28px;font-weight:700;color:${COLOR.teal};">${escape(text)}</h2>`
: ''
case 'subheading':
return text
? `<h3 style="margin:20px 0 0;font-family:${FONT};font-size:18px;line-height:24px;font-weight:700;color:${COLOR.ink};">${escape(text)}</h3>`
: ''
case 'paragraph':
return text ? paragraphs(text, TEXT, n) : ''
case 'callout':
return text ? `<div style="margin:16px 0 0;padding:4px 16px 16px;background:${COLOR.rule};">${paragraphs(text, TEXT, n)}</div>` : ''
case 'quote':
return text
? `<blockquote style="margin:16px 0 0;padding:0 0 0 16px;border-left:4px solid ${COLOR.teal};">${paragraphs(text, `${TEXT}font-style:italic;`, n)}${
block.cite ? `<p style="${TEXT}color:${COLOR.muted};">${escape(block.cite)}</p>` : ''
}</blockquote>`
: ''
case 'list':
return items.length
? `<ul style="margin:12px 0 0;padding-left:20px;font-family:${BODY_FONT};font-size:15px;line-height:24px;color:${COLOR.body};">${items
.map((item) => {
const url = item.url ? safeHref(item.url, n) : null
const label = escape(item.text ?? '')
const detail = item.detail ? `: ${escape(item.detail)}` : ''
return `<li>${url ? `<a href="${escape(url)}" style="color:${COLOR.teal};">${label}</a>` : label}${detail}</li>`
})
.join('')}</ul>`
: ''
case 'links': {
const buttons = items
.map((item) => (item.url ? safeHref(item.url, n) : null))
.map((url, i) => (url ? buttonHtml(url, items[i].text || url) : ''))
.join('')
return buttons ? `<p style="margin:16px 0 0;">${buttons}</p>` : ''
}
case 'button':
return href && text ? `<p style="margin:16px 0 0;">${buttonHtml(href, text)}</p>` : ''
case 'image':
case 'video': {
if (!block.media) return ''
const img = `<img src="${escape(n.absolute(block.media, 'image'))}" width="552" alt="${escape(block.alt ?? '')}" style="display:block;width:100%;max-width:552px;height:auto;border:0;">`
const caption = text
? `<p style="margin:6px 0 0;font-family:${BODY_FONT};font-size:13px;line-height:20px;color:${COLOR.muted};">${escape(text)}</p>`
: ''
return `<div style="margin:16px 0 0;">${href ? `<a href="${escape(href)}">${img}</a>` : img}${caption}</div>`
}
case 'cards':
return items
.map((item) => {
const url = item.url ? safeHref(item.url, n) : null
if (!url || !item.text) return ''
return `<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="margin:16px 0 0;background:${COLOR.card};border-left:4px solid ${COLOR.teal};"><tr><td style="padding:16px 20px;">
<h3 style="margin:0;font-family:${FONT};font-size:18px;line-height:24px;font-weight:700;"><a href="${escape(url)}" style="color:${COLOR.ink};text-decoration:none;">${escape(item.text)}</a></h3>
${item.detail ? paragraphs(item.detail, TEXT) : ''}</td></tr></table>`
})
.join('')
case 'divider':
return `<hr style="margin:24px 0 0;border:0;border-top:2px solid ${COLOR.rule};">`
default:
return ''
}
}
function blockText(block: NewsletterBlock, n: Newsletter): string[] {
const text = block.text?.trim() ?? ''
const items = block.items ?? []
const link = (url: string) => safeHref(url, n) ?? url
switch (block.type) {
case 'heading':
return text ? [text.toUpperCase(), ''] : []
case 'subheading':
case 'paragraph':
case 'callout':
case 'image':
return text ? [text, ''] : []
case 'quote':
return text ? [`"${text}"`, ...(block.cite ? [` ${block.cite}`] : []), ''] : []
case 'list':
return items.length
? [...items.map((item) => `- ${item.text ?? ''}${item.detail ? `: ${item.detail}` : ''}${item.url ? ` (${link(item.url)})` : ''}`), '']
: []
case 'links':
case 'cards': {
const lines = items.filter((item) => item.url).map((item) => `${item.text ?? ''}: ${link(item.url!)}`)
return lines.length ? [...lines, ''] : []
}
case 'button':
case 'video':
return block.href ? [`${text || 'Link'}: ${link(block.href)}`, ''] : []
case 'divider':
return ['---', '']
default:
return []
}
}
/* The closing lines: the admin's, or the site's name and address. */
const footerHtml = (n: Newsletter) =>
n.footer?.trim()
? paragraphs(n.footer, `margin:0 0 8px;font-family:${BODY_FONT};font-size:13px;line-height:20px;color:${COLOR.muted};`, n)
: `${escape(n.siteName)}<br><a href="${escape(n.origin)}" style="color:${COLOR.teal};">${escape(n.origin.replace(/^https?:\/\//, ''))}</a>`
function itemHtml(item: NewsletterItem): string {
const image = item.image
? `<tr><td><a href="${escape(item.href)}"><img src="${escape(item.image)}" width="552" alt="" style="display:block;width:100%;max-width:552px;height:auto;border:0;"></a></td></tr>`
: ''
const meta = item.meta
? `<p style="margin:4px 0 0;font-family:${BODY_FONT};font-size:14px;line-height:20px;color:${COLOR.muted};">${escape(item.meta)}</p>`
: ''
const text = item.text
? paragraphs(item.text, `margin:12px 0 0;font-family:${BODY_FONT};font-size:15px;line-height:24px;color:${COLOR.body};`)
: ''
return `
<tr><td style="padding:0 24px 24px;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:${COLOR.card};border-left:4px solid ${COLOR.teal};">
${image}
<tr><td style="padding:20px 24px 24px;">
<h3 style="margin:0;font-family:${FONT};font-size:20px;line-height:26px;font-weight:700;color:${COLOR.ink};"><a href="${escape(item.href)}" style="color:${COLOR.ink};text-decoration:none;">${escape(item.title)}</a></h3>
${meta}${text}
<p style="margin:16px 0 0;"><a href="${escape(item.href)}" style="display:inline-block;padding:10px 20px;border-radius:8px;background:${COLOR.teal};color:#ffffff;font-family:${FONT};font-size:14px;font-weight:700;text-decoration:none;">${escape(item.cta)}</a></p>
</td></tr>
</table>
</td></tr>`
}
export function newsletterHtml(n: Newsletter): string {
const sections = n.sections
.filter((section) => section.items.length > 0)
.map(
(section) => `
<tr><td style="padding:16px 24px 12px;">
<h2 style="margin:0;padding-bottom:8px;border-bottom:2px solid ${COLOR.rule};font-family:${FONT};font-size:22px;line-height:28px;font-weight:700;color:${COLOR.teal};">${escape(section.heading)}</h2>
</td></tr>${section.items.map(itemHtml).join('')}`,
)
.join('')
const logo = n.logo
? `<a href="${escape(n.origin)}"><img src="${escape(n.logo)}" height="48" alt="${escape(n.siteName)}" style="display:block;height:48px;width:auto;border:0;"></a>`
: `<a href="${escape(n.origin)}" style="font-family:${FONT};font-size:18px;font-weight:700;color:#ffffff;text-decoration:none;">${escape(n.siteName)}</a>`
return `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${escape(n.title)}</title>
</head>
<body style="margin:0;padding:0;background:${COLOR.page};">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:${COLOR.page};">
<tr><td align="center" style="padding:24px 12px;">
<table role="presentation" width="600" cellpadding="0" cellspacing="0" style="width:100%;max-width:600px;background:${COLOR.page};">
<tr><td style="padding:20px 24px;background:${COLOR.body};">${logo}</td></tr>
<tr><td style="padding:28px 24px 8px;">
<h1 style="margin:0;font-family:${FONT};font-size:28px;line-height:34px;font-weight:700;color:${COLOR.ink};">${escape(n.title)}</h1>
${n.intro ? paragraphs(n.intro, `margin:12px 0 0;font-family:${BODY_FONT};font-size:16px;line-height:26px;color:${COLOR.body};`, n) : ''}
${(n.blocks ?? []).map((block) => blockHtml(block, n)).join('')}
</td></tr>
${sections}
<tr><td style="padding:24px;border-top:2px solid ${COLOR.rule};font-family:${BODY_FONT};font-size:13px;line-height:20px;color:${COLOR.muted};">
${footerHtml(n)}
</td></tr>
</table>
</td></tr>
</table>
</body>
</html>`
}
export function newsletterText(n: Newsletter): string {
const lines = [n.title, '='.repeat(Math.min(n.title.length, 60)), '']
if (n.intro) lines.push(n.intro.trim(), '')
for (const block of n.blocks ?? []) lines.push(...blockText(block, n))
for (const section of n.sections) {
if (section.items.length === 0) continue
lines.push(section.heading.toUpperCase(), '')
for (const item of section.items) {
lines.push(item.title)
if (item.meta) lines.push(item.meta)
if (item.text) lines.push(item.text.trim())
lines.push(`${item.cta}: ${item.href}`, '')
}
}
lines.push('--', ...(n.footer?.trim() ? [n.footer.trim()] : [n.siteName, n.origin]))
return lines.join('\n')
}

View file

@ -48,6 +48,9 @@ export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href
const PAGES: Record<string, PageText> = { ...siteConfiguration.pages, ...fromServer.pages }
/* Every static page's path and text, for the not-found page's suggestions. */
export const SITE_PAGES: Readonly<Record<string, PageText>> = PAGES
/** A static page's title and intro, from site.json's "pages". */
export function sitePage(path: string): PageText {
const page = PAGES[path]

70
src/lib/suggest.ts Normal file
View file

@ -0,0 +1,70 @@
/* ═══════════════════════════════════════════════════════════════
SUGGEST: what a mistyped or out-of-date address was probably for
The not-found page offers the closest pages to the address that
failed. Each candidate (a static page, or a record from
/directory) is scored by how alike its URL ID or name is to the
address's last part, and its full path to the whole address:
the Dice coefficient over letter pairs, so a typo, a missing
hyphen or an old base (/chapters/lynnwood for /groups/lynnwood)
still lands close. Scores run 0 to 1; anything under MIN_SCORE is
a guess not worth showing.
═══════════════════════════════════════════════════════════════ */
export type Candidate = { href: string; label: string; detail?: string; keys: string[] }
const MIN_SCORE = 0.4
/* Lowercase letters and digits only: "Lynnwood-Group" → "lynnwoodgroup". */
const squash = (text: string) => text.toLowerCase().replace(/[^a-z0-9]/g, '')
function pairs(text: string): Map<string, number> {
const out = new Map<string, number>()
for (let i = 0; i < text.length - 1; i += 1) {
const pair = text.slice(i, i + 2)
out.set(pair, (out.get(pair) ?? 0) + 1)
}
return out
}
/* Dice coefficient of two strings' letter pairs: 1 is identical. */
export function likeness(a: string, b: string): number {
const x = squash(a)
const y = squash(b)
if (!x || !y) return 0
if (x === y) return 1
if (x.length < 2 || y.length < 2) return 0
const left = pairs(x)
const right = pairs(y)
let shared = 0
for (const [pair, count] of left) shared += Math.min(count, right.get(pair) ?? 0)
return (2 * shared) / (x.length - 1 + (y.length - 1))
}
function decode(text: string): string {
try {
return decodeURIComponent(text)
} catch {
return text
}
}
export function suggest(pathname: string, candidates: Candidate[], limit = 5): Candidate[] {
const segments = decode(pathname).split('/').filter(Boolean)
const last = segments.at(-1) ?? ''
const whole = segments.join(' ')
if (!last) return []
return candidates
.map((candidate) => ({
candidate,
score: Math.max(
likeness(whole, candidate.href),
...candidate.keys.map((key) => likeness(last, key)),
),
}))
.filter(({ score }) => score >= MIN_SCORE)
.sort((a, b) => b.score - a.score)
.slice(0, limit)
.map(({ candidate }) => candidate)
}

View file

@ -47,8 +47,6 @@ export type BlogPostSummary = {
}
export type CommunityBlog = {
title?: string | null
blurb?: string | null
internal: { title?: string | null; posts: BlogPostSummary[] }
external: {
title?: string | null

View file

@ -38,11 +38,14 @@ export type ContentBlock = {
| 'schedule'
| 'table'
| 'cards'
| 'people'
text?: string | null
media?: string | null
href?: string | null
/** An image's alt text. */
alt?: string | null
/** A people block's team, shown as its members' tiles. */
team_id?: string | null
/** Who a quote is by. */
cite?: string | null
items?: ContentBlockItem[]
@ -84,6 +87,8 @@ export type EventHost = {
id: string
name: string
org_kind?: string | null
/** An organization host's team, shown in its place (054). */
team?: { id: string; name: string } | null
}
/* ── Events ──────────────────────────────────────────────────── */

25
src/lib/useSitePages.ts Normal file
View file

@ -0,0 +1,25 @@
/* The site's own pages (Community, Retreats, Resources, Organization,
History), built in the admin from sections: GET /site-pages/:id
for one page's sections, GET /site-pages for every page's section
headings (the header's dropdowns, the footer, the side nav). */
import { useRecord, type Resource } from './useRecord.ts'
import type { ContentBlock } from './useContent.ts'
export type SitePageSection = {
anchor: string
title: string
blurb?: string | null
accent?: 'teal' | 'deep' | 'green' | 'amber' | null
preset?: string | null
scope_id?: string | null
event_type?: string | null
view?: string | null
blocks: ContentBlock[]
}
export const useSitePage = (id: string): Resource<{ id: string; sections: SitePageSection[] }> =>
useRecord(`/site-pages/${id}`, 'page')
export const useSitePageHeadings = (): Resource<Record<string, Array<{ anchor: string; title: string }>>> =>
useRecord('/site-pages', 'pages')

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.2";
export const SITE_VERSION = "NGU-Web.v1.10.6";

View file

@ -5,51 +5,14 @@ export const PAGE_LINKS = [
{ label: "Home", path: "/" },
{ label: "Retreats", path: "/retreats" },
{ label: "Community", path: "/community" },
{ label: "Leadership", path: "/leadership" },
{ 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" },
],
"/retreats": [
{ label: "National", hash: "#national" },
{ label: "Regional", hash: "#regional" },
{ label: "Partner Events", hash: "#partner"},
],
"/community": [
{ label: "Community Blog", hash: "#blog" },
{ label: "Local Groups", hash: "#groups" },
{ label: "Unity Regions", hash: "#regions" },
{ label: "Partner Organizations", hash: "#partners" },
],
"/leadership": [
{ label: "Board & Staff", hash: "#board-staff" },
{ label: "Retreat Team", hash: "#retreat-team" },
{ label: "Committees & Volunteers", hash: "#committees" },
{ label: "Contact Us", hash: "#contact" },
],
"/resources": [
{ label: "Unity Teachings", hash: "#unity" },
{ label: "Branding & Marketing", hash: "#branding" },
{ label: "Partner Resources", hash: "#partner" },
],
"/history": [
{ label: "Timeline", hash: "#timeline" },
],
};
// Right-side actions. `variant` picks the styling, not the destination.
export const NAV_ACTIONS = [
{ label: "Contact Us", to: "/leadership#contact", variant: "ghost" },
{ label: "Contact Us", to: "/organization#contact", variant: "ghost" },
{
label: "Give",
to: "/give",

View file

@ -1,95 +0,0 @@
import PageShell from "../components/PageShell.tsx";
import { sitePage } from "../lib/site.ts";
import { useSectionManifest } from "../lib/sections.tsx";
import OrgListMap, { OrgMapToggle } from "./sections/OrgList-Map.tsx";
import OrgListVertical from "./sections/OrgList-Vertical.tsx";
import OrgListCards from "./sections/OrgList-Card.tsx";
import CommunityBlog from "./sections/CommunityBlog.tsx";
import { useCommunityBlog } from "../lib/useBlog.ts";
import { ACCENTS, BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/community");
/* ═══════════════════════════════════════════════════════════════
COMMUNITY PAGE
The blog first, then two views of the organizations table. The
map is filtered to groups; the vertical list is filtered to
regions. Same rows, same endpoint, different shape on the page.
The blog's heading and blurb are the admin's (Pages → Community blog
section), so that one entry is built here from the same cached
request CommunityBlog makes for its posts.
═══════════════════════════════════════════════════════════════ */
const BLOG_DEFAULT_TITLE = "Community Blog";
const SECTIONS = [
{
id: "groups",
title: "Local Groups",
blurb:
"Young adult groups meeting in person and online across the movement.",
accent: BRAND,
Component: OrgListMap,
request: { type: "group", label: "Add or update a group" },
views: { options: ["map", "grid"], default: "map", Toggle: OrgMapToggle },
},
{
id: "regions",
title: "Unity Regions",
blurb:
"The regional organizations that support groups and host their own gatherings.",
accent: "#3b5456",
Component: OrgListVertical,
request: { type: "region", label: "Request a region update" },
props: {
kind: "region",
pageLabel: "Region page",
groupBy: org => org.details?.scope,
groups: [
{ key: "domestic", title: "US Unity Regions" },
{ key: "international", title: "International Unity Regions" },
],
},
},
{
id: "partners",
title: "Partner Organizations",
blurb:
"Organizations we collaborate with across the Unity movement and beyond.",
accent: ACCENTS.amber,
Component: OrgListCards,
request: { type: "partner", label: "Request a partner listing" },
props: {
kind: "partner",
pageLabel: "Partner page",
empty: "· Partner organizations coming soon ·",
},
},
];
export default function CommunityPage() {
const { data: blog } = useCommunityBlog();
const sections = useSectionManifest([
{
id: "blog",
title: blog?.title || BLOG_DEFAULT_TITLE,
blurb: blog?.blurb ?? undefined,
accent: BRAND,
Component: CommunityBlog,
request: { type: "blog", label: "Write for the blog" },
},
...SECTIONS,
]);
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={sections}
/>
);
}

View file

@ -295,12 +295,14 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
sentence, so they're joined with commas and an "and" rather than
stacked. A host whose id didn't resolve to a route renders as
plain text, refHref returns null for that, because a dead link
is worse than a name. */
is worse than a name. An organization host with a team set shows
the team instead, linked to the team's page. */
function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
return (
<>
{hosts.map((host, index) => {
const to = refHref(host.kind, host.id, host.org_kind)
const to = host.team ? refHref('team', host.team.id) : refHref(host.kind, host.id, host.org_kind)
const name = host.team?.name ?? host.name
return (
<span key={`${host.kind}:${host.id}`}>
@ -312,10 +314,10 @@ function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
className="font-medium hover:underline"
style={{ color: accentText(accent) }}
>
{host.name}
{name}
</Link>
) : (
<span className="font-medium">{host.name}</span>
<span className="font-medium">{name}</span>
)}
</span>
)

View file

@ -1,87 +0,0 @@
import PageShell from "../components/PageShell.tsx";
import { sitePage } from "../lib/site.ts";
import HistoryTimeline from "./sections/history/HistoryTimeline.tsx";
import { HISTORY_DECADES } from "../data/historyDecades.ts";
import { useHistory } from "../lib/useHistory.ts";
import { BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/history");
/**
* Year the program starts. Decades ending before this render with the
* pre-program treatment, so the gap moves if the founding date is ever
* corrected, no hardcoded 2000 anywhere in the components.
*/
const PROGRAM_START_YEAR = 2000;
const BACKGROUND = "var(--color-surface)";
export default function History() {
const { items, loading, error, reload } = useHistory();
// Section renders `content` outside its own max-width wrapper, so the
// container lives here. The custom properties bind the timeline to
// this section's accent and background, --tl-surface must match
// `background` or the rail will show through the year dots.
const wrap = (children: React.ReactNode) => (
<div
className="max-w-6xl mx-auto px-6"
style={{ "--tl-accent": BRAND, "--tl-surface": BACKGROUND } as React.CSSProperties}
>
{children}
</div>
);
let content: React.ReactNode;
if (loading) {
content = wrap(
<p className="py-12 text-muted" role="status">
Loading the timeline…
</p>,
);
} else if (error) {
// Say what failed and offer the one action that might fix it.
// A history page that silently renders nothing looks like an
// organization with no history.
content = wrap(
<div className="py-12">
<p className="text-danger">Couldn’t load the timeline. {error}</p>
<button
type="button"
onClick={reload}
className="mt-3 btn border border-brand px-4 py-1.5 text-sm text-link transition-colors hover:bg-tint"
>
Try again
</button>
</div>,
);
} else {
content = wrap(
<HistoryTimeline
items={items}
decades={HISTORY_DECADES}
direction="desc"
programStartYear={PROGRAM_START_YEAR}
/>,
);
}
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={[
{
id: "timeline",
title: "NGU Timeline",
blurb:
"Open a year to see what happened.",
accent: BRAND,
content,
},
]}
/>
);
}

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,66 +0,0 @@
import PageShell from "../components/PageShell.tsx";
import ComingSoon from "../components/ComingSoon.tsx";
import { sitePage } from "../lib/site.ts";
import PeopleTiles from "../components/PeopleTiles.tsx";
import { ACCENTS, BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/leadership");
const SECTIONS = [
{
id: "board-staff",
title: "Board & Staff",
blurb: "The people guiding Next Generation of Unity day to day.",
accent: BRAND,
content: (
<div className="max-w-6xl mx-auto px-6">
<PeopleTiles size="lg" teams={{ id: "ngu-board",}} />
</div>
),
},
{
id: "retreat-team",
title: "Retreat Team",
blurb: "Volunteers who plan and lead our gatherings throughout the year.",
accent: ACCENTS.green,
content: (
<div className="max-w-6xl mx-auto px-6">
<PeopleTiles size="lg" teams="ngu-retreat-team" />
</div>
),
},
{
id: "committees",
title: "Committees & Volunteers",
blurb: "Additional roles and contributors.",
accent: ACCENTS.amber,
content: <ComingSoon what="this list of committees and volunteers" />,
},
{
id: "contact",
title: "Contact Us",
blurb: "Reach out to our staff",
accent: ACCENTS.deep,
content: (
<div className="max-w-6xl mx-auto px-6">
<a
href="mailto:info@nextgenerationofunity.org"
className="inline-block py-2.5 px-6 btn border border-link text-link transition-all duration-200 hover:scale-105 active:scale-[0.98]"
>
info@nextgenerationofunity.org
</a>
</div>
),
},
];
export default function Leadership() {
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={SECTIONS}
/>
);
}

View file

@ -1,16 +1,133 @@
import { Link } from "react-router-dom";
/* ═══════════════════════════════════════════════════════════════
NOT FOUND: any address no route matches
Rather than a dead end, the closest pages to the address that
failed: the static pages (site.json's) and every public, listed
record (GET /directory), scored by suggest.ts against the
address. So /organisation offers Organization, /retreat offers
Retreats, and an old /chapters/lynnwood offers the Lynnwood group.
Below them, the main pages to start from.
The server sends this same page with a 404 status for an unknown
address (routes/pages.js), so search engines drop it.
═══════════════════════════════════════════════════════════════ */
import { ArrowRight } from '@phosphor-icons/react'
import { useMemo } from 'react'
import { Link, useLocation } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx'
import { PAGE_LINKS } from '../navConfig.ts'
import { SITE_PAGES } from '../lib/site.ts'
import { useDirectory, type Directory } from '../lib/useContent.ts'
import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts'
import { suggest, type Candidate } from '../lib/suggest.ts'
import { ACCENTS, BRAND } from '../lib/color.ts'
const ORG_KIND_LABEL: Record<string, string> = {
national: 'Organization',
region: 'Region',
group: 'Group',
partner: 'Partner',
}
/* Everything an address could have meant: the static pages, then
each kind of record, with the words to match it by. */
function candidates(directory: Directory | null): Candidate[] {
const pages: Candidate[] = Object.entries(SITE_PAGES).map(([path, page]) => ({
href: path,
label: page.title,
detail: 'Page',
keys: [path.slice(1), page.title],
}))
if (!directory) return pages
const record = (href: string, id: string, name: string, detail: string): Candidate => ({
href,
label: name,
detail,
keys: [id, name],
})
return [
...pages,
...directory.events.map((e) => record(eventHref(e.id), e.id, e.name, 'Event')),
...directory.organizations.map((o) => record(orgHref(o.id, o.kind), o.id, o.name, ORG_KIND_LABEL[o.kind] ?? 'Organization')),
...directory.teams.map((t) => record(teamHref(t.id), t.id, t.name, `Team, ${t.org_name}`)),
...directory.awards.map((a) => record(awardHref(a.id), a.id, a.name, 'Award')),
...directory.people.map((p) => record(personHref(p.id), p.id, p.name, 'Person')),
...directory.blog_posts.map((b) => record(blogHref(b.id), b.id, b.name, 'Blog post')),
]
}
export default function NotFound() {
const { pathname } = useLocation()
const { data: directory, loading } = useDirectory()
const matches = useMemo(() => suggest(pathname, candidates(directory ?? null)), [pathname, directory])
return (
<section className="px-6 py-20">
<h1 className="text-4xl font-bold">That page isn't here</h1>
<p className="mt-4 text-lg">
The link may be out of date.{" "}
<Link to="/" className="underline">
Go to the home page
</Link>
.
</p>
</section>
);
<PageShell
title="That page isn’t here"
intro="The link may be out of date, or the address may have a typo."
sections={[
{
id: 'suggestions',
title: matches.length ? 'Were you looking for' : 'Nothing close by that name',
accent: BRAND,
content: (
<div className="mx-auto max-w-6xl px-6">
{loading && !directory ? (
<div className="skeleton !min-h-32" aria-label="Looking for similar pages" />
) : matches.length ? (
<ul className="max-w-2xl divide-y divide-brand/15 bg-raised shadow-sm">
{matches.map((match) => (
<li key={match.href}>
<Link
to={match.href}
className="group flex items-center gap-4 px-5 py-4 transition-colors hover:bg-tint-soft"
>
<span className="min-w-0 flex-1">
<span className="block font-display font-bold text-ink">{match.label}</span>
<span className="block text-sm text-muted">
{match.detail} · {match.href}
</span>
</span>
<ArrowRight
className="shrink-0 text-link transition-transform group-hover:translate-x-1"
weight="bold"
aria-hidden="true"
/>
</Link>
</li>
))}
</ul>
) : (
<p className="notice max-w-xl p-6 text-body">
Try one of the main pages below, or the menu at the top.
</p>
)}
</div>
),
},
{
id: 'start',
title: 'Start from',
accent: ACCENTS.green,
content: (
<div className="mx-auto flex max-w-6xl flex-wrap gap-3 px-6">
{PAGE_LINKS.map((page) => (
<Link
key={page.path}
to={page.path}
className="btn border border-brand/50 px-5 py-2 text-link transition-colors hover:bg-tint"
>
{page.label}
</Link>
))}
</div>
),
},
]}
/>
)
}

View file

@ -10,26 +10,23 @@
a region redirects to the canonical path rather than rendering a
correct page at a wrong address.
Leadership arrives flat with team_id and team_name on each row,
so grouping costs nothing. `teams` is fetched alongside anyway:
a team with no current public members would otherwise be
invisible here instead of listed, and its page unreachable.
Its leadership, team by team, is OrgTeams (shared with the
Organization page); its contact buttons are OrgContact.
═══════════════════════════════════════════════════════════════ */
import { Link, Navigate, useLocation, useParams } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx'
import PageState from '../components/PageState.tsx'
import PlatformIcon from '../components/PlatformIcon.tsx'
import ContentBlocks from '../components/ContentBlocks.tsx'
import PeopleTiles from '../components/PeopleTiles.tsx'
import OrgTeams, { hasTeams } from '../components/OrgTeams.tsx'
import OrgContact from '../components/OrgContact.tsx'
import EventListCards from './sections/EventList-Cards.tsx'
import {
useOrganization,
type Leader,
type OrganizationRecord,
} from '../lib/useContent.ts'
import { orgHref, orgListHref, teamHref } from '../lib/hrefs.ts'
import { orgHref, orgListHref } from '../lib/hrefs.ts'
import { mediaUrl } from '../lib/media.ts'
import { initialsFor } from '../lib/organizations.ts'
import Logo from '../components/Logo.tsx'
@ -94,69 +91,20 @@ export default function OrganizationDetail() {
<ContentBlocks blocks={org.blocks} accent={accent} />
</div>
<Contact org={org} accent={accent} />
<OrgContact org={org} accent={accent} />
</div>
),
},
]
const teamBlocks = groupLeadership(org)
if (teamBlocks.length > 0) {
if (hasTeams(org)) {
sections.push({
id: 'leadership',
title: 'Who runs it',
accent,
content: (
<div className="max-w-6xl mx-auto px-6 space-y-12">
{teamBlocks.map((block) => (
<div key={block.key}>
<div className="mb-4">
{block.teamId ? (
<h3 className="text-xl font-bold">
<Link
to={teamHref(block.teamId)}
className="hover:underline"
style={{ color: accentText(accent) }}
>
{block.label}
</Link>
</h3>
) : (
block.label && (
<h3 className="text-xl font-bold" style={{ color: accentText(accent) }}>
{block.label}
</h3>
)
)}
{block.tagline && (
<p className="mt-1 text-sm" style={{ color: BODY }}>
{block.tagline}
</p>
)}
</div>
{block.people.length > 0 ? (
<PeopleTiles
size="lg"
accent={block.accent || accent}
people={block.people.map((leader) => ({
id: leader.person_id,
name: leader.display_name,
title: leader.title,
pronouns: leader.pronouns,
public_email: leader.public_email,
photo: mediaUrl(leader.photo),
is_owner: leader.is_owner,
}))}
/>
) : (
<p className="text-sm italic" style={{ color: BODY }}>
No members listed yet.
</p>
)}
</div>
))}
<div className="max-w-6xl mx-auto px-6">
<OrgTeams org={org} accent={accent} />
</div>
),
})
@ -308,53 +256,6 @@ function Facts({
)
}
function Contact({ org, accent }: { org: OrganizationRecord; accent: string }) {
const hasAny =
org.links.length > 0 || org.socials.length > 0 || org.website || org.email
if (!hasAny) return null
return (
<div className="flex flex-wrap gap-3">
{org.links.map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-2 btn px-5 py-2 text-sm text-white transition-transform hover:scale-105"
style={{ background: accent }}
>
<PlatformIcon platform={link.platform} />
{link.label}
</a>
))}
{/* website and email arrive as bare strings (splitLinks in
shape.js); socials are whole link rows. */}
{[
org.website ? { url: org.website, label: 'Website', platform: null } : null,
org.email ? { url: `mailto:${org.email}`, label: org.email, platform: null } : null,
...org.socials,
]
.filter((link): link is NonNullable<typeof link> => Boolean(link))
.map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-2 btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
style={{ borderColor: accent, color: accentText(accent) }}
>
<PlatformIcon platform={link.platform} />
{link.label}
</a>
))}
</div>
)
}
function GroupMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) {
return (
<Logo
@ -372,67 +273,3 @@ function GroupMark({ file, name, accent }: { file?: string | null; name: string;
/>
)
}
/* ── Leadership → team blocks ────────────────────────────────── */
type TeamBlock = {
key: string
teamId: string | null
label: string | null
tagline?: string | null
accent?: string | null
people: Leader[]
}
/* Order comes from `teams` (the admin's sort_order), not from the
order people happen to appear in. Three cases to cover:
affiliations with no team at all, teams with nobody in them, and
people filed under a team that is no longer published. */
function groupLeadership(org: OrganizationRecord): TeamBlock[] {
const byTeam = new Map<string, Leader[]>()
const loose: Leader[] = []
for (const leader of org.leadership) {
if (!leader.team_id) {
loose.push(leader)
continue
}
const list = byTeam.get(leader.team_id)
if (list) list.push(leader)
else byTeam.set(leader.team_id, [leader])
}
const blocks: TeamBlock[] = []
// People who hold a role in the organization without sitting on a
// team. Usually the leads. No heading, they are the page.
if (loose.length > 0) {
blocks.push({ key: 'loose', teamId: null, label: null, people: loose })
}
for (const team of org.teams) {
blocks.push({
key: team.id,
teamId: team.id,
label: team.name,
tagline: team.tagline,
accent: team.color,
people: byTeam.get(team.id) ?? [],
})
byTeam.delete(team.id)
}
// Whatever is left is filed under an unpublished team. Its page
// isn't reachable, so the heading is plain text, but the people
// are real and shouldn't silently vanish from the org.
for (const [teamId, people] of byTeam) {
blocks.push({
key: teamId,
teamId: null,
label: people[0]?.team_name ?? null,
people,
})
}
return blocks
}

View file

@ -61,8 +61,8 @@ export default function PersonDetail() {
notFound={notFound}
onRetry={reload}
noun="person"
backTo="/leadership"
backLabel="Leadership"
backTo="/organization"
backLabel="Organization"
/>
)
}
@ -247,7 +247,7 @@ function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
{person.location_label && <span style={{ color: BODY }}>{person.location_label}</span>}
<Link to="/leadership" className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
<Link to="/organization#leadership" className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
Leadership
</Link>
</div>

View file

@ -24,7 +24,7 @@ const PAGE = sitePage("/privacy");
'privacy', in Admin → Forms → Data requests.
═══════════════════════════════════════════════════════════════ */
const LAST_UPDATED = "September 29, 2026";
const LAST_UPDATED = "September 30, 2026";
const link = "underline underline-offset-2 text-link";
@ -105,8 +105,13 @@ const PARTS: LegalPart[] = [
],
list: [
<>
<strong>Giving</strong> is handled by Church Center (Planning Center). Payment details go to them,
not to us.
<strong>Giving</strong> is handled by Church Center (Planning Center), at{" "}
<a href="https://ngu.churchcenteronline.com" className="text-link underline underline-offset-2">
ngu.churchcenteronline.com
</a>
. Payment details go to them, not to us. Church Center's script loads when you open our Giving page,
and its giving form opens when you press Give; Church Center may use Google Analytics in that form,
under its own privacy policy.
</>,
<>
<strong>Videos</strong> come from YouTube, Facebook or Vimeo, and <strong>maps</strong> from Google
@ -132,7 +137,7 @@ const PARTS: LegalPart[] = [
id: "cookies",
heading: "Cookies and browser storage",
body: [
"This site doesn't use advertising, analytics or tracking cookies. It keeps a few small things in your own browser so it works the way you left it:",
"This site doesn't use advertising or tracking cookies, and doesn't use Google Analytics. To see which pages are read, we use Plausible Analytics, which we host ourselves on our own server: it sets no cookies, doesn't follow you across sites, and keeps no personal information, only counts of visits to each page; nothing from it is shared or sold. The site also keeps a few small things in your own browser so it works the way you left it:",
],
list: [
"That you closed the announcement banner or the privacy notice.",

View file

@ -1,41 +0,0 @@
import PageShell from "../components/PageShell.tsx";
import ComingSoon from "../components/ComingSoon.tsx";
import { sitePage } from "../lib/site.ts";
import { ACCENTS, BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/resources");
const SECTIONS = [
{
id: "unity",
title: "Unity Teachings",
blurb: "Core principles, readings, and study material from the Unity movement.",
accent: BRAND,
content: <ComingSoon what="our Unity teachings" />,
},
{
id: "branding",
title: "Branding & Marketing",
blurb: "Logos, colors, templates, and guidelines for representing NGU.",
accent: ACCENTS.green,
content: <ComingSoon what="our branding and marketing kit" />,
},
{
id: "partner",
title: "Partner Resources",
blurb: "Material for the organizations we collaborate with.",
accent: ACCENTS.amber,
content: <ComingSoon what="resources for partners" />,
},
];
export default function ResourcesPage() {
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={SECTIONS}
/>
);
}

View file

@ -1,120 +0,0 @@
import PageShell from "../components/PageShell.tsx";
import { sitePage } from "../lib/site.ts";
import { useSectionManifest } from "../lib/sections.tsx";
import EventListCards, { EventCardsToggle } from "./sections/EventList-Cards.tsx";
import { ACCENTS, BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/retreats");
/* ═══════════════════════════════════════════════════════════════
RETREATS PAGE
Three bands, all the same view of the same table with a
different filter. The page declares them and does nothing else,
each section fetches its own slice.
Two filters per band now, and they answer different questions:
scope whose gathering it is. event_scopes holds six of
these; this page draws three.
type what kind of gathering it is. Pinned to "retreat"
everywhere on this page, which is what the page is
for and what lets "Partner" read as a heading rather
than a catch-all.
Because every band is pinned to one type, EventListCards finds a
single kind in each and draws no type chips. Drop the `type` from
a band and the chips appear on their own.
What this page deliberately does not show: local, international
and other scopes, and every non-retreat type. Those are reachable
from their host's page and by URL, and get a band here when
there's enough of them to fill one, see the block at the bottom.
To reorder the page, move a line. To add a different kind of
section, add an entry with another Component.
═══════════════════════════════════════════════════════════════ */
const CARD_VIEWS = { options: ["carousel", "grid"], Toggle: EventCardsToggle };
/* Pinned on every band. Named rather than repeated so turning this
page into "everything, filtered" later is one deletion. */
const RETREATS = { type: "retreat" };
const SECTIONS = [
{
id: "national",
title: "National Retreats",
blurb: "Our flagship gatherings, open to young adults across the country.",
accent: BRAND,
Component: EventListCards,
props: { scope: "national", ...RETREATS },
views: { ...CARD_VIEWS, default: "carousel" },
request: { type: "event", label: "Add or update an event" },
},
{
id: "regional",
title: "Regional Retreats",
blurb: "Smaller gatherings hosted by regions throughout the year.",
accent: ACCENTS.green,
Component: EventListCards,
props: { scope: "regional", ...RETREATS },
views: { ...CARD_VIEWS, default: "grid" },
},
{
id: "partner",
title: "Partner Events",
blurb: "Retreats hosted by organizations we collaborate with.",
accent: ACCENTS.amber,
Component: EventListCards,
props: { scope: "partner", ...RETREATS },
views: { ...CARD_VIEWS, default: "grid" },
},
/* The other three scopes, ready to uncomment. Each needs an accent
and a background of its own, those are presentation and live
here, not in event_scopes.
{
id: "local",
title: "Local Events",
blurb: "Hosted by individual groups.",
accent: ACCENTS.green,
Component: EventListCards,
props: { scope: "local", ...RETREATS_ONLY },
views: { ...CARD_VIEWS, default: "grid" },
},
{
id: "international",
title: "International Events",
blurb: "Gatherings beyond the US.",
accent: ACCENTS.deep,
Component: EventListCards,
props: { scope: "international", ...RETREATS_ONLY },
views: { ...CARD_VIEWS, default: "grid" },
},
{
id: "other",
title: "Other Events",
blurb: "Everything that doesn't fit the categories above.",
accent: ACCENTS.amber,
Component: EventListCards,
props: { scope: "other", ...RETREATS_ONLY },
views: { ...CARD_VIEWS, default: "grid" },
},
*/
];
export default function RetreatsPage() {
const sections = useSectionManifest(SECTIONS);
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={sections}
/>
);
}

216
src/pages/SitePage.tsx Normal file
View file

@ -0,0 +1,216 @@
/* ═══════════════════════════════════════════════════════════════
SITE PAGE: /community, /retreats, /resources, /organization,
/history
Each is a list of sections built in the admin (Pages → the page,
GET /site-pages/:id). A section is its heading, then its own
content blocks, then its preset if it has one: a prebuilt part of
the site, from PRESETS below. A section with neither says it's
coming (ComingSoon) rather than showing a heading over nothing.
The title and intro are site.json's, which also gives the search
metadata.
═══════════════════════════════════════════════════════════════ */
import { useEffect } from 'react'
import { useLocation } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx'
import ComingSoon from '../components/ComingSoon.tsx'
import ContentBlocks from '../components/ContentBlocks.tsx'
import { sitePage } from '../lib/site.ts'
import { useSectionManifest } from '../lib/sections.tsx'
import { useSitePage, type SitePageSection } from '../lib/useSitePages.ts'
import { useHistory } from '../lib/useHistory.ts'
import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts'
import { HISTORY_DECADES } from '../data/historyDecades.ts'
import { ACCENTS, BRAND } from '../lib/color.ts'
import { scrollBehavior } from '../lib/motion.ts'
import OrgListMap, { OrgMapToggle } from './sections/OrgList-Map.tsx'
import OrgListVertical from './sections/OrgList-Vertical.tsx'
import OrgListCards from './sections/OrgList-Card.tsx'
import EventListCards, { EventCardsToggle } from './sections/EventList-Cards.tsx'
import CommunityBlog from './sections/CommunityBlog.tsx'
import HistoryTimeline from './sections/history/HistoryTimeline.tsx'
/* Year the program starts: decades ending before it get the
pre-program look on the timeline. */
const PROGRAM_START_YEAR = 2000
/* Each preset: the view it draws, its fixed props, its toggle (the
section's own view picks the first one) and its Request button.
The keys are the CHECK list on page_sections.preset. */
const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>> = {
community_blog: () => ({
Component: CommunityBlog,
request: { type: 'blog', label: 'Write for the blog' },
}),
group_map: (section) => ({
Component: OrgListMap,
request: { type: 'group', label: 'Add or update a group' },
views: { options: ['map', 'grid'], default: section.view === 'grid' ? 'grid' : 'map', Toggle: OrgMapToggle },
}),
region_list: () => ({
Component: OrgListVertical,
request: { type: 'region', label: 'Request a region update' },
props: {
kind: 'region',
pageLabel: 'Region page',
groupBy: (org: any) => org.details?.scope,
groups: [
{ key: 'domestic', title: 'US Unity Regions' },
{ key: 'international', title: 'International Unity Regions' },
],
},
}),
partner_list: () => ({
Component: OrgListCards,
request: { type: 'partner', label: 'Request a partner listing' },
props: { kind: 'partner', pageLabel: 'Partner page', empty: '· Partner organizations coming soon ·' },
}),
events: (section) => ({
Component: EventListCards,
request: { type: 'event', label: 'Add or update an event' },
props: { scope: section.scope_id ?? undefined, type: section.event_type ?? undefined },
views: {
options: ['carousel', 'grid'],
default: section.view === 'grid' ? 'grid' : 'carousel',
Toggle: EventCardsToggle,
},
}),
timeline: () => ({ Component: Timeline }),
organization_details: () => ({ Component: OrganizationDetails }),
}
export default function SitePage({ id }: { id: string }) {
const PAGE = sitePage(`/${id}`)
const { data: page, loading, error } = useSitePage(id)
if (page) return <Sections title={PAGE.title} intro={PAGE.description} sections={page.sections} />
return (
<>
<PageShell title={PAGE.title} intro={PAGE.description} sections={[]} />
<div className="mx-auto max-w-6xl px-6 py-20">
{error ? (
<p className="text-danger">Couldn’t load this page right now.</p>
) : (
loading && <div className="skeleton !min-h-40" aria-label="Loading the page" />
)}
</div>
</>
)
}
/* Its own component so the manifest, which seeds each toggle's view
once, sees the loaded sections. */
function Sections({ title, intro, sections }: { title: string; intro?: string; sections: SitePageSection[] }) {
// Layout scrolls to a link's #section on arrival, before the
// sections have loaded; this does it again once they're here.
const { hash } = useLocation()
useEffect(() => {
if (hash) document.getElementById(decodeURIComponent(hash.slice(1)))?.scrollIntoView({ behavior: scrollBehavior() })
}, [hash])
const manifest = useSectionManifest(
sections.map((section) => {
const accent = ACCENTS[section.accent ?? 'teal'] ?? BRAND
const preset = section.preset ? PRESETS[section.preset]?.(section) : null
return {
id: section.anchor,
title: section.title,
blurb: section.blurb ?? undefined,
accent,
...preset,
// Blocks, then the preset under them.
Component: SectionBody,
props: { blocks: section.blocks, title: section.title, Preset: preset?.Component, presetProps: preset?.props },
}
}),
)
return <PageShell sideNav title={title} intro={intro} sections={manifest} />
}
function SectionBody({ blocks, title, Preset, presetProps, ...rest }: any) {
if (!blocks.length && !Preset) return <ComingSoon what={`our ${title}`} />
return (
<>
{blocks.length > 0 && (
<div className={`mx-auto max-w-6xl px-6 ${Preset ? 'mb-12' : ''}`}>
<ContentBlocks blocks={blocks} accent={rest.accent} />
</div>
)}
{Preset && <Preset {...presetProps} {...rest} />}
</>
)
}
function Timeline({ accent = BRAND }: { accent?: string }) {
const { items, loading, error, reload } = useHistory()
// The custom properties bind the timeline to this section's accent
// and the page's surface, which the rail must match or it shows
// through the year dots.
return (
<div
className="mx-auto max-w-6xl px-6"
style={{ '--tl-accent': accent, '--tl-surface': 'var(--color-surface)' } as React.CSSProperties}
>
{loading ? (
<p className="py-12 text-muted" role="status">
Loading the timeline…
</p>
) : error ? (
// A history page that silently renders nothing looks like an
// organization with no history: say so, and offer a retry.
<div className="py-12">
<p className="text-danger">Couldn’t load the timeline. {error}</p>
<button
type="button"
onClick={reload}
className="btn mt-3 border border-brand px-4 py-1.5 text-sm text-link transition-colors hover:bg-tint"
>
Try again
</button>
</div>
) : (
<HistoryTimeline
items={items}
decades={HISTORY_DECADES}
direction="desc"
programStartYear={PROGRAM_START_YEAR}
/>
)}
</div>
)
}
/* NGU's address, nonprofit status and email (src/data/organizationDetails.ts). */
function OrganizationDetails() {
const details = ORGANIZATION_DETAILS
return (
<div className="mx-auto grid max-w-6xl gap-8 px-6 md:grid-cols-2">
<div className="space-y-3 text-body">
<address className="not-italic leading-relaxed">
{details.street}
<br />
{details.cityLine}
<br />
<span className="text-sm text-muted">({details.addressNote})</span>
</address>
<p className="text-sm text-muted">
{details.nonprofit} Tax ID: {details.taxId}.
</p>
</div>
<div>
<a
href={`mailto:${details.email}`}
className="btn inline-block border border-link px-6 py-2.5 text-link transition-colors hover:bg-tint"
>
{details.email}
</a>
</div>
</div>
)
}

View file

@ -36,8 +36,8 @@ export default function TeamDetail() {
notFound={notFound}
onRetry={reload}
noun="team"
backTo="/leadership"
backLabel="Leadership"
backTo="/organization"
backLabel="Organization"
/>
)
}

View file

@ -0,0 +1,527 @@
/* ═══════════════════════════════════════════════════════════════
NEWSLETTER (Tools)
Builds an email newsletter from what's already on the site: tick
upcoming events, published blog posts and the front page's
featured cards, write a title, an intro, content blocks and a
footer, and copy the result, email-ready HTML or plain text, into
Mailchimp, Gmail or Church Center (or download it as a file).
Nothing is sent from here; the builder is src/lib/newsletter.ts.
Drafts are saved (the newsletters entity, 057_newsletters.sql),
to finish later or send again, and a draft can become an
unpublished blog post: its intro, blocks and picks as the post's
body, opened in the post's editor to finish.
Picked blog posts are read from their public pages, so only a
post visitors can open makes it in, with its excerpt and cover.
Links and images are the live site's (SITE_ORIGIN), since an
email is read far from this admin.
═══════════════════════════════════════════════════════════════ */
import { Article, Check, Copy, DownloadSimple, FloppyDisk, Trash } from '@phosphor-icons/react'
import { useEffect, useMemo, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { ApiError, del, get, patch, post } from '../../lib/api.ts'
import { useAuth } from '../../lib/auth.tsx'
import { canDelete, canWrite } from '../../lib/roles.ts'
import { slugify } from '../../lib/adminSchema.ts'
import { blocksChild } from '../../lib/adminSchema/shared.ts'
import { Repeater } from '../../components/admin/fields.tsx'
import { useEvents } from '../../lib/eventData.ts'
import { useFrontPage, type FeaturedCard } from '../../lib/useFrontPage.ts'
import type { BlogPostRecord } from '../../lib/useBlog.ts'
import { blogHref, eventHref, refHref } from '../../lib/hrefs.ts'
import { mediaUrl } from '../../lib/media.ts'
import { SITE_NAME, SITE_ORIGIN, siteUrl } from '../../lib/site.ts'
import { seriesLabel } from '../../lib/eventSeries.ts'
import { useWideAdminPage } from '../../lib/adminWidth.tsx'
import {
newsletterHtml,
newsletterText,
type NewsletterBlock,
type NewsletterItem,
type NewsletterSection,
} from '../../lib/newsletter.ts'
const MUTED = 'var(--color-muted)'
const input =
'w-full border border-muted/25 bg-surface px-3 py-2 text-sm text-body outline-none focus:border-brand focus:ring-2 focus:ring-brand/25'
const button =
'btn inline-flex items-center gap-2 border border-brand px-4 py-2 text-sm text-link transition-colors hover:bg-tint disabled:opacity-50'
/* An address on the live site, whatever it started as. */
const absolute = (path: string | null | undefined) => (path ? siteUrl(path) : null)
const imageFor = (file: string | null | undefined) => absolute(mediaUrl(file))
type PostRow = { id: string; title: string; published_on?: string | null; is_published: number; is_listed: number }
type DraftRow = { id: number; title?: string | null; updated_at: string }
type Picks = { events?: string[]; posts?: string[]; cards?: string[] }
/* The block types an email can show (newsletter.ts draws them);
schedules, tables and people need the site. */
const EMAIL_BLOCKS = ['paragraph', 'heading', 'subheading', 'callout', 'quote', 'list', 'links', 'button', 'image', 'video', 'cards', 'divider']
const BLOCKS_SPEC = {
...blocksChild,
label: 'Blocks',
note: 'Written for this issue, under the intro. A video shows as its still, linked to the video.',
fields: blocksChild.fields
.filter((field) => field.path !== 'slot')
.map((field) =>
field.path === 'type' ? { ...field, options: (field.options ?? []).filter(([type]) => EMAIL_BLOCKS.includes(type)) } : field,
),
}
/* A site path or upload on the live site, for the email. */
const absoluteFor = (value: string, kind: 'link' | 'image') => (kind === 'image' ? imageFor(value) ?? value : siteUrl(value))
function featuredHref(card: FeaturedCard): string | null {
if (card.kind === 'record' && card.ref) return refHref(card.ref.kind, card.ref.id, card.ref.org_kind)
return card.url
}
export default function AdminNewsletter() {
useWideAdminPage()
const navigate = useNavigate()
const { user } = useAuth()
const [title, setTitle] = useState('')
const [intro, setIntro] = useState('')
const [footer, setFooter] = useState('')
const [blocks, setBlocks] = useState<NewsletterBlock[]>([])
const [pickedEvents, setPickedEvents] = useState<Set<string>>(new Set())
const [pickedPosts, setPickedPosts] = useState<Set<string>>(new Set())
// Cards by their link: the front page's cards can be reordered
// between one save and the next.
const [pickedCards, setPickedCards] = useState<Set<string>>(new Set())
const [posts, setPosts] = useState<PostRow[] | null>(null)
const [postDetails, setPostDetails] = useState<Record<string, BlogPostRecord>>({})
const [copied, setCopied] = useState<'html' | 'text' | null>(null)
// The draft being edited: null is a new one, not saved yet.
const [drafts, setDrafts] = useState<DraftRow[]>([])
const [draft, setDraft] = useState<{ id: number; updated_at: string } | null>(null)
const [busy, setBusy] = useState(false)
const [message, setMessage] = useState<{ tone: 'ok' | 'error'; text: string } | null>(null)
const { events, loading: eventsLoading } = useEvents({ status: 'upcoming' })
const { data: frontPage } = useFrontPage()
const cards = frontPage?.featured ?? []
useEffect(() => {
get('/admin/blog_posts?limit=200', { ttl: 0 })
.then((data: { rows: PostRow[] }) => setPosts(data.rows.filter((row) => row.is_published && row.is_listed)))
.catch(() => setPosts([]))
}, [])
const loadDrafts = () =>
get('/admin/newsletters?limit=100', { ttl: 0 })
.then((data: { rows: DraftRow[] }) => setDrafts(data.rows))
.catch(() => setDrafts([]))
useEffect(() => {
loadDrafts()
}, [])
function fill(row: any) {
let picks: Picks = {}
try {
picks = JSON.parse(row?.picks || '{}')
} catch {
// A hand-edited draft: start its picks over.
}
setDraft(row ? { id: row.id, updated_at: row.updated_at } : null)
setTitle(row?.title ?? '')
setIntro(row?.intro ?? '')
setFooter(row?.footer ?? '')
setBlocks(row?.content_blocks ?? [])
setPickedEvents(new Set(picks.events ?? []))
setPickedPosts(new Set(picks.posts ?? []))
setPickedCards(new Set(picks.cards ?? []))
}
async function openDraft(id: string) {
setMessage(null)
if (!id) return fill(null)
try {
const data = await get(`/admin/newsletters/${id}`, { ttl: 0 })
fill(data.row)
} catch (err) {
setMessage({ tone: 'error', text: err instanceof Error ? err.message : 'Couldn’t open that draft.' })
}
}
async function save() {
setBusy(true)
setMessage(null)
const payload = {
title: title.trim(),
intro: intro.trim(),
footer: footer.trim(),
picks: JSON.stringify({ events: [...pickedEvents], posts: [...pickedPosts], cards: [...pickedCards] }),
content_blocks: blocks.map((block) => ({ ...block, slot: 'body' })),
}
try {
const data = draft
? await patch(`/admin/newsletters/${draft.id}`, { ...payload, updated_at: draft.updated_at })
: await post('/admin/newsletters', payload)
fill(data.row)
loadDrafts()
setMessage({ tone: 'ok', text: 'Draft saved.' })
} catch (err) {
const fields = err instanceof ApiError && err.fields ? Object.values(err.fields).filter(Boolean).join(' ') : ''
setMessage({ tone: 'error', text: [err instanceof Error ? err.message : 'Couldn’t save.', fields].filter(Boolean).join(' ') })
} finally {
setBusy(false)
}
}
async function remove() {
if (!draft || !window.confirm('Delete this draft? This can’t be undone.')) return
setBusy(true)
try {
await del(`/admin/newsletters/${draft.id}`)
fill(null)
loadDrafts()
setMessage({ tone: 'ok', text: 'Draft deleted.' })
} catch (err) {
setMessage({ tone: 'error', text: err instanceof Error ? err.message : 'Couldn’t delete.' })
} finally {
setBusy(false)
}
}
/* An unpublished blog post from what's built: the intro, the
blocks, then each section's picks as a heading and link cards.
It opens in the post's editor to finish and publish. */
async function postAsBlog() {
setBusy(true)
setMessage(null)
const postTitle = newsletter.content.title
const id = `${slugify(postTitle).slice(0, 52) || 'newsletter'}-${new Date().toISOString().slice(0, 10)}`
const body = [
...(intro.trim() ? [{ type: 'paragraph', text: intro.trim() }] : []),
...blocks,
...newsletter.content.sections
.filter((section) => section.items.length > 0)
.flatMap((section) => [
{ type: 'heading', text: section.heading },
{
type: 'cards',
items: section.items.map((item) => ({
text: item.title,
detail: [item.meta, item.text].filter(Boolean).join('\n\n') || null,
url: item.href,
media: item.image ?? null,
})),
},
]),
].map((block) => ({ ...block, slot: 'body' }))
try {
await post('/admin/blog_posts', {
id,
title: postTitle,
excerpt: intro.trim() || null,
is_published: false,
content_blocks: body,
})
navigate(`/admin/blog_posts/${id}`)
} catch (err) {
const fields = err instanceof ApiError && err.fields ? Object.values(err.fields).filter(Boolean).join(' ') : ''
setMessage({ tone: 'error', text: [err instanceof Error ? err.message : 'Couldn’t make the post.', fields].filter(Boolean).join(' ') })
setBusy(false)
}
}
// A picked post's public page: its excerpt and cover, and proof it's live.
useEffect(() => {
for (const id of pickedPosts) {
if (postDetails[id]) continue
get(`/blog/${encodeURIComponent(id)}`)
.then((data: { post: BlogPostRecord }) => setPostDetails((current) => ({ ...current, [id]: data.post })))
.catch(() => {})
}
}, [pickedPosts, postDetails])
const toggle = <T,>(set: Set<T>, value: T, update: (next: Set<T>) => void) => {
const next = new Set(set)
if (next.has(value)) next.delete(value)
else next.add(value)
update(next)
}
const newsletter = useMemo(() => {
const eventItems: NewsletterItem[] = events
.filter((event) => pickedEvents.has(event.id))
.map((event) => ({
title: event.title,
meta: [seriesLabel(event.series, event.starts_on) ?? event.date_label, event.is_online && !event.location_label ? 'Online' : event.location_label]
.filter(Boolean)
.join(', '),
text: event.tagline ?? event.description?.[0] ?? null,
image: imageFor(event.card_image),
href: siteUrl(eventHref(event.id)),
cta: 'Event details',
}))
const postItems: NewsletterItem[] = (posts ?? [])
.filter((row) => pickedPosts.has(row.id) && postDetails[row.id])
.map((row) => {
const post = postDetails[row.id]
const byline = post.authors.map((a) => a.name).concat(post.guest ? [post.guest.name] : []).join(', ')
return {
title: post.title,
meta: byline ? `By ${byline}` : null,
text: post.excerpt ?? null,
image: imageFor(post.cover_image),
href: siteUrl(blogHref(post.id)),
cta: 'Read the post',
}
})
const cardItems: NewsletterItem[] = cards
.map((card) => ({ card, href: featuredHref(card) }))
.filter(({ href }) => href && pickedCards.has(href))
.map(({ card, href }) => ({
title: card.title ?? 'Featured',
meta: card.eyebrow ?? null,
text: card.blurb ?? null,
image: card.image ? imageFor(card.image.file) : null,
href: absolute(href) ?? href!,
cta: card.kind === 'video' ? 'Watch' : 'Learn more',
}))
const sections: NewsletterSection[] = [
{ heading: 'Coming up', items: eventItems },
{ heading: 'From the blog', items: postItems },
{ heading: 'Featured', items: cardItems },
]
const content = {
title: title.trim() || `News from ${SITE_NAME}`,
intro: intro.trim() || null,
blocks,
footer: footer.trim() || null,
origin: SITE_ORIGIN,
siteName: SITE_NAME,
absolute: absoluteFor,
// The site's logo is an SVG, which Gmail and Outlook don't show,
// so the header is the site name in type. A PNG logo could go here.
logo: null,
sections,
}
return {
content,
html: newsletterHtml(content),
text: newsletterText(content),
count: eventItems.length + postItems.length + cardItems.length + blocks.length,
}
}, [title, intro, footer, blocks, events, pickedEvents, posts, pickedPosts, postDetails, cards, pickedCards])
async function copy(kind: 'html' | 'text') {
try {
await navigator.clipboard.writeText(kind === 'html' ? newsletter.html : newsletter.text)
setCopied(kind)
window.setTimeout(() => setCopied(null), 2000)
} catch {
setCopied(null)
}
}
function download() {
const blob = new Blob([newsletter.html], { type: 'text/html' })
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = `newsletter-${new Date().toISOString().slice(0, 10)}.html`
link.click()
URL.revokeObjectURL(link.href)
}
return (
<div>
<div className="flex flex-wrap items-baseline gap-3">
<h1 className="text-2xl font-bold text-link">Newsletter</h1>
<p className="text-sm" style={{ color: MUTED }}>
Pick what to include, then copy the email into Mailchimp, Gmail or Church Center.
</p>
</div>
<div className="mt-6 flex flex-wrap items-end gap-3 border-l-4 border-brand bg-raised p-4 shadow-sm">
<label className="block min-w-60 flex-1 text-sm font-semibold text-body">
Draft
<select value={draft?.id ?? ''} onChange={(e) => openDraft(e.target.value)} className={`mt-1 ${input}`}>
<option value="">New draft</option>
{drafts.map((row) => (
<option key={row.id} value={row.id}>
{row.title || `News from ${SITE_NAME}`} (saved {row.updated_at.slice(0, 16)})
</option>
))}
</select>
</label>
{canWrite(user) && (
<>
<button type="button" onClick={save} className={button} disabled={busy}>
<FloppyDisk weight="bold" aria-hidden="true" />
{draft ? 'Save draft' : 'Save as a new draft'}
</button>
<button type="button" onClick={postAsBlog} className={button} disabled={busy || newsletter.count === 0}>
<Article weight="bold" aria-hidden="true" />
Post as blog post
</button>
</>
)}
{draft && canDelete(user) && (
<button type="button" onClick={remove} className={`${button} !border-danger !text-danger`} disabled={busy}>
<Trash weight="bold" aria-hidden="true" />
Delete draft
</button>
)}
{message && (
<p role="status" className={`w-full text-sm ${message.tone === 'error' ? 'text-danger' : 'text-body'}`}>
{message.text}
</p>
)}
</div>
<div className="mt-6 grid gap-8 lg:grid-cols-[minmax(0,26rem)_minmax(0,1fr)]">
<div className="space-y-6">
<section className="space-y-3 border-l-4 border-brand bg-raised p-5 shadow-sm">
<label className="block text-sm font-semibold text-body">
Title
<input value={title} onChange={(e) => setTitle(e.target.value)} placeholder={`News from ${SITE_NAME}`} className={`mt-1 ${input}`} />
</label>
<label className="block text-sm font-semibold text-body">
Intro
<textarea
value={intro}
onChange={(e) => setIntro(e.target.value)}
rows={4}
placeholder="eg. A few things coming up this month…"
className={`mt-1 resize-y ${input}`}
/>
</label>
</section>
<section className="border-l-4 border-brand bg-raised p-5 shadow-sm">
<Repeater spec={BLOCKS_SPEC} rows={blocks} options={{}} errors={{}} errorPrefix="content_blocks." className="" onChange={setBlocks} />
</section>
<PickList
title="Upcoming events"
empty={eventsLoading ? 'Loading…' : 'No upcoming events.'}
options={events.map((event) => ({ value: event.id, label: event.title, detail: event.date_label }))}
picked={pickedEvents}
onToggle={(value) => toggle(pickedEvents, value, setPickedEvents)}
/>
<PickList
title="Blog posts"
empty={posts ? 'No published posts.' : 'Loading…'}
options={(posts ?? []).map((post) => ({ value: post.id, label: post.title, detail: post.published_on }))}
picked={pickedPosts}
onToggle={(value) => toggle(pickedPosts, value, setPickedPosts)}
/>
<PickList
title="Featured cards (front page)"
empty="No featured cards."
options={cards.flatMap((card) => {
const href = featuredHref(card)
return href ? [{ value: href, label: card.title ?? href, detail: card.kind }] : []
})}
picked={pickedCards}
onToggle={(value) => toggle(pickedCards, value, setPickedCards)}
/>
<section className="border-l-4 border-brand bg-raised p-5 shadow-sm">
<label className="block text-sm font-semibold text-body">
Footer
<textarea
value={footer}
onChange={(e) => setFooter(e.target.value)}
rows={3}
placeholder={`${SITE_NAME}\n${SITE_ORIGIN}`}
className={`mt-1 resize-y ${input}`}
/>
</label>
<p className="mt-1 text-xs" style={{ color: MUTED }}>
Default: the site's name and address. No unsubscribe link needed: Mailchimp adds its own.
</p>
</section>
</div>
<div>
<div className="flex flex-wrap gap-3">
<button type="button" onClick={() => copy('html')} className={button} disabled={newsletter.count === 0}>
{copied === 'html' ? <Check weight="bold" aria-hidden="true" /> : <Copy weight="bold" aria-hidden="true" />}
{copied === 'html' ? 'Copied' : 'Copy HTML'}
</button>
<button type="button" onClick={() => copy('text')} className={button} disabled={newsletter.count === 0}>
{copied === 'text' ? <Check weight="bold" aria-hidden="true" /> : <Copy weight="bold" aria-hidden="true" />}
{copied === 'text' ? 'Copied' : 'Copy plain text'}
</button>
<button type="button" onClick={download} className={button} disabled={newsletter.count === 0}>
<DownloadSimple weight="bold" aria-hidden="true" />
Download .html
</button>
</div>
<p className="mt-2 text-xs" style={{ color: MUTED }}>
{newsletter.count === 0
? 'Tick an item or add a block to build the email.'
: `${newsletter.count} part${newsletter.count === 1 ? '' : 's'}. In Mailchimp, paste the HTML into a Code block or "Paste in code".`}
</p>
<iframe
title="Newsletter preview"
srcDoc={newsletter.html}
sandbox=""
className="mt-4 h-[70vh] w-full border border-brand/20 bg-white"
/>
</div>
</div>
</div>
)
}
function PickList<T extends string | number>({
title,
empty,
options,
picked,
onToggle,
}: {
title: string
empty: string
options: Array<{ value: T; label: string; detail?: string | null }>
picked: Set<T>
onToggle: (value: T) => void
}) {
return (
<section className="border-l-4 border-brand bg-raised p-5 shadow-sm">
<h2 className="text-base font-bold text-ink">{title}</h2>
{options.length === 0 ? (
<p className="mt-2 text-sm" style={{ color: MUTED }}>
{empty}
</p>
) : (
<ul className="mt-2 max-h-72 space-y-1 overflow-y-auto">
{options.map((option) => (
<li key={String(option.value)}>
<label className="flex cursor-pointer items-start gap-3 px-2 py-1.5 hover:bg-tint-soft">
<input
type="checkbox"
checked={picked.has(option.value)}
onChange={() => onToggle(option.value)}
className="mt-1 h-4 w-4 accent-[var(--color-action)]"
/>
<span className="min-w-0">
<span className="block text-sm text-ink">{option.label}</span>
{option.detail && (
<span className="block text-xs" style={{ color: MUTED }}>
{option.detail}
</span>
)}
</span>
</label>
</li>
))}
</ul>
)}
</section>
)
}

View file

@ -80,6 +80,13 @@ export const DATA_NAV = {
label: "Blog posts",
blurb: "Posts of our own, each at /blog/…, written here or imported from Word.",
},
// A timeline entry can point at an event, an organization, an
// award, a person or a team, so it's its own kind of record.
{
to: "/admin/timeline",
label: "Timeline",
blurb: "The History page's entries: milestones and the records they point at.",
},
],
};
@ -93,17 +100,32 @@ export const PAGES_NAV = {
label: "Front page",
blurb: "The hero, its photos or livestream, and which bands the home page draws.",
},
// A timeline entry can point at an event, an organization, an
// award, a person or a team, so it isn't filed under any of them.
// The site's own pages, in the header's order: each is its
// sections, built in the editor (sitePages.ts).
{
to: "/admin/timeline",
label: "Timeline",
blurb: "What the history page shows, and the order it shows it in.",
to: "/admin/retreats_page",
label: "Retreats",
blurb: "Its sections: the event carousels and grids, and anything else written for it.",
},
{
to: "/admin/community_page",
label: "Community blog section",
blurb: "The Community page's blog: headings, pinned posts and feeds.",
label: "Community",
blurb: "Its sections: the blog (and its pinned posts and feeds), groups map, regions and partners.",
},
{
to: "/admin/resources_page",
label: "Resources",
blurb: "Its sections and their content.",
},
{
to: "/admin/organization_page",
label: "Organization",
blurb: "Mission, vision and values, the leadership teams and volunteering, details and contact.",
},
{
to: "/admin/history_page",
label: "History",
blurb: "Its sections: the timeline (its entries are under Data), and anything else.",
},
],
};
@ -148,6 +170,11 @@ export const TOOLS_NAV = {
blurb: "Cut clips from our YouTube and Facebook videos: trimmed, reshaped for Reels, or audio only.",
minRole: "admin",
},
{
to: "/admin/newsletter",
label: "Newsletter",
blurb: "An email newsletter from upcoming events, blog posts, featured cards and blocks of its own, ready to paste into Mailchimp or Gmail. Saved as drafts, and can become a blog post.",
},
{
to: "/qr",
label: "QR code generator",

View file

@ -1,8 +1,8 @@
/* ═══════════════════════════════════════════════════════════════
COMMUNITY BLOG
The Community page's blog section (Admin → Pages → Community blog
section). Two halves, each pinned first and then newest, as
The Community page's blog section (Admin → Pages → Community
page, its Community blog preset and the blog settings). Two halves, each pinned first and then newest, as
routes/blog.js decides:
our posts cards for our own /blog/:id pages
@ -10,8 +10,7 @@
newest from the listed feeds), drawn by
FeaturedCards, with a button to the Substack
The section's heading and blurb come from the same record; the
page reads them through the same cached request (Community.tsx).
The section's heading and blurb are its section's, like any other.
A half with nothing in it isn't drawn.
═══════════════════════════════════════════════════════════════ */

View file

@ -190,25 +190,25 @@ export function Card({
// past event) keeps its links out of the tab order too.
inert={!interactive}
>
<div className={`flex-1 flex flex-col ${compact ? "p-8" : "p-10"}`}>
<div className={`flex-1 flex flex-col ${compact ? "p-6 sm:p-8" : "p-6 sm:p-10"}`}>
{compact ? (
/* ── GRID CARD: layout driven by .ev-grid container queries ── */
<div className="ev-grid mb-2">
<Logo src={orgLogo} className="ev-org h-11 w-auto mb-4" />
<div className="ev-info">
{typeBadge}
<h3 className="text-3xl font-bold leading-tight">
<h3 className="text-2xl sm:text-3xl font-bold leading-tight [overflow-wrap:anywhere]">
<TitleLink ev={ev} linked={linked}>
{ev.title}
</TitleLink>
</h3>
{ev.theme && (
<p className="text-xl font-normal font-bold">"{ev.theme}"</p>
<p className="text-lg sm:text-xl font-bold">"{ev.theme}"</p>
)}
{ev.date_label && <p className="text-xl">{ev.date_label}</p>}
{schedule && <p className="text-xl">{schedule}</p>}
{ev.date_label && <p className="text-lg sm:text-xl">{ev.date_label}</p>}
{schedule && <p className="text-lg sm:text-xl">{schedule}</p>}
{ev.location_label && (
<p className="text-xl">{ev.location_label}</p>
<p className="text-lg sm:text-xl">{ev.location_label}</p>
)}
</div>
<Logo
@ -225,18 +225,18 @@ export function Card({
<div className="md:col-span-2">
<Logo src={orgLogo} className="h-15 w-auto mb-6" />
{typeBadge}
<h3 className="text-4xl font-bold">
<h3 className="text-2xl sm:text-4xl font-bold [overflow-wrap:anywhere]">
<TitleLink ev={ev} linked={linked}>
{ev.title}
</TitleLink>
</h3>
{ev.theme && (
<p className="text-2xl font-normal font-bold">"{ev.theme}"</p>
<p className="text-lg sm:text-2xl font-bold">"{ev.theme}"</p>
)}
{ev.date_label && <p className="text-2xl">{ev.date_label}</p>}
{schedule && <p className="text-2xl">{schedule}</p>}
{ev.date_label && <p className="text-lg sm:text-2xl">{ev.date_label}</p>}
{schedule && <p className="text-lg sm:text-2xl">{schedule}</p>}
{ev.location_label && (
<p className="text-2xl">{ev.location_label}</p>
<p className="text-lg sm:text-2xl">{ev.location_label}</p>
)}
</div>
<div className="md:col-span-1 flex items-center justify-end">
@ -496,6 +496,18 @@ export default function EventListCards({
const prev = () => setIndex(i => Math.max(0, i - 1));
const next = () => setIndex(i => Math.min(events.length - 1, i + 1));
// A sideways swipe of 40px or more on a touch screen turns the carousel.
const swipeFrom = useRef<number | null>(null);
const onTouchStart = (e: React.TouchEvent) => { swipeFrom.current = e.touches[0]?.clientX ?? null; };
const onTouchEnd = (e: React.TouchEvent) => {
const from = swipeFrom.current;
swipeFrom.current = null;
const to = e.changedTouches[0]?.clientX;
if (from == null || to == null || Math.abs(to - from) < 40) return;
if (to < from) next();
else prev();
};
// Arrows and dots follow the section accent, not the active card.
const arrowStyle = enabled => ({
border: `1px solid ${accent}`,
@ -616,7 +628,7 @@ export default function EventListCards({
<button
onClick={() => setShowPast(v => !v)}
aria-expanded={showPast}
className="flex items-center gap-2 py-2.5 px-6 font-bold transition-all duration-200 hover:scale-105"
className="btn flex items-center gap-2 py-2.5 px-6 transition-all duration-200 hover:scale-105"
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
>
{showPast
@ -631,7 +643,7 @@ export default function EventListCards({
) : (
/* ── CAROUSEL VIEW ── */
<>
<div className="relative mb-6">
<div className="relative mb-6" onTouchStart={onTouchStart} onTouchEnd={onTouchEnd}>
<div
className="overflow-hidden"
style={{ maskImage: EDGE_FADE, WebkitMaskImage: EDGE_FADE }}
@ -673,7 +685,7 @@ export default function EventListCards({
onClick={prev}
disabled={index === 0}
aria-label="Previous event"
className="absolute left-2 md:left-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
className="absolute left-2 md:left-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn hidden sm:flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
style={arrowStyle(index > 0)}
>
<CaretLeft size={20} weight="bold" aria-hidden="true" />
@ -682,7 +694,7 @@ export default function EventListCards({
onClick={next}
disabled={index === events.length - 1}
aria-label="Next event"
className="absolute right-2 md:right-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
className="absolute right-2 md:right-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn hidden sm:flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
style={arrowStyle(index < events.length - 1)}
>
<CaretRight size={20} weight="bold" aria-hidden="true" />
@ -692,20 +704,45 @@ export default function EventListCards({
</div>
{events.length > 1 && (
<div className="flex justify-center gap-2">
<div className="flex flex-wrap items-center justify-center">
{/* On a phone the side arrows would sit on the card's text,
so they move down here, beside the dots. */}
<button
onClick={prev}
disabled={index === 0}
aria-label="Previous event"
className="btn flex h-10 w-10 items-center justify-center sm:hidden"
style={arrowStyle(index > 0)}
>
<CaretLeft size={18} weight="bold" aria-hidden="true" />
</button>
{events.map((e, i) => (
<button
key={e.id}
onClick={() => setIndex(i)}
aria-label={`Go to ${e.title}`}
aria-current={i === index ? "true" : undefined}
className="h-2.5 rounded-full transition-all duration-200"
style={{
width: i === index ? "1.5rem" : "0.625rem",
background: i === index ? accent : withAlpha("var(--color-muted)", 40),
}}
/>
// A 40px tap target around the small dot it draws.
className="flex h-10 items-center px-1"
>
<span
className="block h-2.5 rounded-full transition-all duration-200"
style={{
width: i === index ? "1.5rem" : "0.625rem",
background: i === index ? accent : withAlpha("var(--color-muted)", 40),
}}
/>
</button>
))}
<button
onClick={next}
disabled={index === events.length - 1}
aria-label="Next event"
className="btn flex h-10 w-10 items-center justify-center sm:hidden"
style={arrowStyle(index < events.length - 1)}
>
<CaretRight size={18} weight="bold" aria-hidden="true" />
</button>
</div>
)}
</>

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

@ -44,14 +44,14 @@ function OrgCard({ org, accent, pageLabel, siteLabel }) {
return (
<div
className="p-6 h-full flex flex-col transition-transform duration-200 hover:scale-[1.01]"
className="p-4 sm:p-6 h-full flex flex-col transition-transform duration-200 hover:scale-[1.01]"
style={{ border: `1px solid ${color}`, background: "var(--color-surface)" }}
>
<div className="flex items-start gap-4">
<OrgLogo org={org} color={color} />
<div className="flex items-start gap-3 sm:gap-4">
<OrgLogo org={org} color={color} size="h-10 w-10 sm:h-14 sm:w-14" />
<div className="min-w-0 flex-1">
<h3 className="text-xl font-bold leading-tight" style={{ color }}>
<h3 className="text-lg sm:text-xl font-bold leading-tight [overflow-wrap:anywhere]" style={{ color }}>
{org.name}
</h3>
{subtitle && (

View file

@ -470,16 +470,16 @@ function RegionBlock({
function GroupCard({ group, color, open, onOpen }) {
return (
<div
className="p-4 flex items-start gap-4 transition-all duration-200"
className="p-4 flex flex-wrap items-start gap-3 sm:gap-4 transition-all duration-200"
style={{
border: `1px solid ${color}`,
background: open ? `color-mix(in srgb, ${color} 8%, var(--color-raised))` : "var(--color-raised)",
}}
>
<OrgLogo org={group} color={color} />
<OrgLogo org={group} color={color} size="h-10 w-10 sm:h-14 sm:w-14" />
<div className="min-w-0 flex-1">
<p className="font-bold leading-tight">{group.name}</p>
<div className="min-w-[8rem] flex-1">
<p className="font-bold leading-tight [overflow-wrap:anywhere]">{group.name}</p>
<p className="text-sm" style={{ color: FALLBACK_COLOR }}>
{group.location_label}
</p>
@ -494,12 +494,12 @@ function GroupCard({ group, color, open, onOpen }) {
detail panel in place, the arrow leaves for the group's
own page. Keeping them distinct beats one control that
does different things depending on where you click. */}
<div className="shrink-0 flex items-center gap-2">
<div className="ml-auto shrink-0 flex items-center gap-2">
<button
onClick={onOpen}
aria-expanded={open}
aria-label={`${open ? "Hide" : "View"} details for ${group.name}`}
className="h-9 w-9 btn flex items-center justify-center transition-transform duration-200 hover:scale-110"
className="h-10 w-10 btn flex items-center justify-center transition-transform duration-200 hover:scale-110"
style={{
border: `1px solid ${color}`,
color,
@ -540,21 +540,21 @@ function GroupDetail({ group, region, onClose }) {
return (
<div
className="p-6 mb-6"
className="p-4 sm:p-6 mb-6"
style={{ border: `2px solid ${colorOf(region)}`, background: `color-mix(in srgb, ${colorOf(region)} 6%, var(--color-raised))` }}
>
<div className="flex items-start gap-4">
<OrgLogo org={group} color={colorOf(region)} size="h-20 w-20" />
<OrgLogo org={group} color={colorOf(region)} size="h-12 w-12 sm:h-20 sm:w-20" />
<div className="min-w-0 flex-1">
<p className="text-2xl font-display font-bold leading-tight">{group.name}</p>
<p className="text-xl sm:text-2xl font-display font-bold leading-tight [overflow-wrap:anywhere]">{group.name}</p>
<p style={{ color: FALLBACK_COLOR }}>{group.location_label}</p>
</div>
<button
onClick={onClose}
aria-label="Close details"
className="shrink-0 h-8 w-8 btn flex items-center justify-center text-lg transition-transform duration-200 hover:scale-110"
className="shrink-0 h-10 w-10 btn flex items-center justify-center text-lg transition-transform duration-200 hover:scale-110"
style={{ border: `1px solid ${colorOf(region)}`, color: colorOf(region) }}
>
<X size={20} weight="bold" aria-hidden="true" />
@ -844,13 +844,19 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
shell(
<div className="grid grid-cols-1 lg:grid-cols-[1.45fr_1fr] gap-10 items-stretch">
{/* Map */}
<div>
<RegionMap
slices={slices}
groupCounts={groupCounts}
onPick={pickArea}
{...shared}
/>
<div className="min-w-0">
{/* On a phone the map keeps a readable size (tiles big enough
to read and tap) and scrolls sideways in its own box. */}
<div className="-mx-6 overflow-x-auto px-6 sm:mx-0 sm:px-0">
<div className="min-w-[34rem] sm:min-w-0">
<RegionMap
slices={slices}
groupCounts={groupCounts}
onPick={pickArea}
{...shared}
/>
</div>
</div>
<Legend
domestic={domestic}
international={international}

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

@ -235,8 +235,10 @@ export default function RequestForm() {
<div className="mt-4 grid gap-4 sm:grid-cols-2">
{type.fields.map((f) => {
const id = `request-detail-${f.key}`;
const helpId = f.help ? `${id}-help` : undefined;
const common = {
id,
"aria-describedby": helpId,
value: details[f.key] ?? "",
placeholder: f.placeholder,
maxLength: 2000,
@ -248,6 +250,11 @@ export default function RequestForm() {
<label htmlFor={id} className="block text-sm font-medium text-body">
{f.label}
</label>
{f.help && (
<p id={helpId} className="mt-0.5 text-xs" style={{ color: MUTED }}>
{f.help}
</p>
)}
{f.input === "textarea" ? (
<textarea {...common} rows={3} onChange={(e) => set(e.target.value)} className={`mt-2 resize-y ${fieldClass}`} />
) : (
@ -298,8 +305,10 @@ export default function RequestForm() {
<OptionalTag />
</div>
<p className="mt-1 max-w-prose text-sm" style={{ color: MUTED }}>
A Word document (.docx) with the details or the post itself, photos (JPEG or PNG) or a PDF. Up to{" "}
{MAX_FILES}, {MAX_FILE_MB} MB each.
Why a file: a blog post sent as a Word document (.docx) can be imported straight onto the site, its
headings, lists, tables and links as written, so nothing needs retyping. For anything else, a document
with the details, photos (JPEG or PNG) or a PDF saves us asking. Up to {MAX_FILES} files,{" "}
{MAX_FILE_MB} MB each.
</p>
<input
id="request-files"

View file

@ -544,6 +544,13 @@ a.site-tl__entry--featured:hover {
opacity: 1;
}
/* A touch screen has no hover to bring it up, so it reads in full. */
@media (hover: none) {
.site-tl__upcomingList {
opacity: 1;
}
}
@keyframes site-tl-rise {
from {
opacity: 0;

View file

@ -141,7 +141,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
}}
>
{featured.map((item, index) => (
<li key={item.id} className="w-[19rem] shrink-0 md:w-[22rem]">
<li key={item.id} className="w-[min(19rem,80vw)] shrink-0 md:w-[22rem]">
<RailCard
item={item}
showYear={index === 0 || year(item) !== year(featured[index - 1])}
@ -149,7 +149,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
</li>
))}
<li className="w-[19rem] shrink-0 md:w-[22rem]">
<li className="w-[min(19rem,80vw)] shrink-0 md:w-[22rem]">
<div className="flex h-full flex-col">
<div className="h-12" />
<Link

View file

@ -74,7 +74,9 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
return (
<section
id="hero"
className="relative isolate flex min-h-[92dvh] items-center overflow-hidden pt-24 pb-16"
className={`relative isolate flex min-h-[92dvh] items-center overflow-hidden pt-24 ${
backdrop === 'photos' ? 'pb-36 sm:pb-28' : 'pb-16'
}`}
style={{ background: DEEP }}
>
{backdrop === 'photos' ? (
@ -157,8 +159,8 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
about two lines. */}
<h1
className={`hp-rise font-display font-bold leading-[1.02] tracking-tight ${
beside ? 'text-4xl md:text-5xl' : 'text-5xl md:text-6xl lg:text-7xl'
}`}
beside ? 'text-4xl md:text-5xl' : 'text-4xl sm:text-5xl md:text-6xl lg:text-7xl'
} [overflow-wrap:anywhere]`}
style={{ animationDelay: '60ms' }}
>
{hero.headline}
@ -186,12 +188,13 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
Both set: one cell in two halves, the primary filled on the left
and the secondary clear on the right, split by a slash (the
filled half's slanted edge, which the clear half tucks under).
One set: that one alone, in its own style. */
On a phone the halves stack instead, filled on top, since two
labels side by side don't fit; the slash starts at sm (home.css,
.hp-split). One set: that one alone, in its own style. */
const SLANT = '1.75rem'
const PRIMARY_FILL = '#f0bd4f'
const PRIMARY_TEXT = '#001011'
const HALF = 'relative flex items-center gap-2 px-8 py-4 text-lg transition-colors duration-200 focus-visible:outline-offset-[-6px]'
const HALF = 'relative flex items-center justify-center gap-2 px-8 py-4 text-lg transition-colors duration-200 focus-visible:outline-offset-[-6px]'
type HeroLink = Hero['primary']
@ -200,24 +203,15 @@ function HeroActions({ primary, secondary }: { primary: HeroLink; secondary: Her
if (primary && secondary) {
return (
<div className="btn inline-flex max-w-full overflow-hidden border border-white/35">
<div className="hp-split btn max-w-full overflow-hidden border border-white/35">
<HomeLink
url={primary.url}
className={`${HALF} z-10 hover:brightness-95`}
style={{
background: PRIMARY_FILL,
color: PRIMARY_TEXT,
paddingRight: `calc(2rem + ${SLANT})`,
clipPath: `polygon(0 0, 100% 0, calc(100% - ${SLANT}) 100%, 0 100%)`,
}}
className={`hp-split__primary ${HALF} z-10 hover:brightness-95`}
style={{ background: PRIMARY_FILL, color: PRIMARY_TEXT }}
>
{primary.label}
</HomeLink>
<HomeLink
url={secondary.url}
className={`${HALF} text-white hover:bg-white/10`}
style={{ marginLeft: `-${SLANT}`, paddingLeft: `calc(2rem + ${SLANT})` }}
>
<HomeLink url={secondary.url} className={`hp-split__secondary ${HALF} text-white hover:bg-white/10`}>
{secondary.label} {arrow}
</HomeLink>
</div>
@ -323,8 +317,8 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
)}
{slides.length > 1 && (
<div className="ml-auto flex items-center gap-3">
<div className="flex gap-1.5">
<div className="ml-auto flex flex-wrap items-center justify-end gap-x-1 gap-y-0">
<div className="flex flex-wrap justify-end">
{slides.map((slide, i) => (
<button
key={`${slide.media}-${i}`}
@ -332,15 +326,18 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
onClick={() => setIndex(i)}
aria-label={`Show photo ${i + 1} of ${slides.length}`}
aria-current={i === index}
className="h-1.5 w-10 overflow-hidden bg-white/25"
// A 40px tap target around the thin bar it draws.
className="flex h-10 w-11 items-center px-0.5"
>
<span
// Re-keyed per index so the fill restarts on every change.
key={`${index}-${i}`}
className={`hp-progress block h-full bg-white ${
i < index ? 'hp-progress--done' : i === index ? 'hp-progress--run' : ''
} ${paused ? 'hp-progress--paused' : ''}`}
/>
<span className="block h-1.5 w-full overflow-hidden bg-white/25">
<span
// Re-keyed per index so the fill restarts on every change.
key={`${index}-${i}`}
className={`hp-progress block h-full bg-white ${
i < index ? 'hp-progress--done' : i === index ? 'hp-progress--run' : ''
} ${paused ? 'hp-progress--paused' : ''}`}
/>
</span>
</button>
))}
</div>
@ -348,7 +345,7 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
type="button"
onClick={() => setPaused((p) => !p)}
aria-label={paused ? 'Play slideshow' : 'Pause slideshow'}
className="flex h-8 w-8 items-center justify-center btn border border-white/40 text-xs text-white hover:bg-white/10"
className="ml-2 flex h-10 w-10 items-center justify-center btn border border-white/40 text-xs text-white hover:bg-white/10"
>
{paused ? <Play size={14} weight="fill" aria-hidden="true" /> : <Pause size={14} weight="fill" aria-hidden="true" />}
</button>

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).

View file

@ -55,14 +55,14 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
</h2>
{blurb && <p className="mt-3 max-w-2xl text-white/70">{blurb}</p>}
<dl className="mt-12 grid grid-cols-2 gap-x-8 gap-y-14 md:grid-cols-4">
<dl className="mt-12 grid grid-cols-2 gap-x-4 gap-y-14 sm:gap-x-8 md:grid-cols-4">
{stats.map((stat, index) => (
<div
key={`${stat.label}-${index}`}
className={`hp-stat border-l border-white/15 pl-6 ${seen ? 'hp-stat--in' : ''}`}
className={`hp-stat border-l border-white/15 pl-4 sm:pl-6 ${seen ? 'hp-stat--in' : ''}`}
style={{ transitionDelay: `${index * 120}ms` }}
>
<dd className="font-display text-5xl font-extrabold leading-none text-white md:text-6xl">
<dd className="font-display text-4xl font-extrabold leading-none text-white sm:text-5xl md:text-6xl">
<CountUp value={stat.value} run={seen} />
{stat.suffix && <span className="text-[#f0bd4f]">{stat.suffix}</span>}
</dd>

View file

@ -19,6 +19,32 @@
to { opacity: 1; transform: none; }
}
/* ── Hero: the split button cell (HeroStage.tsx, HeroActions) ────
Stacked on a phone; from sm, side by side and cut by a slash:
the filled half's slanted right edge, the clear half tucked under
it by the slant's width. */
.hp-split {
display: flex;
flex-direction: column;
}
@media (min-width: 40rem) {
.hp-split {
display: inline-flex;
flex-direction: row;
--hp-slant: 1.75rem;
}
.hp-split__primary {
padding-right: calc(2rem + var(--hp-slant));
clip-path: polygon(0 0, 100% 0, calc(100% - var(--hp-slant)) 100%, 0 100%);
}
.hp-split__secondary {
margin-left: calc(var(--hp-slant) * -1);
padding-left: calc(2rem + var(--hp-slant));
}
}
/* ── Hero: photos ────────────────────────────────────────────── */
.hp-slide {