Compare commits

...

8 commits

Author SHA1 Message Date
Aidan Dona
54fc319d33 TODO: page management is part of v1.14.0-profiles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 17:49:31 -05:00
Aidan Dona
e8aab4d7ec Planning Center: compare a People list with the site's people and apply what an admin picks
Migration 085 adds people.pco_id and Site settings' list. Data ->
Planning Center fetches the list, suggests matches (linked, same email,
same name), shows each field that would change (Planning Center wins),
and applies the chosen links, updates and new unpublished people in one
transaction. Needs PCO_APP_ID and PCO_SECRET.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:46:29 -05:00
Aidan Dona
a10ff6d75f Rotating words: {Next|Now} in titles and text cycles through its choices
Migration 084: site defaults for the motion (slide, flip, fade, type,
mirror), direction and seconds per word in Site settings, and a hero's
and a block's own. The hero's headline, section and band titles,
headings, paragraphs, callouts and quotes rotate; menus, tab titles,
search text and emails show the first word; less motion shows it still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:43:59 -05:00
Aidan Dona
ab8dcdd608 Page management: no Delete button on the core pages the server won't delete
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:37:35 -05:00
Aidan Dona
f1a0b06ac2 Page management, step 3: section types with their own settings; the front page as sections
Migration 083 gives the section types that need more than blocks their
own tables (hero, slides, countdown, stats, paths, featured cards, the
Community blog's slots, pinned posts and feeds) and turns the front page
into Home's sections: the hero, then its bands in order. Any section can
be hidden. The Front page editor, its tables and the Community page's
are gone; /api/front-page and /api/community-blog fold into the page's
sections (sectionData.js). The admin engine reads and writes a child
collection's own side tables and gated nested collections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:34:56 -05:00
Aidan Dona
f33c0008fe Page management, step 2: the core pages as sections
Migrations 081 and 082: Feedback, Request, QR codes, Give, Privacy and
Terms become pages of sections. Their forms and embeds are section types
any page can use; Give's words and all of Privacy and Terms become blocks.
The privacy contact email is written into the policy and its setting goes.
Core pages keep their address and can't be deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 23:24:34 -05:00
Aidan Dona
1342691f49 Page management, step 1: every page in a registry, new pages, hidden and disabled
Migration 080 makes site_pages the list of every page: address, title,
intro, Hidden, Disabled (out of menus, sitemap and search) and card order.
site.json's pages and Navigation's page list move into it. Pages ->
Page management (one editor in place of six) makes new pages of sections
at any free address; the admin home opens Pages with a banner and a card
per page. A catch-all route draws whatever page is at an address; the
fixed pages take their words from the registry and can't be deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 23:19:54 -05:00
Aidan Dona
56acedf926 Featured event card beside the hero text; Word import: tabs, quotes, callouts, dividers, videos, buttons
From lg up the featured event's photo sits beside its words, so the card
is about as tall as the hero text. Word import turns a 'Tab:' line into a
tab, the Quote and Intense Quote styles into quotes and callouts, '---'
into a divider, a lone video link into a video and 'Button: label' into
a button; Blog posts shows the whole mapping beside Import from Word.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:43:25 -05:00
94 changed files with 3421 additions and 2300 deletions

View file

@ -41,6 +41,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
- Security headers: the API sends them (Hono `secureHeaders()`, plus a CSRF check on `/api` writes); nginx sends HSTS on everything and must pass `Host` and `X-Forwarded-For` to the API: `docs/security-headers.md`. - Security headers: the API sends them (Hono `secureHeaders()`, plus a CSRF check on `/api` writes); nginx sends HSTS on everything and must pass `Host` and `X-Forwarded-For` to the API: `docs/security-headers.md`.
- Request form (`/request`): files go to the "Requests" folder of a Google shared drive and new-request emails go out through Gmail, both via a service account (`server/src/googleService.js`). `driveUpload(folder, ...)` finds or makes the named folder in the shared drive, so other uses get their own folder. Tools → Media → Files uploads to "Media" and shares each file as anyone-with-the-link (`server/src/routes/files.js`, migration 048); link fields with `files: true` pick from it ("Choose a file"), and link cards take its first-page preview. Needs a `/api/admin/files` nginx block (51m). Off until `GOOGLE_SERVICE_ACCOUNT` plus `GOOGLE_SHARED_DRIVE` (the bare id, not a URL) / `GOOGLE_MAIL_FROM` are set. Needs its own nginx block. Setup: `docs/google-drive-and-mail.md`. - Request form (`/request`): files go to the "Requests" folder of a Google shared drive and new-request emails go out through Gmail, both via a service account (`server/src/googleService.js`). `driveUpload(folder, ...)` finds or makes the named folder in the shared drive, so other uses get their own folder. Tools → Media → Files uploads to "Media" and shares each file as anyone-with-the-link (`server/src/routes/files.js`, migration 048); link fields with `files: true` pick from it ("Choose a file"), and link cards take its first-page preview. Needs a `/api/admin/files` nginx block (51m). Off until `GOOGLE_SERVICE_ACCOUNT` plus `GOOGLE_SHARED_DRIVE` (the bare id, not a URL) / `GOOGLE_MAIL_FROM` are set. Needs its own nginx block. Setup: `docs/google-drive-and-mail.md`.
- Profile accounts (migration 076): admins invite an email (Data → Profile accounts), the person sets a password from the link or signs in with any Google account under that email, claims their People record (an admin approves), then edits it and hides parts at `/account`. Public reads of people go through the `v_people_public` view, never `people`. Discord linking is off until `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` are set: `docs/profile-accounts.md`. - Profile accounts (migration 076): admins invite an email (Data → Profile accounts), the person sets a password from the link or signs in with any Google account under that email, claims their People record (an admin approves), then edits it and hides parts at `/account`. Public reads of people go through the `v_people_public` view, never `people`. Discord linking is off until `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` are set: `docs/profile-accounts.md`.
- Planning Center (migration 085): Data → Planning Center compares a Planning Center People list (Site settings → Planning Center) with the site's people and applies what an admin picks: link (`people.pco_id`), update the name and private email and phone, or add unpublished. Off until `PCO_APP_ID` and `PCO_SECRET` are set: `docs/planning-center.md`.
- Google sign-in for @nextgenerationofunity.org admin accounts: on when `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` are set on the service. Accounts made by admin-cli get in; with access groups set (Site settings → Access, plus `GOOGLE_DIRECTORY_AS`), anyone in one gets a Google-only account whose role follows the group, rechecked at sign-in, hourly and by Panel → Re-sync now (`server/src/accessGroups.js`); superadmins and admin-cli accounts are never changed by groups. Passwords still work. Setup: `docs/google-sign-in.md`. - Google sign-in for @nextgenerationofunity.org admin accounts: on when `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` are set on the service. Accounts made by admin-cli get in; with access groups set (Site settings → Access, plus `GOOGLE_DIRECTORY_AS`), anyone in one gets a Google-only account whose role follows the group, rechecked at sign-in, hourly and by Panel → Re-sync now (`server/src/accessGroups.js`); superadmins and admin-cli accounts are never changed by groups. Passwords still work. Setup: `docs/google-sign-in.md`.
## Git workflow ## Git workflow
@ -62,7 +63,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
- All pages use `PageShell.tsx` as the wrapper unless explicitly noted otherwise. - All pages use `PageShell.tsx` as the wrapper unless explicitly noted otherwise.
- Pages live in `src/pages/`; section-level components go in `src/pages/sections/`. - Pages live in `src/pages/`; section-level components go in `src/pages/sections/`.
- `src/data/` holds only hardcoded data shared across multiple section files (e.g. `historyDecades.ts`, map grid). Everything else comes from SQLite, through hooks in `src/lib/`. - `src/data/` holds only hardcoded data shared across multiple section files (e.g. `historyDecades.ts`, map grid). Everything else comes from SQLite, through hooks in `src/lib/`.
- Navigation (header and footer links, page titles and intros, hidden pages) is edited in Pages → Navigation (`site_nav*` tables, `server/src/siteNav.js`, read through `src/lib/useSiteNav.ts`). `navConfig.ts` only holds the defaults the app starts from before that loads. Routes are in `App.tsx`; a static page's default title and intro in `site.json`'s `pages`. A hidden page answers Not found below viewer (server and app both). - Pages are rows of `site_pages` (migration 080), edited in Pages → Page management: address, title, intro, Hidden (Not found below viewer) and Disabled (out of the menus, sitemap and search). Every page is a page of sections, the front page included (its hero and bands are section types: `src/pages/sections/Bands.tsx`, their settings in `section_*` tables read by `server/src/sectionData.js`; forms and embeds are section types too, `src/pages/sections/FormSections.tsx`), and new ones are made there; `PageAtPath.tsx` (the `*` route) draws whatever page is at an address. The pages the code links to (`CORE_PAGES` in `server/src/admin-schema/sitePages.js`: /give, /feedback, /request, /qr, /privacy, /terms) keep their address and can't be deleted. Record routes (`/events/:id`...) stay in `App.tsx`, and their first path segments are reserved. Menu links are Pages → Navigation (`site_nav_links`, `server/src/siteNav.js`, read through `src/lib/useSiteNav.ts`); `navConfig.ts` only holds the defaults the app starts from before that loads.
- `api.ts` is the shared caching client used by frontend data hooks. - `api.ts` is the shared caching client used by frontend data hooks.
- `docs/updating-data-in-code.md`: where content that isn't in the database lives (admin dropdown labels, fixed value lists, nav, banner, decades, map grid) and how to change it. Keep it current when adding a dropdown or code-owned content. - `docs/updating-data-in-code.md`: where content that isn't in the database lives (admin dropdown labels, fixed value lists, nav, banner, decades, map grid) and how to change it. Keep it current when adding a dropdown or code-owned content.
- Images: every record image (logos, photos, backgrounds, block images) is an upload, in a folder by use: `/uploads/logos/`, `/uploads/images/`, `/uploads/thumbnails/` (saved previews), `/uploads/captions/` (videos' .vtt files); a logo or icon image field sets `folder: "logos"` (`docs/media-uploads.md`, Folders). A bare filename resolves to `/uploads/<file>` (`src/lib/media.ts`, and `server/src/pageMeta.js` for previews). Only the site's own chosen assets, the NGU logos in the nav, footer and admin, are bundled from `src/assets/logos/`. Logo images hide themselves on load error (`onError`). - Images: every record image (logos, photos, backgrounds, block images) is an upload, in a folder by use: `/uploads/logos/`, `/uploads/images/`, `/uploads/thumbnails/` (saved previews), `/uploads/captions/` (videos' .vtt files); a logo or icon image field sets `folder: "logos"` (`docs/media-uploads.md`, Folders). A bare filename resolves to `/uploads/<file>` (`src/lib/media.ts`, and `server/src/pageMeta.js` for previews). Only the site's own chosen assets, the NGU logos in the nav, footer and admin, are bundled from `src/assets/logos/`. Logo images hide themselves on load error (`onError`).
@ -84,6 +85,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
Descriptor-driven: `server/src/admin-crud.js` and `server/src/admin-schema/` (server, one file per entity, registered in `admin-schema.js`) and `src/lib/adminSchema/` (client, one file per entity, registered in `adminSchema.ts`) generate SQL and form fields from declarative entity configs. Adding an entity should mean adding a descriptor, not new CRUD code. Descriptor-driven: `server/src/admin-crud.js` and `server/src/admin-schema/` (server, one file per entity, registered in `admin-schema.js`) and `src/lib/adminSchema/` (client, one file per entity, registered in `adminSchema.ts`) generate SQL and form fields from declarative entity configs. Adding an entity should mean adding a descriptor, not new CRUD code.
- Child collections are deleted and reinserted wholesale. Unsafe for entities referenced by foreign keys elsewhere. - Child collections are deleted and reinserted wholesale. Unsafe for entities referenced by foreign keys elsewhere.
- `reindex: false` prevents cross-entity sort order collisions. - `reindex: false` prevents cross-entity sort order collisions.
- A child collection can have `extensions` of its own (1:1 side tables keyed by the child row's id, eg. a page section's `section_hero`), and both those and its nested collections take a `when` on the row's values (a section's preset). A `when` value can be a list.
- `check: (db, id) => void` runs after a save has written everything, inside its transaction; throwing an `HttpError` refuses the save (Site settings uses it for the color contrast check, `server/src/theme.js`). - `check: (db, id) => void` runs after a save has written everything, inside its transaction; throwing an `HttpError` refuses the save (Site settings uses it for the color contrast check, `server/src/theme.js`).
- The `OMIT` sentinel distinguishes unsent fields from deliberate clears. - The `OMIT` sentinel distinguishes unsent fields from deliberate clears.
- `admin-schema-sync.js` runs at boot and throws if descriptors don't match live `PRAGMA table_info`. If boot fails after a schema change, update the descriptor or migration so they agree. - `admin-schema-sync.js` runs at boot and throws if descriptors don't match live `PRAGMA table_info`. If boot fails after a schema change, update the descriptor or migration so they agree.

35
TODO.md
View file

@ -42,14 +42,6 @@
- [ ] Linked from the footer next to the version, or only in the blog? Answer: - [ ] Linked from the footer next to the version, or only in the blog? Answer:
## Sections ## Sections
- [ ] **Hero text that flips**: the headline's word changes (Next, Now, and other words for our generation), or mirrors.
- [ ] Which words, and are they edited in Front page (a list) or fixed? Answer:
- [ ] What motion: a flip like a card, a fade, letters typing, a mirror? Answer:
- [ ] Respect reduced motion by showing one word (the first)? [ ] yes
- [ ] "Next generation of New Thought": is that the line it plays on, or a second line under the headline? Answer:
- [ ] **NGU and partners**: "How does this partner with An Awakened Path and antn" (from the notes; unclear).
- [ ] What is "antn" (an organization's name)? Answer:
- [ ] Is this a section to build (eg. on Organization or Partners), or a question to answer in a blog post? Answer:
## Page Features ## Page Features
- [ ] **Full profiles**: people get full profile pages. Profile accounts, claiming and visibility are done (Part 2, Accounts); what's left is the page itself. - [ ] **Full profiles**: people get full profile pages. Profile accounts, claiming and visibility are done (Part 2, Accounts); what's left is the page itself.
@ -78,17 +70,14 @@
## Mobile ## Mobile
## Page Editing ## Page Editing
- [ ] **Page management revamp**, in steps (answers from 2026-10-16: disabled means out of the menus, sitemap and search with the address still working; admins can make new pages; the front page, the Community blog's settings, the form and embed pages and Privacy/Terms all become pages of sections; section types like the hero, stats, featured cards, calendar and countdown can go on any page, each with its own content).
- [x] Step 1, the page registry (Done, below).
- [x] Step 2, the core pages as sections (Done, below).
- [x] Step 3, section types with their own settings and the front page as sections (Done, below).
## Admin ## Admin
## Data ## Data
- [ ] **Planning Center sync to People**: Planning Center People into the site's people records.
- [ ] One way (Planning Center → site), or both? Answer: to site only
- [ ] Who gets synced: everyone, or a Planning Center list or tag (eg. "Website")? Most people in Planning Center shouldn't have a public page. Answer:a specific list
- [ ] Which fields: name, photo, email, phone, birthday? Which win when both sides differ? Answer:
- [ ] How often: a button in Data, hourly, nightly? Answer: manually only
- [ ] Is there a Planning Center API app (personal access token) we can use, and which account owns it? Answer: use the API
- Skipped on 2026-10-16 until the fields (and which side wins) are decided.
- [ ] **New Thought young adult directory**: the tabs are built (Part 2, Page features). Content: make the People tags (eg. Authors, Creators), tag people, and set Community's Directories section to them. - [ ] **New Thought young adult directory**: the tabs are built (Part 2, Page features). Content: make the People tags (eg. Authors, Creators), tag people, and set Community's Directories section to them.
## Navigation ## Navigation
@ -122,14 +111,28 @@
# Part 2: Done # Part 2: Done
## v1.14.0-profiles: page management (branch `page-management`, on top of `page-features`, no PR yet; migrations 080 to 085, back up the database before deploying)
- [x] **Planning Center sync** (Data, migration 085, `docs/planning-center.md`): Data → Planning Center (admins and up) fetches one Planning Center People list (Site settings → Planning Center) and compares each member with the site: linked, or suggested by the same email, else the same name, with the fields that would change (name, sort name, private email and phone) side by side. For each: link (and update; Planning Center wins), link to someone else, make a new unpublished person, or skip; Apply writes it all at once. One way, by hand. Off until `PCO_APP_ID` and `PCO_SECRET` are on the service. Tested against a stand-in for Planning Center's API only.
- [ ] Check with the real list: the token, a list number, a compare, an apply.
- [x] **Rotating words** (Sections, migration 084): text typed as `{Next|Now|Rising}` cycles through its choices, in the hero's headline, section titles (bands' too), headings, paragraphs, callouts and quotes, eg. `{Next|Now} Generation of {Unity|New Thought}`. Five motions (slide, flip like a card, fade, type letter by letter, mirror turning round), from the top or the bottom, a number of seconds per word: defaults in Site settings → Animated words, and a hero or a block can set its own. Each word's space is the longest's, so the line doesn't jump. Less motion (the system's setting, or reading mode) shows the first word, still, and screen readers always get the first; menus, tab titles, search descriptions and newsletters use the first word too (`src/components/RotatingWords.tsx`, `src/lib/words.ts`).
- [ ] Check in a browser: each motion and direction, a group in a section title and a paragraph, the space it keeps on a phone, reduced motion.
- [x] **Section types with their own settings, and the front page as sections** (migration 083): the front page is Home in Page management, a page of sections like the others: its hero first, then its bands in their old order (hidden ones stay hidden), each a section type that can go on any page with content of its own: Hero (words, buttons, photos, video, livestream or event), Event countdown, Event calendar, Numbers, Featured cards, Connect nav, and a Timeline shown as the rail of featured moments. The Community blog's slots, pinned posts and feeds moved into its section, so it can go on any page too. Any section can be Hidden. The Front page editor is gone (its fields are each section's), and so are its tables and the Community page's. On the front page the bands look as they did and any other section is a band in the same style; on other pages a band brings its own heading. The National Retreats band became an Events section with an All retreats button. The newsletter's "featured cards" come from the front page's featured card sections. Admin engine: a child collection can have its own side tables and gated nested collections.
- [ ] Check in a browser: the front page (every band, the countdown overlapping the hero, reading mode, the menu's Home dropdown), editing the hero and a band in Page management, a Hero and a Numbers section put on another page, hiding a section, the Community blog (pinned posts, feeds), a draft preview of the front page, the newsletter's featured cards.
- [x] **Core pages as sections** (migrations 081, 082): Feedback, Request, QR codes, Give, Privacy and Terms are pages of sections now, edited in Page management like any other. Their forms and embeds are section types any page can use (Website feedback form, Request form, Data request form, Giving button, QR code maker); Give's words, and all of Privacy and Terms, are blocks (headings, paragraphs, lists), with "Last updated" in the section's blurb. The privacy contact email was written into the policy's text and its Site settings field is gone. These pages keep their address (the site's code links to them) and can't be deleted. The privacy notice's link now goes to #cookies-and-browser-storage.
- [ ] Check in a browser: each of the six pages (reading width of Privacy and Terms, the giving modal opening), editing a Privacy paragraph, a Request form section put on another page.
- [x] **Page registry** (migration 080): every page of the site is a row in Pages → Page management (admins and up): its address, title, intro, Hidden (Not found below viewer) and Disabled (out of the menus, the sitemap and search; the address still works), and the order of its admin card. New pages are made there, as pages of sections at the address given (any address but the admin's, the API's, the records' and the account pages'). The admin home's Pages group opens with a Page management banner (New page, Menus), then a card per page. The six page editors (Retreats, Community...) are one editor now; site.json's `pages` and Navigation's page list moved into the registry and are gone. The fixed pages (Feedback, Request, Give, QR codes, Privacy, Terms, the front page) take their words from it too and can't be deleted.
- [ ] Check in a browser: the admin home's banner and page cards, making a page (address, sections) and opening it, hiding and disabling one (menus, the page signed out), renaming Feedback, the Under page select in Navigation.
## v1.14.0-profiles: page features (branch `page-features`, with `nav-access` under it, no PR yet; migrations 078 and 079, back up the database before deploying) ## v1.14.0-profiles: page features (branch `page-features`, with `nav-access` under it, no PR yet; migrations 078 and 079, back up the database before deploying)
- [x] **Featured event label** (Mobile): the "Featured event" badge left the headline; from lg up it sits above the event's card it names, and on a phone (the card under the words) it's left out. - [x] **Featured event label** (Mobile): the "Featured event" badge left the headline; from lg up it sits above the event's card it names, and on a phone (the card under the words) it's left out.
- [x] **Site version names**: the tag's words after the number are the version's name, `v1.13.2-region-cards` → "The Region Cards Update" (`src/lib/version.ts`), shown with the number in the site's footer and beside the version in the admin's footer and home. - [x] **Site version names**: the tag's words after the number are the version's name, `v1.13.2-region-cards` → "The Region Cards Update" (`src/lib/version.ts`), shown with the number in the site's footer and beside the version in the admin's footer and home.
- [x] **Image converter** (Tools → Image converter): pictures to JPG, PNG or WebP in the browser (nothing uploaded): pick or drop several, a quality slider for JPG and WebP, download each or all. JPG fills transparency white. Media's images each have a Download as… (JPG, PNG, WebP) doing the same (`src/lib/convertImage.ts`). - [x] **Image converter** (Tools → Image converter): pictures to JPG, PNG or WebP in the browser (nothing uploaded): pick or drop several, a quality slider for JPG and WebP, download each or all. JPG fills transparency white. Media's images each have a Download as… (JPG, PNG, WebP) doing the same (`src/lib/convertImage.ts`).
- [x] **Directory tabs** (migration 078): the People directory preset takes several People tags, a tab each in the order picked (Directory: tags under the section); one tag shows without tabs, reading mode lists every tag. Each section's old single tag became its first. - [x] **Directory tabs** (migration 078): the People directory preset takes several People tags, a tab each in the order picked (Directory: tags under the section); one tag shows without tabs, reading mode lists every tag. Each section's old single tag became its first.
- [x] **Blog post tabs** (migration 079): a Tab block in a post (its text the tab's title) starts a tab holding the blocks after it; blocks before the first Tab are the intro above the tabs. The contents list follows the open tab, a link to a heading in another tab opens it, and Download PDF and reading mode show every tab under its title. Outside a post a Tab block reads as a heading. - [x] **Blog post tabs** (migration 079): a Tab block in a post (its text the tab's title) starts a tab holding the blocks after it; blocks before the first Tab are the intro above the tabs. The contents list follows the open tab, a link to a heading in another tab opens it, and Download PDF and reading mode show every tab under its title. Outside a post a Tab block reads as a heading.
- [x] **Featured event card height** (Sections): from lg up the event's photo sits beside its words instead of above them, with tighter type and buttons, so the card is about as tall as the hero's text beside it; stacked as before on a phone. The photo stays whole (16:9).
- [x] **Word import, more of it** (Page Features): a line starting `Tab:` (any style) starts a tab; the Quote style becomes a Quote (a dash and a name at the end is who said it), Intense Quote a Callout, a line of `---` a Divider, a YouTube, Vimeo or Facebook link alone on its line a Video, and `Button: Register` with Register linked a Button. Blog posts → What becomes what (beside Import from Word) shows the whole mapping; `docs/importing.md` too. The note after an import counts tabs and the rest.
- [x] **Side nav sun into the footer** (Navigation): the sun is far bigger than the sticky layer that carries it, so once the last section went up past the list it hung over the footer. It now fades out as the list leaves with the last section, and back in on the way up. - [x] **Side nav sun into the footer** (Navigation): the sun is far bigger than the sticky layer that carries it, so once the last section went up past the list it hung over the footer. It now fades out as the list leaves with the last section, and back in on the way up.
- [ ] Check in a browser: the side nav sun fading at the end of a long page (2xl screen) and with a tall footer; the featured event hero at phone and desktop width, the footers' version line, converting a PNG with transparency to JPG and a JPG to WebP (and Download as in Media), a Directories section with two tags and with one, a post with an intro and three tabs (contents, keyboard arrows, PDF, reading mode). - [ ] Check in a browser: the featured event card beside a two-line headline at 1024, 1280 and 1536px; What becomes what and a real Word document with Tab: lines, a quote and a video link; the side nav sun fading at the end of a long page (2xl screen) and with a tall footer; the featured event hero at phone and desktop width, the footers' version line, converting a PNG with transparency to JPG and a JPG to WebP (and Download as in Media), a Directories section with two tags and with one, a post with an intro and three tabs (contents, keyboard arrows, PDF, reading mode).
## Page Editing (branch `nav-access`, no PR yet; migration 077) ## Page Editing (branch `nav-access`, no PR yet; migration 077)
- [x] **Drafts of every record** (migration 077, `docs/drafts.md`): an existing record of any kind (events, people, organizations, blog posts, the front page, the site pages, Navigation, Site settings...) can be saved as a draft instead of going live. One draft per record; anyone who can edit it can save, preview, publish or discard it. Opening a record with a draft opens the draft, saying who saved it and when, and warning when the live record was saved since. Lists mark records with a draft. - [x] **Drafts of every record** (migration 077, `docs/drafts.md`): an existing record of any kind (events, people, organizations, blog posts, the front page, the site pages, Navigation, Site settings...) can be saved as a draft instead of going live. One draft per record; anyone who can edit it can save, preview, publish or discard it. Opening a record with a draft opens the draft, saying who saved it and when, and warning when the live record was saved since. Lists mark records with a draft.

View file

@ -18,6 +18,19 @@ authors and a cover, then tick Published.
| Tables | Table blocks: a row per line, cells split by `\|`, the first row the header | | Tables | Table blocks: a row per line, cells split by `\|`, the first row the header |
| Bold, italic, links (http, https, mailto) | `**bold**`, `*italic*`, `[text](url)`, in paragraphs, list items and table cells | | Bold, italic, links (http, https, mailto) | `**bold**`, `*italic*`, `[text](url)`, in paragraphs, list items and table cells |
And lines written a certain way, in any style:
| In the document | In the post |
| --- | --- |
| A line starting `Tab:`, eg. `Tab: Overview` | A Tab block: the post is split into tabs from there (the blocks before the first are the intro above the tabs) |
| The Quote style | A Quote block; a dash and a name at the end (`... - Jane Doe`) is who said it |
| The Intense Quote style | A Callout block |
| A line of `---` alone | A Divider |
| A YouTube, Vimeo or Facebook link alone on its line (the link text can be anything) | A Video block |
| `Button: Register`, with "Register" linked | A Button block, its label and link |
The same table is on Blog posts, beside Import from Word (What becomes what).
A post with three headings or more gets **Show contents** turned on. The A post with three headings or more gets **Show contents** turned on. The
URL ID is the title as a slug, with `-2`, `-3` when it's taken. URL ID is the title as a slug, with `-2`, `-3` when it's taken.

View file

@ -41,15 +41,14 @@ also take a separate `http2 on;`.
## The bundle ## The bundle
Only the home page is in the main bundle. Every other page, and the Every page, the front page included, and the whole admin, loads when
whole admin, loads when first visited (`src/App.tsx`). A tab still first visited (`src/App.tsx`). A tab still running an old build that
running an old build that asks for a page removed by a deploy reloads asks for a page removed by a deploy reloads once to pick up the new
once to pick up the new one. one.
The home page asks for events and the timeline alongside its own data The server tells the browser to fetch the front page's data
(`src/pages/Home.tsx`), and the server tells the browser to fetch (`/api/site-pages/home`) and its hero's first photo while the JS
`/api/front-page` and the first hero photo while the JS downloads downloads (`preload` in `server/src/pageMeta.js`).
(`preload` in `server/src/pageMeta.js`).
## Images ## Images

46
docs/planning-center.md Normal file
View file

@ -0,0 +1,46 @@
# Planning Center
Admin → Data → Planning Center (admins and up) brings one Planning
Center People list into the site's people, by hand (migration 085).
One way: nothing is sent to Planning Center.
## Setup
1. In Planning Center, make (or pick) a People **list** of the people who
should be on the site, eg. "Website". Its number is in its address:
`people.planningcenteronline.com/lists/1234567`.
2. Admin → Panel → Site settings → **Planning Center → People list**: that
number.
3. A personal access token: https://api.planningcenteronline.com/oauth/applications
→ Personal Access Tokens → New, as an account that can see that list.
Put its two halves on the service (`systemctl edit ngu-api`):
```
[Service]
Environment=PCO_APP_ID=...
Environment=PCO_SECRET=...
```
then `systemctl restart ngu-api`. (`PCO_BASE` overrides the API's
address, for testing.)
## Using it
**Compare with Planning Center** fetches the list. Each member shows:
- the site person they're **linked** to, or one **suggested** by the
same email (private or public), else the same name;
- for that person, each field that would change: name, sort name
("Last, First"), private email and private phone, the site's value
beside Planning Center's.
For each, choose **Link to** the suggestion (and whether to update it
from Planning Center), link to **someone else**, **make a new person**
(unpublished, to fill in and publish later), or **Skip**. **Apply**
writes what you chose, all at once; nothing changes before. Planning
Center wins where both have a value; a blank in Planning Center leaves
the site's. Once linked, a person is matched by Planning Center's id
from then on, whatever their name or email becomes.
Code: `server/src/planningCenter.js` (the API, the comparison, the
writes), `server/src/routes/pco.js`, `src/pages/admin/AdminPco.tsx`.

View file

@ -23,7 +23,7 @@ same build.
| --- | --- | | --- | --- |
| Site name, address, default description | `site.json`: `title`, `url`, `description` (blank uses the front page's subhead) | | Site name, address, default description | `site.json`: `title`, `url`, `description` (blank uses the front page's subhead) |
| Default preview image | `site.json`: `openGraph.image`, eg. `/uploads/<file>` from Admin → Tools → Media. Blank means pages without their own image have none. | | Default preview image | `site.json`: `openGraph.image`, eg. `/uploads/<file>` from Admin → Tools → Media. Blank means pages without their own image have none. |
| Static pages (Retreats, Community, History…) | `site.json`: `pages`. The page's heading and intro read the same entry, so they can't drift. A new static page needs an entry. | | The site's pages (Retreats, Community, History…) | Admin → Pages → Page management (`site_pages`). The page's heading and intro read the same row, so they can't drift. Disabled pages are `noindex` and out of the sitemap; hidden ones are a 404 to search engines. |
| Records (events, organizations, teams, awards, people, posts) | The database: the record's name, then its tagline or first paragraph; its own image (an event's card background, else its logo; a post's cover; a person's photo; an organization's logo). SVGs aren't used as previews. | | Records (events, organizations, teams, awards, people, posts) | The database: the record's name, then its tagline or first paragraph; its own image (an event's card background, else its logo; a post's cover; a person's photo; an organization's logo). SVGs aren't used as previews. |
| Whether search may list it | `site.json` `robots.index` for the whole site; per record, published and listed is indexed, published but unlisted is `noindex`, anything else is a 404. `/admin` is always `noindex`. | | Whether search may list it | `site.json` `robots.index` for the whole site; per record, published and listed is indexed, published but unlisted is `noindex`, anything else is a 404. `/admin` is always `noindex`. |

View file

@ -15,8 +15,8 @@ what a dropdown in the admin editor says.
- [Renaming what a dropdown shows](#renaming-what-a-dropdown-shows) - [Renaming what a dropdown shows](#renaming-what-a-dropdown-shows)
- [Adding, removing or renaming a stored value](#adding-removing-or-renaming-a-stored-value) - [Adding, removing or renaming a stored value](#adding-removing-or-renaming-a-stored-value)
- [Every dropdown in the editor](#every-dropdown-in-the-editor) - [Every dropdown in the editor](#every-dropdown-in-the-editor)
- [Front page section names](#front-page-section-names) - [Front page sections](#front-page-sections)
- [Front page stat sources](#front-page-stat-sources) - [Stat sources](#stat-sources)
- [Other content that lives in code](#other-content-that-lives-in-code) - [Other content that lives in code](#other-content-that-lives-in-code)
- [Writing text in the editor](#writing-text-in-the-editor) - [Writing text in the editor](#writing-text-in-the-editor)
- [Making the change](#making-the-change) - [Making the change](#making-the-change)
@ -36,7 +36,8 @@ what a dropdown in the admin editor says.
| The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) | | 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) | | 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, 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` | | A page's title and intro (also its search title and description), its address, Hidden and Disabled | the database (`site_pages`, 080) | Admin → Pages → Page management (admins and up), where new pages are made too |
| 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. See `docs/seo.md` |
| Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` | | Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` |
The rule of thumb from `CLAUDE.md`: data belongs in the database, The rule of thumb from `CLAUDE.md`: data belongs in the database,
@ -153,8 +154,9 @@ together, in one branch:
3. **`src/lib/adminSchema/<entity>.ts`**: the `options` on the form field, and on 3. **`src/lib/adminSchema/<entity>.ts`**: the `options` on the form field, and on
the list filter if there is one. the list filter if there is one.
4. **Anywhere the public site renders or relies on the value**, listed in 4. **Anywhere the public site renders or relies on the value**, listed in
the table below (for example `EVENT_TYPES` for event types, or the the table below (for example `EVENT_TYPES` for event types, or
`SECTIONS` map in `Home.tsx` for front page sections). `PRESETS` in `SitePage.tsx` and `BANDS` in `sections/Bands.tsx` for
section types).
If the server descriptor and the database disagree, the API refuses to If the server descriptor and the database disagree, the API refuses to
start: `admin-schema-sync.js` compares them at boot and throws with a start: `admin-schema-sync.js` compares them at boot and throws with a
@ -183,16 +185,15 @@ also in `server/src/admin-schema/` and a CHECK):
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` | | Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` | | Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping | | Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
| Front page → Countdown → Only this type | retreat, class, workshop, meeting, other | **yes** | `server/src/routes/home.js` (picks the countdown event). The same values as Events → Type, so adding a type widens both CHECKs. | | Pages → Sections → Countdown: only this type | retreat, class, workshop, meeting, other | **yes** | `server/src/sectionData.js` (picks the countdown event). The same values as Events → Type, so adding a type widens both CHECKs. |
| Front page → Background | brand, photos | **yes** | `HeroStage.tsx` | | Pages → Sections → Hero: background | brand, photos | **yes** | `HeroStage.tsx` |
| Front page → Feature | none, livestream, video, event | **yes** | `HeroStage.tsx`; the event is picked in `server/src/routes/home.js` | | Pages → Sections → Hero: feature | none, livestream, video, event | **yes** | `HeroStage.tsx`; the event is picked in `server/src/sectionData.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) | | Pages → Sections → Numbers → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` in `src/lib/adminSchema/sitePages.ts` | `STAT_QUERIES` in `server/src/sectionData.js`; see [below](#stat-sources) |
| 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) | | Featured cards → Card type (a Community blog's pinned community posts offer 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` | | Pages → Sections → Featured cards: columns (073) | 2, 3, 4 | **yes**, inline in `src/lib/adminSchema/sitePages.ts` | `GRID_COLUMNS` in `FeaturedCards.tsx`; the CHECK on `section_featured.columns` |
| Front page → Featured Content → Columns (073) | 2, 3, 4 | **yes**, inline in `src/lib/adminSchema/frontPage.ts` | `GRID_COLUMNS` in `FeaturedCards.tsx`; the CHECK on `front_page.featured_columns` | | Featured cards → Size (073; featured card sections only, regions and the Community blog stay automatic) | normal, wide, tall, large | **yes**, inline in `src/lib/adminSchema/sitePages.ts` | `SPANS` and `sizeOf` in `FeaturedCards.tsx`; the CHECK on `featured_cards.size` |
| Front page → Featured cards → Size (073; front page only, regions and the Community blog stay automatic) | normal, wide, tall, large | **yes**, inline in `src/lib/adminSchema/frontPage.ts` | `SPANS` and `sizeOf` in `FeaturedCards.tsx`; the CHECK on `featured_cards.size` | | 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` |
| 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` | | Pages → Sections → Preset (section type) | community_blog, group_map, region_list, partner_list, events, timeline, people_directory, feedback_form, request_form, data_request_form, giving, qr_maker, hero, countdown, calendar, stats, featured_cards, connect | **yes**, `PRESETS` in `src/lib/adminSchema/sitePages.ts`, every page offers them all | `PRESETS` in `src/pages/SitePage.tsx`; the bands (hero, countdown, calendar, numbers, featured cards, connect, and a timeline shown as a rail) in `src/pages/sections/Bands.tsx`, their data from `server/src/sectionData.js`; forms and embeds in `src/pages/sections/FormSections.tsx`. A People directory shows each tag's first `DIRECTORY_PREVIEW` people (`src/pages/sections/PeopleDirectory.tsx`), linking to `/directory/<tag>`. |
| Pages → Sections → Preset | community_blog, group_map, region_list, partner_list, events, timeline, people_directory | **yes**, `PRESETS` in `src/lib/adminSchema/sitePages.ts` (which pages offer which, the list passed to each `sitePage`) | `PRESETS` in `src/pages/SitePage.tsx`. A People directory shows its tag's first `DIRECTORY_PREVIEW` people (`src/pages/sections/PeopleDirectory.tsx`), linking to `/directory/<tag>`. |
| Pages → Sections → Cards: list (organization cards preset, 067) | partner, ministry, partner,ministry | **yes**, inline in `src/lib/adminSchema/sitePages.ts` | `partner_list` in `PRESETS` in `src/pages/SitePage.tsx` passes it as the kind to `OrgListCards`; a section's hand-picked Cards: organizations (`page_section_orgs`) replace it | | Pages → Sections → Cards: list (organization cards preset, 067) | partner, ministry, partner,ministry | **yes**, inline in `src/lib/adminSchema/sitePages.ts` | `partner_list` in `PRESETS` in `src/pages/SitePage.tsx` passes it as the kind to `OrgListCards`; a section's hand-picked Cards: organizations (`page_section_orgs`) replace it |
| Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a | | Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a |
@ -209,67 +210,49 @@ code):
| People → Directories → Tag; Pages → Sections → Directory: tag | `person_tag_types` | Data → People tags | | People → Directories → Tag; Pages → Sections → Directory: tag | `person_tag_types` | Data → People tags |
| Organizations and Events → Tags → Tag | `tags` | Data → Tags | | Organizations and Events → Tags → Tag | `tags` | Data → Tags |
| Organizations → Contacts → Type | `contact_types` | Data → Contact types | | Organizations → Contacts → Type | `contact_types` | Data → Contact types |
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) | | Event → Scope (+ list filter); Pages → Sections → 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, except ministries (they have no page to link to) | | Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labeled by name, except ministries (they have no page to link to) |
| Event hosts / event people / team members / timeline people → Person | `people` | people | | Event hosts / event people / team members / timeline people → Person | `people` | people |
| Community → Community blog: pinned posts (ours) → Post | `blog_posts` | blog posts, newest first | | Pages → Sections → Blog: pinned posts (ours) → Post | `blog_posts` | blog posts, newest first |
| Timeline → Record; Featured cards → Record | `record_refs` | every event, organization (but ministries), award, person and team, narrowed by the type picked beside it | | Timeline → Record; Featured cards → Record | `record_refs` | every event, organization (but ministries), award, person and team, narrowed by the type picked beside it |
| Affiliations → Team | `teams` | teams, filtered to the chosen organization | | Affiliations → Team | `teams` | teams, filtered to the chosen organization |
| Person awards → Award | `awards` | awards, labeled "Award (Organization)" | | Person awards → Award | `awards` | awards, labeled "Award (Organization)" |
| Person awards → Presented at; Front page → Count down to; Front page → Featured event | `events` | events | | Person awards → Presented at; Pages → Sections → Count down to, Hero: featured event | `events` | events |
--- ---
## Front page section names ## Front page sections
"Section name" means three different things on the front page, and The front page is a page of sections like the others (Admin → Pages →
each is changed in a different place: Page management → Home, migration 083): the hero first, then its
bands, each a section with a type. Its heading is the section's title
(up to 60 characters on the front page), its anchor the section's URL
ID (`#retreats`, `#calendar`, `#numbers`, `#connect`), which the
header's Home dropdown lists (not the hero or the countdown). Rename
a heading freely; change a URL ID only if you mean to break links to
it. The names in the section type dropdown are `PRESETS` in
`src/lib/adminSchema/sitePages.ts`.
| What you see | Where it's set | **Adding a new kind of band** is a feature, not a relabel: its
| --- | --- | component and an entry in `BANDS` (`src/pages/sections/Bands.tsx`),
| **The heading on the page** ("National Retreats", "What's on") | **Admin → Pages → Front page → Page sections → Heading.** Blank uses the default below. | its settings table (a migration) and extension or collection in
| The default heading when that field is blank | `SECTIONS` in `src/pages/Home.tsx`, the `title` of each entry | `sectionsChild` (`server/src/admin-schema/sitePages.js`), its data in
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema/frontPage.ts` | `server/src/sectionData.js`, its fields in `src/lib/adminSchema/sitePages.ts`,
| The links in the header's Home dropdown | the bands shown, under their headings (`src/lib/navSections.ts`) | and its value added to the CHECK on `page_sections.preset`.
To rename a band **for visitors**, use the admin. To rename how it
reads **in the editor's dropdown**, edit `FRONT_PAGE_SECTIONS`:
```ts
const FRONT_PAGE_SECTIONS = [
["countdown", "Event Countdown"],
["retreats", "Events Carousel (National Retreats)"], // ← the right-hand side is the label
["calendar", "Event Calendar"],
...
];
```
The subnav links jump to each band by its anchor: the `id` passed in
each band's `render` in `Home.tsx` (`#retreats`, `#calendar`,
`#numbers`, `#connect`, and `#hero` for the hero). If you rename a
heading in Front page → Sections, its anchor stays: leave the band's
`id` alone unless you mean to break links to it.
**Adding a new kind of band** (not just renaming one) is a feature,
not a relabel: it needs a component, an entry in `SECTIONS` in
`Home.tsx`, the key added to `FRONT_PAGE_SECTIONS`, to the
`enumeration("section", …)` in `server/src/admin-schema/frontPage.js`, to the
`FrontPageSectionKey` type in `src/lib/useFrontPage.ts`, and to the
CHECK on `front_page_sections.section` via a migration.
--- ---
## Front page stat sources ## Stat sources
The numbers band's "Number Source" dropdown works the same way: A Numbers section's "Number Source" dropdown works the same way:
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema/frontPage.ts`. - **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema/sitePages.ts`.
- **Change what a count counts:** its query in `STAT_QUERIES` in - **Change what a count counts:** its query in `STAT_QUERIES` in
`server/src/routes/home.js`. Keep it counting exactly what the `server/src/sectionData.js`. Keep it counting exactly what the
matching public page shows (published rows), or the number and the matching public page shows (published rows), or the number and the
page will disagree. page will disagree.
- **Add a source:** the CHECK on `front_page_stats.source` (migration), - **Add a source:** the CHECK on `section_stats.source` (migration),
the `enumeration("source", …)` in `server/src/admin-schema/frontPage.js`, the `enumeration("source", …)` in `server/src/admin-schema/sitePages.js`,
`STAT_SOURCES`, and a query in `STAT_QUERIES`. `STAT_SOURCES`, and a query in `STAT_QUERIES`.
--- ---
@ -278,19 +261,18 @@ The numbers band's "Number Source" dropdown works the same way:
| What | File | Notes | | What | File | Notes |
| --- | --- | --- | | --- | --- | --- |
| Header and footer navigation, each page's sections (the header dropdowns, mobile menu and footer site map) | Admin → Pages → Navigation (the database, `075_site_nav.sql`); `src/navConfig.ts` is only the defaults the app starts from before it loads | Links: where each shows (header pages, header buttons, footer Get in Touch, footer bottom row), order, label, a header page set under another's menu, a filled button, new tab. Pages: title, intro and Hidden (Not found below viewer, out of the menus and the sitemap; `server/src/siteNav.js`). Each page's sections aren't listed there: they follow the page itself, through `src/lib/navSections.ts` (the site pages' sections from Admin → Pages; the front page's bands it shows, with `src/lib/frontPageBands.ts` giving each band's anchor and default heading). A new static page needs a route in `src/App.tsx` and an entry in `site.json`'s `pages` (its default title and intro, and what Navigation's Page select offers); a new page of sections also needs its id in `site_pages`' CHECK and a descriptor in both admin schemas, like Shop (075). | | Header and footer navigation, each page's sections (the header dropdowns, mobile menu and footer site map) | Admin → Pages → Navigation (the database, `075_site_nav.sql`); `src/navConfig.ts` is only the defaults the app starts from before it loads | Links: where each shows (header pages, header buttons, footer Get in Touch, footer bottom row), order, label, a header page set under another's menu, a filled button, new tab. Each page's sections aren't listed there: they follow the page itself, through `src/lib/navSections.ts` (every page's sections from Admin → Pages → Page management, the front page's included, but its hero and countdown). A new page is made in Page management, no code: it's a page of sections at the address given. |
| 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. | | Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. |
| History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. | | History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |
| 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). | | 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). |
| Feedback form types | `src/data/feedbackTypes.ts` **and** `TYPES` in `server/src/routes/feedback.js` | Keep the ids identical in both; the server stores unknown ids as `general`. Labels and hints are client-only. `DATA_REQUEST` ('privacy') isn't a tile: the Privacy page's form sends it, and the server requires an email for it. | | Feedback form types | `src/data/feedbackTypes.ts` **and** `TYPES` in `server/src/routes/feedback.js` | Keep the ids identical in both; the server stores unknown ids as `general`. Labels and hints are client-only. `DATA_REQUEST` ('privacy') isn't a tile: the Privacy page's form sends it, and the server requires an email for it. |
| Request form types (what `/request` can ask for) | `src/data/requestTypes.ts` **and** `CATEGORIES` in `server/src/routes/requests.js` **and** the CHECK on `feedback.category` (`046_content_requests.sql`) | Ids and allowed actions (new, update) identical in all three; a new id needs a migration. Labels, hints, the name field's question and each type's `fields` (the details it asks for, and where each lands in the admin editor: a field path, a link row or a description paragraph) are client-only: the server stores whatever detail keys come as JSON (`feedback.details`, 049), so adding a field needs no migration. A button to the form opened on one type: `request: { type, label }` on a section manifest entry, or `<RequestLink>` (`src/components/RequestLink.tsx`). | | Request form types (what `/request` can ask for) | `src/data/requestTypes.ts` **and** `CATEGORIES` in `server/src/routes/requests.js` **and** the CHECK on `feedback.category` (`046_content_requests.sql`) | Ids and allowed actions (new, update) identical in all three; a new id needs a migration. Labels, hints, the name field's question and each type's `fields` (the details it asks for, and where each lands in the admin editor: a field path, a link row or a description paragraph) are client-only: the server stores whatever detail keys come as JSON (`feedback.details`, 049), so adding a field needs no migration. A button to the form opened on one type: `request: { type, label }` on a section manifest entry, or `<RequestLink>` (`src/components/RequestLink.tsx`). |
| The site's colors, light and dark | the database over `src/index.css` | Admin → Panel → Site settings → Colors (superadmins): pick a color, set its light and/or dark value; saving refuses anything that makes text hard to read. The defaults are `THEME_DEFAULTS` in `server/src/themeDefaults.js` (the admin and the contrast check read it) and the same values as CSS in `src/index.css`; the build stops if the two differ. The admin's labels for them are `THEME_LABELS` in `src/lib/adminSchema/siteSettings.ts`. Change a token's value in both modes and every use follows. Use the token utilities (`text-muted`, `bg-surface`, `border-brand/20`) or `var(--color-…)`, not hex. A color that arrives as data (a page accent, an event's or region's color) goes through `src/lib/color.ts`: `withAlpha` for tints, `accentText` for text in it, `readableOn` for text on it. | | The site's colors, light and dark | the database over `src/index.css` | Admin → Panel → Site settings → Colors (superadmins): pick a color, set its light and/or dark value; saving refuses anything that makes text hard to read. The defaults are `THEME_DEFAULTS` in `server/src/themeDefaults.js` (the admin and the contrast check read it) and the same values as CSS in `src/index.css`; the build stops if the two differ. The admin's labels for them are `THEME_LABELS` in `src/lib/adminSchema/siteSettings.ts`. Change a token's value in both modes and every use follows. Use the token utilities (`text-muted`, `bg-surface`, `border-brand/20`) or `var(--color-…)`, not hex. A color that arrives as data (a page accent, an event's or region's color) goes through `src/lib/color.ts`: `withAlpha` for tints, `accentText` for text in it, `readableOn` for text on it. |
| The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. | | The icons a Connect nav section's path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. |
| A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. | | A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. |
| The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. | | The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. |
| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `<html>` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal-<family>-<shade>)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well (a carousel, tabs, details behind a click, a map) draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the hero, pathfinder, stats, history rail, event lists, calendar (the next six weeks), featured cards, org lists and groups map, history timeline, schedule, people tiles and video player; the countdown draws nothing. A new component with any of those should do the same. Something saved or sent (the newsletter's colors) is a stored hex, which is never swapped. | | The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `<html>` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal-<family>-<shade>)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well (a carousel, tabs, details behind a click, a map) draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the hero, pathfinder, stats, history rail, event lists, calendar (the next six weeks), featured cards, org lists and groups map, history timeline, schedule, people tiles and video player; the countdown draws nothing. A new component with any of those should do the same. Something saved or sent (the newsletter's colors) is a stored hex, which is never swapped. |
| Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. | | Privacy Policy and Terms wording | the database (082) | Admin → Pages → Page management → Privacy Policy or Terms of Service: their sections' blocks, and the "Last updated" date in the section's blurb whenever the wording changes. The privacy contact email is in the policy's text. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. | | Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | | | Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
| Organization kind labels ("Region", "Group") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin) | | | Organization kind labels ("Region", "Group") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin) | |
@ -305,6 +287,14 @@ The numbers band's "Number Source" dropdown works the same way:
## Writing text in the editor ## Writing text in the editor
Rotating words: type the choices in braces, `{Next|Now|Rising}`, in a
hero headline, a section title, a heading, a paragraph, a callout or a
quote, and the word cycles through them. How it moves is Admin →
Panel → Site settings → Animated words, or the hero's or block's own
Rotating words fields. Menus, tab titles, search and emails show the
first choice. The component is `src/components/RotatingWords.tsx`; its
motions are CSS in `RotatingWords.css`.
Conventions for any label, help text or option added to the admin, so Conventions for any label, help text or option added to the admin, so
the editor reads consistently: the editor reads consistently:

View file

@ -139,7 +139,9 @@ function coerceRow(columns, data, { prefix = "" } = {}) {
return { values, errors }; return { values, errors };
} }
const applies = (gate, row) => !gate || row[gate.column] === gate.value; /* A gate on a column's value: one value, or any of a list. */
const applies = (gate, row) =>
!gate || (Array.isArray(gate.value) ? gate.value.includes(row[gate.column]) : row[gate.column] === gate.value);
/* ── Read ────────────────────────────────────────────────────── */ /* ── Read ────────────────────────────────────────────────────── */
@ -242,6 +244,12 @@ function readChildren(db, child, ownerId) {
) )
.all(...params); .all(...params);
// A row's own 1:1 side tables (a section's settings for its type:
// its hero's words, its blog's slots).
for (const ext of child.extensions ?? []) {
for (const row of rows) row[ext.key] = readExtension(db, ext, row.id);
}
// Nested collections, to any depth: a page's sections, each // Nested collections, to any depth: a page's sections, each
// section's blocks, each block's items. The id goes as text: a JS // 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 // number binds as REAL, which a TEXT owner column (a section's
@ -411,6 +419,10 @@ export function deleteRow(db, entity, rawId) {
} }
const id = normalizeId(entity, rawId); const id = normalizeId(entity, rawId);
// Records the site can't do without (the pages it draws in code).
if (entity.undeletable?.includes(id)) {
throw new HttpError(405, "The site needs this one: it can be hidden or disabled, not deleted.");
}
const result = wrapDbErrors(() => const result = wrapDbErrors(() =>
db.prepare(`DELETE FROM ${entity.table} WHERE ${entity.idColumn} = ?`).run(id), db.prepare(`DELETE FROM ${entity.table} WHERE ${entity.idColumn} = ?`).run(id),
); );
@ -419,7 +431,7 @@ export function deleteRow(db, entity, rawId) {
/* ── Write helpers ───────────────────────────────────────────── */ /* ── Write helpers ───────────────────────────────────────────── */
function writeExtensions(db, entity, id, payload, parentValues) { function writeExtensions(db, entity, id, payload, parentValues, prefix = "") {
for (const ext of entity.extensions ?? []) { for (const ext of entity.extensions ?? []) {
if (!applies(ext.when, parentValues)) { if (!applies(ext.when, parentValues)) {
// The gate closed (the kind changed away from this side // The gate closed (the kind changed away from this side
@ -431,7 +443,7 @@ function writeExtensions(db, entity, id, payload, parentValues) {
} }
const { values, errors } = coerceRow(ext.columns, payload[ext.key] ?? {}, { const { values, errors } = coerceRow(ext.columns, payload[ext.key] ?? {}, {
prefix: `${ext.key}.`, prefix: `${prefix}${ext.key}.`,
}); });
if (Object.keys(errors).length) { if (Object.keys(errors).length) {
throw new HttpError(422, "Validation failed", errors); throw new HttpError(422, "Validation failed", errors);
@ -584,8 +596,13 @@ function writeRows(db, child, ownerId, incomingRaw, prefix, parentValues) {
.run(...params), .run(...params),
); );
const rowId = Number(result.lastInsertRowid);
// Its own side tables, gated on its values (a section's preset),
// then its collections, gated the same way.
if (child.extensions) writeExtensions(db, child, rowId, raw, values, rowPrefix);
for (const child2 of child.children ?? []) { for (const child2 of child.children ?? []) {
writeRows(db, child2, String(result.lastInsertRowid), raw[child2.key], `${rowPrefix}${child2.key}.`, values); if (!applies(child2.when, values)) continue;
writeRows(db, child2, String(rowId), raw[child2.key], `${rowPrefix}${child2.key}.`, values);
} }
}); });
} }

View file

@ -85,6 +85,13 @@ function collectGroups(entity) {
...Object.keys(child.owner.inherit ?? {}), ...Object.keys(child.owner.inherit ?? {}),
].filter(Boolean), ].filter(Boolean),
}); });
for (const ext of child.extensions ?? []) {
groups.push({
table: ext.table,
columns: ext.columns ?? [],
engineSupplied: [ext.idColumn, ext.owner?.column, ext.owner?.kindColumn].filter(Boolean),
});
}
for (const nested of child.children ?? []) walk(nested); for (const nested of child.children ?? []) walk(nested);
}; };

View file

@ -18,9 +18,14 @@
regions or groups row should exist) regions or groups row should exist)
children ordered collections, replaced wholesale on save; children ordered collections, replaced wholesale on save;
`readRole` on one hides it from lesser roles, as `readRole` on one hides it from lesser roles, as
on an extension (an organization's contacts) on an extension (an organization's contacts). A
child may have `extensions` of its own (a page
section's settings for its type), and its nested
collections a `when` on its values
singleton the one id this entity ever has; the engine singleton the one id this entity ever has; the engine
refuses create and delete (see front_page) refuses create and delete (see navigation)
undeletable ids the engine refuses to delete (the pages the
site draws in code)
check (db, id) => void, run after a save has written check (db, id) => void, run after a save has written
everything, inside its transaction: throw an everything, inside its transaction: throw an
HttpError to refuse it (site settings' colors) HttpError to refuse it (site settings' colors)
@ -50,7 +55,6 @@ import { people } from "./admin-schema/people.js";
import { teams } from "./admin-schema/teams.js"; import { teams } from "./admin-schema/teams.js";
import { awards } from "./admin-schema/awards.js"; import { awards } from "./admin-schema/awards.js";
import { timeline } from "./admin-schema/timeline.js"; import { timeline } from "./admin-schema/timeline.js";
import { frontPage } from "./admin-schema/frontPage.js";
import { blogPosts } from "./admin-schema/blog.js"; import { blogPosts } from "./admin-schema/blog.js";
import { siteSettings } from "./admin-schema/siteSettings.js"; import { siteSettings } from "./admin-schema/siteSettings.js";
import { siteNav } from "./admin-schema/siteNav.js"; import { siteNav } from "./admin-schema/siteNav.js";
@ -59,14 +63,7 @@ import { personTagTypes } from "./admin-schema/personTags.js";
import { tags } from "./admin-schema/tags.js"; import { tags } from "./admin-schema/tags.js";
import { contactTypes } from "./admin-schema/contactTypes.js"; import { contactTypes } from "./admin-schema/contactTypes.js";
import { redirects } from "./admin-schema/redirects.js"; import { redirects } from "./admin-schema/redirects.js";
import { import { pages } from "./admin-schema/sitePages.js";
communityPage,
retreatsPage,
resourcesPage,
organizationPage,
historyPage,
shopPage,
} from "./admin-schema/sitePages.js";
export const ENTITIES = { export const ENTITIES = {
organizations, organizations,
@ -79,14 +76,8 @@ export const ENTITIES = {
teams, teams,
awards, awards,
timeline, timeline,
front_page: frontPage,
blog_posts: blogPosts, blog_posts: blogPosts,
community_page: communityPage, pages,
retreats_page: retreatsPage,
resources_page: resourcesPage,
organization_page: organizationPage,
history_page: historyPage,
shop_page: shopPage,
navigation: siteNav, navigation: siteNav,
site_settings: siteSettings, site_settings: siteSettings,
newsletters, newsletters,
@ -116,6 +107,8 @@ export const OPTION_QUERIES = {
// Link fields with `redirects: true` pick from these (068). // Link fields with `redirects: true` pick from these (068).
redirects: "SELECT id, id || ' (' || target_url || ')' AS label FROM redirects ORDER BY id", redirects: "SELECT id, id || ' (' || target_url || ')' AS label FROM redirects ORDER BY id",
blog_posts: "SELECT id, title AS label FROM blog_posts ORDER BY published_on DESC, title", blog_posts: "SELECT id, title AS label FROM blog_posts ORDER BY published_on DESC, title",
// Navigation's Under page: a page by its address (080).
site_pages: "SELECT path AS id, title || ' (' || path || ')' AS label FROM site_pages ORDER BY sort_order, title",
// org_id rides along so the affiliation row can filter the list // org_id rides along so the affiliation row can filter the list
// down to teams of the organization it already names. // down to teams of the organization it already names.

View file

@ -164,6 +164,10 @@ export const blocksChild = (ownerKind) => ({
text("cite"), text("cite"),
// Video blocks only (066): an uploaded video's WebVTT file. // Video blocks only (066): an uploaded video's WebVTT file.
text("captions"), text("captions"),
// Its rotating words (084): blank keeps the site's.
enumeration("word_motion", ["slide", "flip", "fade", "type", "mirror"]),
enumeration("word_direction", ["top", "bottom"]),
int("word_seconds"),
// People blocks only (054): whose team's tiles to show. // People blocks only (054): whose team's tiles to show.
text("team_id"), text("team_id"),
], ],

View file

@ -1,129 +0,0 @@
import { text, url, int, bool, enumeration, featuredCardsChild } from "./columns.js";
/* ── Front page ──────────────────────────────────────────────────
A singleton: one row, id 'home', seeded by the schema and never
created by the admin. `singleton` tells the engine to refuse create
and delete, and the CHECK on front_page.id is what makes a second
row impossible even without it.
Every collection here is owned by page_id and replaced wholesale.
That is safe for the same reason it is for links and blocks
(nothing has a foreign key into these tables), and paths carry
their actions as a nested collection, the shape content blocks
and their items already use. */
export const frontPage = {
key: "front_page",
table: "front_page",
idColumn: "id",
idKind: "slug",
singleton: "home",
concurrency: "updated_at",
list: {
columns: ["id", "headline", "hero_backdrop", "hero_feature", "updated_at"],
filters: [],
search: [],
order: "id",
},
columns: [
enumeration("hero_backdrop", ["brand", "photos"]),
enumeration("hero_feature", ["none", "livestream", "video", "event"]),
text("hero_event_id"),
text("eyebrow"),
text("headline"),
text("subhead"),
text("primary_label"),
url("primary_url"),
text("secondary_label"),
url("secondary_url"),
int("slide_seconds"),
url("livestream_url"),
text("livestream_title"),
url("video_url"),
text("video_title"),
text("video_captions"),
text("countdown_event_id"),
text("countdown_scope_id"),
enumeration("countdown_event_type", ["retreat", "class", "workshop", "meeting", "other"]),
int("featured_columns"),
text("video_still"),
],
children: [
{
key: "slides",
table: "front_page_slides",
owner: { column: "page_id" },
order: "sort_order",
columns: [
text("media", { required: true }),
text("alt"),
text("caption"),
url("link_url"),
],
},
{
key: "sections",
table: "front_page_sections",
owner: { column: "page_id" },
order: "sort_order",
columns: [
enumeration(
"section",
["countdown", "retreats", "calendar", "stats", "timeline", "connect", "featured"],
{ required: true },
),
text("title"),
text("blurb"),
bool("is_hidden"),
],
},
{
key: "stats",
table: "front_page_stats",
owner: { column: "page_id" },
order: "sort_order",
columns: [
text("label", { required: true }),
enumeration("source", [
"manual",
"years_since",
"regions",
"groups",
"partners",
"events_held",
"retreats_held",
"people",
"awards_given",
]),
text("value"),
text("suffix"),
text("note"),
],
},
featuredCardsChild("front_page"),
{
key: "paths",
table: "front_page_paths",
owner: { column: "page_id" },
order: "sort_order",
columns: [text("label", { required: true }), text("icon"), text("blurb")],
children: [
{
key: "actions",
table: "front_page_path_actions",
owner: { column: "path_id" },
order: "sort_order",
columns: [
text("label", { required: true }),
text("description"),
url("url", { required: true }),
],
},
],
},
],
};

View file

@ -1,10 +1,9 @@
import { text, bool, enumeration } from "./columns.js"; import { text, bool, enumeration } from "./columns.js";
/* ── Navigation (075_site_nav.sql) ─────────────────────────────── /* ── Navigation (075_site_nav.sql) ───────────────────────────────
Pages → Navigation: the header's and footer's links, in order, Pages → Navigation: the header's and footer's links, in order
and each static page's title, intro and whether it's hidden (siteNav.js reads them for the site; the pages themselves are
(siteNav.js reads it for the site). Admins and up: it can take a Page management's, sitePages.js). Admins and up. */
page off the site. */
export const siteNav = { export const siteNav = {
key: "navigation", key: "navigation",
table: "site_nav", table: "site_nav",
@ -33,12 +32,5 @@ export const siteNav = {
bool("new_tab"), bool("new_tab"),
], ],
}, },
{
key: "pages",
table: "site_nav_pages",
owner: { column: "nav_id" },
order: "sort_order",
columns: [text("path", { required: true }), text("title"), text("description"), bool("is_hidden")],
},
], ],
}; };

View file

@ -1,18 +1,25 @@
import { text, url, int, enumeration, featuredCardsChild, blocksChild } from "./columns.js"; import { HttpError } from "../admin-crud.js";
import { text, url, int, bool, enumeration, featuredCardsChild, blocksChild } from "./columns.js";
/* ── The site's own pages (056_site_pages.sql) ─────────────────── /* ── The site's pages (056_site_pages.sql, 080_page_registry.sql) ──
Community, Retreats, Resources, Organization, History and Shop Pages → Page management: every page of the site, one site_pages
(075): one row each (its address, title, intro, Hidden and Disabled), with
site_pages row each, edited as its own singleton, with its its sections nested under it and each section's blocks under that
sections nested under it and each section's blocks under that
(the blocks' items under them, as on any record). A section is (the blocks' items under them, as on any record). A section is
either its blocks or a preset, a prebuilt part of the site either its blocks or a preset, a prebuilt part of the site
(SitePage.tsx draws both). (SitePage.tsx draws both). New pages are made here.
Community also carries the blog section's settings: the A section type that needs more than its blocks keeps its settings
community_page row (same id) as an extension, and its pinned in tables of its own (083_section_settings.sql), the section's
posts, cards and feeds, all owned by that id. */ extensions and collections here, each gated on its preset: a
hero's words and slides, a countdown's event, a stats band's
numbers, a pathfinder's paths, featured cards, a Community blog's
slots, pinned posts and feeds. The front page is a page of
sections like the rest. */
/* Gates on the section's preset. */
const is = (preset) => ({ column: "preset", value: preset });
const sectionsChild = { const sectionsChild = {
key: "sections", key: "sections",
@ -32,12 +39,85 @@ const sectionsChild = {
"events", "events",
"timeline", "timeline",
"people_directory", "people_directory",
// What used to be whole pages (081).
"feedback_form",
"request_form",
"data_request_form",
"giving",
"qr_maker",
// The front page's bands, on any page (083).
"hero",
"countdown",
"calendar",
"stats",
"featured_cards",
"connect",
]), ]),
text("scope_id"), text("scope_id"),
enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]), enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]),
enumeration("view", ["carousel", "grid", "map"]), enumeration("view", ["carousel", "grid", "map"]),
// Organization cards (067): the kinds listed by themselves. // Organization cards (067): the kinds listed by themselves.
enumeration("org_kinds", ["partner", "ministry", "partner,ministry"]), enumeration("org_kinds", ["partner", "ministry", "partner,ministry"]),
bool("is_hidden"),
],
extensions: [
{
key: "hero",
table: "section_hero",
idColumn: "section_id",
when: is("hero"),
columns: [
text("eyebrow"),
text("headline"),
text("subhead"),
text("primary_label"),
url("primary_url"),
text("secondary_label"),
url("secondary_url"),
enumeration("backdrop", ["brand", "photos"]),
int("slide_seconds"),
enumeration("feature", ["none", "livestream", "video", "event"]),
url("livestream_url"),
text("livestream_title"),
url("video_url"),
text("video_title"),
text("video_captions"),
text("video_still"),
text("event_id"),
// Its rotating words (084).
enumeration("word_motion", ["slide", "flip", "fade", "type", "mirror"]),
enumeration("word_direction", ["top", "bottom"]),
int("word_seconds"),
],
},
{
key: "countdown",
table: "section_countdown",
idColumn: "section_id",
when: is("countdown"),
columns: [text("event_id"), text("scope_id"), enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"])],
},
{
key: "featured",
table: "section_featured",
idColumn: "section_id",
when: is("featured_cards"),
columns: [int("columns")],
},
{
key: "blog",
table: "section_blog",
idColumn: "section_id",
when: is("community_blog"),
columns: [
text("internal_title"),
int("internal_slots"),
text("external_title"),
int("external_slots"),
url("external_url"),
text("external_label"),
],
},
], ],
children: [ children: [
blocksChild("page_section"), blocksChild("page_section"),
@ -57,61 +137,128 @@ const sectionsChild = {
order: "sort_order", order: "sort_order",
columns: [text("org_id", { required: true })], columns: [text("org_id", { required: true })],
}, },
],
};
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", key: "slides",
table: "community_page", table: "section_slides",
idColumn: "id", owner: { column: "section_id" },
order: "sort_order",
when: is("hero"),
columns: [text("media", { required: true }), text("alt"), text("caption"), url("link_url")],
},
{
key: "stats",
table: "section_stats",
owner: { column: "section_id" },
order: "sort_order",
when: is("stats"),
columns: [ columns: [
text("internal_title"), text("label", { required: true }),
int("internal_slots"), enumeration("source", [
text("external_title"), "manual",
int("external_slots"), "years_since",
url("external_url"), "regions",
text("external_label"), "groups",
"partners",
"events_held",
"retreats_held",
"people",
"awards_given",
]),
text("value"),
text("suffix"),
text("note"),
], ],
}, },
],
children: [
{ {
key: "pinned_posts", key: "paths",
table: "community_page_pinned_posts", table: "section_paths",
owner: { column: "page_id" }, owner: { column: "section_id" },
order: "sort_order", order: "sort_order",
when: is("connect"),
columns: [text("label", { required: true }), text("icon"), text("blurb")],
children: [
{
key: "actions",
table: "section_path_actions",
owner: { column: "path_id" },
order: "sort_order",
columns: [text("label", { required: true }), text("description"), url("url", { required: true })],
},
],
},
// Featured cards, and a Community blog's pinned community posts.
{ ...featuredCardsChild("page_section"), when: { column: "preset", value: ["featured_cards", "community_blog"] } },
{
key: "blog_posts",
table: "section_blog_posts",
owner: { column: "section_id" },
order: "sort_order",
when: is("community_blog"),
columns: [text("post_id", { required: true })], columns: [text("post_id", { required: true })],
}, },
featuredCardsChild("community_page"),
{ {
key: "feeds", key: "feeds",
table: "community_page_feeds", table: "section_feeds",
owner: { column: "page_id" }, owner: { column: "section_id" },
order: "sort_order", order: "sort_order",
when: is("community_blog"),
columns: [url("url", { required: true }), text("label")], columns: [url("url", { required: true }), text("label")],
}, },
], ],
}); };
export const retreatsPage = sitePage("retreats");
export const resourcesPage = sitePage("resources"); /* Pages the site's own code links to (the footer's defaults, the
export const organizationPage = sitePage("organization"); Request buttons, the privacy notice, Tools → QR codes): renamed,
export const historyPage = sitePage("history"); hidden or disabled, but never moved or deleted. */
export const shopPage = sitePage("shop"); export const CORE_PAGES = { home: "/", give: "/give", feedback: "/feedback", request: "/request", qr: "/qr", privacy: "/privacy", terms: "/terms" };
/* Addresses a page can't take: the admin, the API, the uploads, the
records' own pages and the account pages. */
const RESERVED = [
"admin", "api", "uploads", "assets", "pa", "go",
"events", "regions", "groups", "partners", "organizations", "teams", "awards", "people", "blog", "directory",
"sign-in", "account", "sitemap.xml", "robots.txt",
];
/* After a save: the address is one a page may have. */
function checkPage(db, id) {
const page = db.prepare(`SELECT path FROM site_pages WHERE id = ?`).get(id);
const first = page?.path.split("/")[1];
if (first && RESERVED.includes(first)) {
throw new HttpError(422, "Validation failed", { path: `/${first} belongs to another part of the site. Pick another address.` });
}
if (CORE_PAGES[id] && page.path !== CORE_PAGES[id]) {
throw new HttpError(422, "Validation failed", { path: `The site links to this page at ${CORE_PAGES[id]}, so its address stays.` });
}
if (id !== "home" && page.path === "/") throw new HttpError(422, "Validation failed", { path: "/ is the front page." });
}
export const pages = {
key: "pages",
table: "site_pages",
idColumn: "id",
idKind: "slug",
concurrency: "updated_at",
undeletable: Object.keys(CORE_PAGES),
list: {
columns: ["title", "path", "is_hidden", "is_disabled", "updated_at"],
filters: [],
search: ["title", "path"],
order: "sort_order, title",
},
columns: [
text("path", { required: true }),
text("title", { required: true }),
text("description"),
bool("is_hidden"),
bool("is_disabled"),
int("sort_order"),
],
children: [sectionsChild],
check: checkPage,
};

View file

@ -1,5 +1,5 @@
import { THEME_TOKENS, checkTheme } from "../theme.js"; import { THEME_TOKENS, checkTheme } from "../theme.js";
import { text, enumeration } from "./columns.js"; import { text, int, enumeration } from "./columns.js";
/* ── Site settings (035_site_settings.sql) ────────────────────── /* ── Site settings (035_site_settings.sql) ──────────────────────
A singleton of overrides for what site.json says: name, A singleton of overrides for what site.json says: name,
@ -30,13 +30,18 @@ export const siteSettings = {
text("favicon"), text("favicon"),
text("apple_touch_icon"), text("apple_touch_icon"),
enumeration("indexing", ["on", "off"]), enumeration("indexing", ["on", "off"]),
text("privacy_email"),
text("notify_emails"), text("notify_emails"),
text("access_group_viewer"), text("access_group_viewer"),
text("access_group_editor"), text("access_group_editor"),
text("access_group_admin"), text("access_group_admin"),
enumeration("report_daily", ["on", "off"]), enumeration("report_daily", ["on", "off"]),
enumeration("report_weekly", ["on", "off"]), enumeration("report_weekly", ["on", "off"]),
// Rotating words' defaults (084).
enumeration("word_motion", ["slide", "flip", "fade", "type", "mirror"]),
enumeration("word_direction", ["top", "bottom"]),
int("word_seconds"),
// Data → Planning Center's list (085).
text("pco_list_id"),
], ],
children: [ children: [

View file

@ -14,6 +14,17 @@
cells split by |) cells split by |)
bold, italic, links **bold**, *italic*, [text](url) bold, italic, links **bold**, *italic*, [text](url)
And a few lines written a certain way (docs/importing.md), any
style:
"Tab: Overview" a tab block (079): the post
is split into tabs there
the Quote style a quote block
the Intense Quote style a callout block
"---" alone a divider
a YouTube, Vimeo or Facebook link a video block
alone on its line
"Button: [Register](https://…)" a button block
Images, text boxes, footnotes and comments aren't carried over; Images, text boxes, footnotes and comments aren't carried over;
the result counts what was skipped so the editor can say so. the result counts what was skipped so the editor can say so.
@ -216,7 +227,7 @@ export function readDocx(buf) {
if (!text) continue; if (!text) continue;
const level = style === "title" ? 0 : Number(/^heading (\d)/.exec(style)?.[1] ?? NaN); const level = style === "title" ? 0 : Number(/^heading (\d)/.exec(style)?.[1] ?? NaN);
if (!title && (level === 0 || level === 1)) { if (!title && (level === 0 || level === 1) && !lineBlock(text, style)) {
close(); close();
title = text.replace(/\*/g, ""); title = text.replace(/\*/g, "");
continue; continue;
@ -231,6 +242,12 @@ export function readDocx(buf) {
continue; continue;
} }
} }
const special = lineBlock(text, style);
if (special) {
close();
blocks.push(special);
continue;
}
if (level >= 1) { if (level >= 1) {
close(); close();
blocks.push({ type: level <= 2 ? "heading" : "subheading", text: text.replace(/\*/g, "") }); blocks.push({ type: level <= 2 ? "heading" : "subheading", text: text.replace(/\*/g, "") });
@ -248,3 +265,37 @@ export function readDocx(buf) {
return { title, date, blocks, skipped: counts }; return { title, date, blocks, skipped: counts };
} }
/* ── Lines written a certain way ──────────────────────────────── */
const VIDEO_HOST = /^https?:\/\/(www\.)?(youtube\.com|youtu\.be|m\.youtube\.com|vimeo\.com|player\.vimeo\.com|facebook\.com|fb\.watch)\//i;
/* The one link a line is made of, "[text](url)" or a bare url, or null. */
function loneLink(text) {
const md = /^\[[^\]]*\]\(([^)\s]+)\)$/.exec(text);
if (md) return md[1];
return /^https?:\/\/\S+$/.test(text) ? text : null;
}
/* A block a paragraph stands for by how it's written, or null for an
ordinary one (docs/importing.md). */
function lineBlock(text, style) {
const plain = text.replace(/\*/g, "").trim();
const tab = /^tab:\s*(.+)$/i.exec(plain);
if (tab) return { type: "tab", text: tab[1].trim().slice(0, 80) };
if (/^(-{3,}|_{3,})$/.test(plain)) return { type: "divider" };
const button = /^button:\s*\[([^\]]+)\]\(([^)\s]+)\)$/i.exec(text.trim());
if (button) return { type: "button", text: button[1].replace(/\*/g, ""), href: button[2] };
const link = loneLink(text.trim());
if (link && VIDEO_HOST.test(link)) return { type: "video", href: link };
if (style === "intense quote") return { type: "callout", text };
if (style === "quote") {
// A dash and a name at the end ("… - Jane Doe", any dash) is who said it.
const said = /^(.*\S)\s+[—–-]\s*([^—–-]{2,80})$/.exec(text);
return said ? { type: "quote", text: said[1], cite: said[2].trim() } : { type: "quote", text };
}
return null;
}

View file

@ -2,7 +2,7 @@
FEEDS FEEDS
Reads the RSS and Atom feeds the Community page's blog section Reads the RSS and Atom feeds the Community page's blog section
lists (community_page_feeds), for its "newest community posts". lists (section_feeds, 083), for its "newest community posts".
A Substack's feed is https://<name>.substack.com/feed. A Substack's feed is https://<name>.substack.com/feed.
Each feed is fetched through linkPreview.js's safeGet, so it gets Each feed is fetched through linkPreview.js's safeGet, so it gets

View file

@ -24,7 +24,6 @@ import { rateLimit } from "./rateLimit.js";
import content from "./routes/content.js"; import content from "./routes/content.js";
import people from "./routes/people.js"; import people from "./routes/people.js";
import history from "./routes/history.js"; import history from "./routes/history.js";
import home from "./routes/home.js";
import directory from "./routes/directory.js"; import directory from "./routes/directory.js";
import blog from "./routes/blog.js"; import blog from "./routes/blog.js";
import sitePages from "./routes/sitePages.js"; import sitePages from "./routes/sitePages.js";
@ -34,6 +33,7 @@ import requests from "./routes/requests.js";
import auth from "./routes/auth.js"; import auth from "./routes/auth.js";
import account from "./routes/account.js"; import account from "./routes/account.js";
import profiles from "./routes/profiles.js"; import profiles from "./routes/profiles.js";
import pco from "./routes/pco.js";
import admin from "./routes/admin.js"; import admin from "./routes/admin.js";
import panel from "./routes/panel.js"; import panel from "./routes/panel.js";
import adminEntities from "./routes/admin-entities.js"; import adminEntities from "./routes/admin-entities.js";
@ -192,7 +192,6 @@ app.get("/api/health", (c) =>
app.route("/api", content); app.route("/api", content);
app.route("/api", people); app.route("/api", people);
app.route("/api", history); app.route("/api", history);
app.route("/api", home);
app.route("/api", directory); app.route("/api", directory);
app.route("/api", blog); app.route("/api", blog);
app.route("/api", sitePages); app.route("/api", sitePages);
@ -225,6 +224,7 @@ app.use("/api/account/photo", rateLimit({ windowMs: 15 * 60_000, max: 20 }));
app.route("/api/account", account); app.route("/api/account", account);
app.route("/api/admin", admin); app.route("/api/admin", admin);
app.route("/api/admin", profiles); app.route("/api/admin", profiles);
app.route("/api/admin", pco);
// Before the entity routes, whose /:entity would claim /media. // Before the entity routes, whose /:entity would claim /media.
app.route("/api/admin", media); app.route("/api/admin", media);
app.route("/api/admin", imports); app.route("/api/admin", imports);

View file

@ -0,0 +1,93 @@
-- ═══════════════════════════════════════════════════════════════
-- 080 PAGE REGISTRY
--
-- Every page of the site is a site_pages row: its address, title
-- and intro (the page's heading and its search text), and two
-- switches, all edited in Pages → Page management, where new pages
-- are made too. site.json's "pages" and Navigation's page list
-- (site_nav_pages, 075) both move here and go: this is the one
-- place a page's words live.
--
-- path '/retreats'; a new page's own, eg. '/library'.
-- Unique; '/' is the front page.
-- is_hidden Not found to everyone below viewer, out of the
-- menus and sitemap (siteNav.js)
-- is_disabled out of the menus, the sitemap and search; the
-- address still works
-- sort_order the order of the admin home's page cards
--
-- A page is its sections (page_sections), except the few the site
-- still draws in code (src/pages/fixedPages.ts): the front page,
-- Feedback, Request, Give, QR codes, Privacy and Terms. Those take
-- their title and intro from here all the same, and can't be
-- deleted (admin-schema/pages.js).
--
-- The id stays a slug, as before (page sections, the Community
-- blog's settings and the drafts key on it), so an existing page
-- keeps its id; its address can change.
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE site_pages_new (
id TEXT PRIMARY KEY
CONSTRAINT "A page's URL ID can use only lowercase letters, numbers and hyphens."
CHECK (id <> '' AND id NOT GLOB '*[^a-z0-9-]*'),
path TEXT NOT NULL UNIQUE
CONSTRAINT "A page's address starts with / and uses only lowercase letters, numbers, hyphens and /, eg. /library."
CHECK (path = '/' OR (path GLOB '/[a-z0-9]*' AND path NOT GLOB '*[^a-z0-9/-]*' AND path NOT GLOB '*/')),
title TEXT NOT NULL,
description TEXT,
is_hidden INTEGER NOT NULL DEFAULT 0 CHECK (is_hidden IN (0, 1)),
is_disabled INTEGER NOT NULL DEFAULT 0 CHECK (is_disabled IN (0, 1)),
sort_order INTEGER NOT NULL DEFAULT 0,
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
) STRICT;
INSERT INTO site_pages_new (id, path, title, description, sort_order) VALUES
('home', '/', 'Home', NULL, 0),
('retreats', '/retreats', 'Retreats', 'Retreats hosted by Next Generation of Unity, our regions, and our partners throughout the year.', 1),
('community', '/community', 'Community', 'Groups, regions and the people who make up Next Generation of Unity.', 2),
('resources', '/resources', 'Resources', 'Teachings, brand assets, and material for groups and partners.', 3),
('organization', '/organization', 'Organization', 'Our mission, vision and values, the people who lead Next Generation of Unity, and how to reach us.', 4),
('history', '/history', 'History', 'A near-complete timeline of Next Generation of Unity (NGU), and other Unity Young Adult programs.', 5),
('shop', '/shop', 'Shop', 'Shirts, stickers and more from Next Generation of Unity. Every purchase supports our retreats and programs.', 6),
('give', '/give', 'Giving', 'Support the work of Next Generation of Unity.', 7),
('feedback', '/feedback', 'Feedback', 'Tell us what''s working, what isn''t, and what you''d like to see next.', 8),
('request', '/request', 'Request', 'Ask for a blog post, an event, or a new or updated group, region, partner, team, award or person on the site.', 9),
('qr', '/qr', 'QR Codes', 'Codes for flyers, slides and signs, pointing at any page on the site or any link, in your choice of colors.', 10),
('privacy', '/privacy', 'Privacy Policy', 'How Next Generation of Unity collects, uses, and protects your information.', 11),
('terms', '/terms', 'Terms of Service', 'The terms that apply when you use this site and our programs.', 12);
-- Each page's sections' save time comes along.
UPDATE site_pages_new
SET updated_at = (SELECT updated_at FROM site_pages WHERE site_pages.id = site_pages_new.id)
WHERE id IN (SELECT id FROM site_pages);
-- What Navigation (or before it Site settings) changed.
UPDATE site_pages_new
SET title = COALESCE((SELECT n.title FROM site_nav_pages n WHERE n.path = site_pages_new.path), title),
description = COALESCE((SELECT n.description FROM site_nav_pages n WHERE n.path = site_pages_new.path), description),
is_hidden = COALESCE((SELECT n.is_hidden FROM site_nav_pages n WHERE n.path = site_pages_new.path), is_hidden);
DROP TABLE site_nav_pages;
-- The admin edits every page as one entity now ('pages'), so a
-- page's draft (077) moves under it.
UPDATE drafts
SET entity = 'pages', record_id = substr(entity, 1, length(entity) - 5)
WHERE entity IN ('community_page', 'retreats_page', 'resources_page', 'organization_page', 'history_page', 'shop_page');
-- page_sections names site_pages; legacy mode leaves it alone
-- through the rename.
PRAGMA legacy_alter_table = ON;
DROP TABLE site_pages;
ALTER TABLE site_pages_new RENAME TO site_pages;
PRAGMA legacy_alter_table = OFF;
CREATE INDEX site_pages_order_idx ON site_pages (sort_order);
CREATE TRIGGER site_pages_touch
AFTER UPDATE ON site_pages
FOR EACH ROW WHEN new.updated_at = old.updated_at
BEGIN
UPDATE site_pages SET updated_at = datetime('now') WHERE id = new.id;
END;

View file

@ -0,0 +1,65 @@
-- ═══════════════════════════════════════════════════════════════
-- 081 SECTION TYPES
--
-- page_sections.preset takes the parts of the site that were whole
-- pages, so those pages become pages of sections like any other
-- (082 builds them):
--
-- feedback_form the website feedback form (Feedback)
-- request_form the request form (Request)
-- data_request_form the data request form (Privacy)
-- giving the Church Center giving button (Give)
-- qr_maker the QR code maker (QR codes)
--
-- and the front page's bands, to go on any page with content of
-- their own (they're offered once they're built): hero, countdown,
-- calendar, stats, featured_cards, connect.
--
-- The CHECK can't change in place, so the table is rebuilt.
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE page_sections_new (
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', 'people_directory',
'feedback_form', 'request_form', 'data_request_form', 'giving', 'qr_maker',
'hero', 'countdown', 'calendar', 'stats', 'featured_cards', 'connect')),
-- 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')),
-- Organization cards (067): the kinds listed by themselves.
org_kinds TEXT CHECK (org_kinds IN ('partner', 'ministry', 'partner,ministry')),
UNIQUE (page_id, anchor)
) STRICT;
INSERT INTO page_sections_new
(id, page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view, org_kinds)
SELECT id, page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view, org_kinds
FROM page_sections;
-- page_section_orgs, page_section_tags and content_blocks' owner
-- trigger name page_sections; legacy mode leaves them alone through
-- the rename.
PRAGMA legacy_alter_table = ON;
DROP TABLE page_sections;
ALTER TABLE page_sections_new RENAME TO page_sections;
PRAGMA legacy_alter_table = OFF;
CREATE INDEX page_sections_page_idx ON page_sections (page_id, sort_order);
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;

View file

@ -0,0 +1,98 @@
-- ═══════════════════════════════════════════════════════════════
-- 082 CORE PAGES AS SECTIONS
--
-- Feedback, Request, QR codes, Give, Privacy and Terms were drawn in
-- code; now each is a page of sections like any other, with what
-- it said put in as blocks, so it's edited in Page management:
--
-- Feedback a feedback_form section
-- Request a request_form section
-- QR codes a qr_maker section
-- Give a giving section: its two paragraphs, then the
-- Church Center button
-- Privacy the policy as heading, paragraph and list blocks,
-- then a data_request_form section
-- Terms the terms as blocks
--
-- The privacy contact email (Site settings) was written into the
-- policy's text by the page; it's written into the blocks now, and
-- the setting goes (this text is where it's changed from now on).
-- ═══════════════════════════════════════════════════════════════
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, preset) VALUES ('feedback', 0, 'website', 'Website Feedback', 'Found a broken link, spotted something out of date, or want the site to do something it doesn''t? This form goes straight to the people who maintain it.', 'feedback_form');
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, preset) VALUES ('request', 0, 'request', 'Send a request', 'Tell us what you''d like on the site, or what should change. Attach a Word document with the details and we''ll take it from there.', 'request_form');
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, preset) VALUES ('qr', 0, 'make', 'Make a QR code', 'Pick a page from the main navigation, any event, organization, team, award, person or blog post, or type any link. Site pages always point at the live site. Choose what sits in the center and the colors; a warning shows if the code might not scan.', 'qr_maker');
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, preset) VALUES ('give', 0, 'give', 'Give to NGU', 'Your giving funds scholarships, retreats, leadership development and the continued growth of the Next Generation of Unity leaders, teachers and community members.', 'giving');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'give' AND anchor = 'give'), 'body', 0, 'paragraph', 'Gifts are processed securely through Church Center. The form opens right here on the page and you can give once or set up a recurring gift, and you don''t need an account to do either.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'give' AND anchor = 'give'), 'body', 1, 'paragraph', 'If you would like to send a check, please email our Board Treasurer at [treasurer@nextgenerationofunity.org](mailto:treasurer@nextgenerationofunity.org) to get an address.');
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, preset) VALUES ('privacy', 0, 'privacy', 'Privacy Policy', 'Last updated: October 3, 2026', NULL);
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 0, 'heading', 'In short');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 1, 'paragraph', 'We collect some information about the people who use this site and take part in Next Generation of Unity (NGU). We use it to run our programs and this website, we don''t sell it, and we don''t use advertising or tracking cookies.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 2, 'paragraph', 'If you want to see, correct or delete what we hold about you, ' || (CASE WHEN (SELECT privacy_email FROM site_settings WHERE id = 'site') IS NOT NULL THEN 'email [' || (SELECT privacy_email FROM site_settings WHERE id = 'site') || '](mailto:' || (SELECT privacy_email FROM site_settings WHERE id = 'site') || ') or use the ' ELSE 'use the ' END) || '[request form](#requests) below.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 3, 'heading', 'What we collect');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 4, 'paragraph', 'Depending on how you use the site and our programs:');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 5, 'list', NULL);
CREATE TEMP TABLE IF NOT EXISTS _list (id INTEGER);
DELETE FROM _list;
INSERT INTO _list (id) VALUES (last_insert_rowid());
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 0, '**Feedback and requests you send.** Your message, the page it''s about, and, if you give them, your name and email. With it we keep your browser''s description (its user agent) and a scrambled form of your IP address that can''t be turned back into the address; we use it only to spot abuse. Files you attach to a [request](/request) are kept with it.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 1, '**People on the site.** Leaders, speakers and volunteers can appear with a name, photo, role, short bio and public contact details. Staff may also keep private details, such as a birth date, private email, phone number or address, which are never shown on the site and can only be seen by our editors.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 2, '**Server records.** Like most websites, our server keeps short-lived logs of requests (the page asked for, the time, and the IP address that asked) to keep the site running and secure.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 3, '**Staff accounts.** For NGU staff and volunteers who sign in to edit the site: name, email, role, and a record of sign-ins. Passwords are stored only in a form that can''t be read back.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 6, 'heading', 'Young people');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 7, 'paragraph', 'We don''t show information about anyone under 18 on this site: no names, photos or details. If you believe something about a minor appears here, tell us and we''ll take it down.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 8, 'heading', 'How we use it');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 9, 'paragraph', 'To answer you, to run our retreats, groups and other programs, to keep this site accurate and working, and to keep it secure. We don''t sell or rent your information, and we don''t use it for advertising.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 10, 'heading', 'Artificial intelligence');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 11, 'paragraph', 'We used AI tools to help write this website''s code and build its structure. Those tools have no access to our database. Information you give us, and information we hold about the people in our community, is not given to AI systems, and isn''t used to train them.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 12, 'heading', 'Other services');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 13, 'paragraph', 'We try not to rely on other companies, but a few parts of the site are provided by them. When you use those parts, what you enter or do there goes to that company and is covered by its own privacy policy:');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 14, 'list', NULL);
CREATE TEMP TABLE IF NOT EXISTS _list (id INTEGER);
DELETE FROM _list;
INSERT INTO _list (id) VALUES (last_insert_rowid());
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 0, '**Giving** is handled by Church Center (Planning Center), at [ngu.churchcenteronline.com](https://ngu.churchcenteronline.com). 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.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 1, '**Videos** come from YouTube, Facebook or Vimeo, and **maps** from Google Maps. Nothing from them loads until you press play or choose to show the map.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 2, '**Links** to social media, Substack and other sites take you to those sites, which follow their own rules.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 3, '**Staff sign-in** can use a Google account on our own domain.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 4, '**Files attached to requests** are stored in our Google Workspace (Google Drive), and our staff may be told of a new request by email through it.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 15, 'paragraph', 'This site runs on a server we rent and manage ourselves; your information is stored there, not with an outside website service, apart from request files as above.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 16, 'heading', 'Cookies and browser storage');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 17, 'paragraph', '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](https://plausible.io), which we host ourselves on our own server using its free, open-source [Community Edition](https://github.com/plausible/community-edition/): 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:');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 18, 'list', NULL);
CREATE TEMP TABLE IF NOT EXISTS _list (id INTEGER);
DELETE FROM _list;
INSERT INTO _list (id) VALUES (last_insert_rowid());
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 0, 'That you closed the announcement banner or the privacy notice.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 1, 'Whether you chose the light or dark look.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 2, 'Your accessibility choices: the dyslexia-friendly font, reading mode and color blind mode.');
INSERT INTO content_block_items (block_id, sort_order, text) VALUES ((SELECT id FROM _list), 3, 'For staff who sign in: a sign-in cookie that keeps you signed in, and a short-lived one used while signing in with Google.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 19, 'paragraph', 'None of these are shared with anyone. If you press play on a video or show a map, that service (YouTube, Facebook, Vimeo or Google) may set its own cookies from then on. You can clear all of this in your browser''s settings at any time.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 20, 'heading', 'Your choices');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 21, 'paragraph', 'You can ask to see the information we hold about you, to correct it, or to have it deleted. To do that, ' || (CASE WHEN (SELECT privacy_email FROM site_settings WHERE id = 'site') IS NOT NULL THEN 'email [' || (SELECT privacy_email FROM site_settings WHERE id = 'site') || '](mailto:' || (SELECT privacy_email FROM site_settings WHERE id = 'site') || ') or use the ' ELSE 'use the ' END) || '[request form](#requests) below. We may ask you to confirm it''s you before we change or delete anything, and we''ll tell you when it''s done. Some records we may need to keep, such as records of gifts that the law requires; if so, we''ll say which and why.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 22, 'heading', 'Changes to this policy');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'privacy' AND anchor = 'privacy'), 'body', 23, 'paragraph', 'If we change how we handle information, we''ll update this page and the date at the top. See also our [Terms of Service](/terms).');
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, preset) VALUES ('privacy', 1, 'requests', 'Data requests', 'Ask to see, correct or delete the information we hold about you.', 'data_request_form');
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, preset) VALUES ('terms', 0, 'terms', 'Terms of Service', 'Last updated: September 28, 2026', NULL);
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 0, 'heading', 'Using this site');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 1, 'paragraph', 'This website belongs to Next Generation of Unity (NGU). By using it you agree to these terms. If you don''t agree, please don''t use the site.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 2, 'paragraph', 'You''re welcome to read, share and link to anything here. Please don''t try to break or overload the site, get into parts of it you haven''t been given access to, or use it to break the law.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 3, 'heading', 'Our content');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 4, 'paragraph', 'The words, logos, photos and videos on this site belong to NGU or to the people who made them, and are used with permission. You can share them for personal and non-commercial use with credit to NGU. For anything else, including using our name or logo, ask us first.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 5, 'heading', 'What you send us');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 6, 'paragraph', 'When you send feedback or a request, you let us use it to answer you and to improve the site and our programs. Please don''t send anything unlawful, abusive, or someone else''s private information.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 7, 'heading', 'Programs, events and giving');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 8, 'paragraph', 'Dates, places and details of retreats and other events can change. The event''s organizers have the final word, and registering for an event may come with its own terms.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 9, 'paragraph', 'Gifts are made through Church Center (Planning Center), under its terms. Questions about a gift can come to us.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 10, 'heading', 'Other sites');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 11, 'paragraph', 'We link to and show videos, maps and posts from other sites. We don''t control them and aren''t responsible for what they say or do; their own terms and privacy policies apply.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 12, 'heading', 'Staff accounts');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 13, 'paragraph', 'Accounts for editing the site are for NGU staff and volunteers we''ve set up. Keep your password and sign-in to yourself. We can change or close an account at any time.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 14, 'heading', 'No guarantees');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 15, 'paragraph', 'We work to keep this site accurate and running, but it''s provided as it is, without guarantees that it will always be available, complete or free of mistakes. To the extent the law allows, NGU isn''t liable for losses that come from using it.');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 16, 'heading', 'Changes');
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) VALUES ('page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'terms' AND anchor = 'terms'), 'body', 17, 'paragraph', 'We may update these terms; the date at the top says when they last changed. How we handle personal information is in our [Privacy Policy](/privacy), and you can reach us through the [feedback form](/feedback).');
DROP TABLE IF EXISTS _list;
ALTER TABLE site_settings DROP COLUMN privacy_email;

View file

@ -0,0 +1,435 @@
-- ═══════════════════════════════════════════════════════════════
-- 083 SECTION SETTINGS, AND THE FRONT PAGE AS SECTIONS
--
-- A section type that needs more than its blocks keeps its settings
-- in a table of its own, one row per section (and its lists in
-- tables under the section), so it can go on any page with content
-- of its own. The admin engine reads and writes them as the section's
-- own side tables (admin-crud.js, a child's extensions):
--
-- section_hero a hero: words, buttons, backdrop, feature
-- section_slides its photos
-- section_countdown a countdown: the pinned event, or the next
-- one of a scope and type
-- section_stats a stats band's numbers
-- section_paths a pathfinder's paths
-- section_path_actions each path's links
-- section_featured featured cards' columns (the cards are
-- featured_cards owned by 'page_section')
-- section_blog a Community blog's headings and slots
-- section_blog_posts its pinned posts of ours
-- section_feeds the feeds its community posts come from
-- (its pinned community posts are
-- featured_cards owned by 'page_section')
--
-- page_sections gets is_hidden (any section can be left out without
-- deleting it, as the front page's bands could), and a title of up
-- to 60 characters on the front page, which has no side nav; 30
-- elsewhere. The table is rebuilt for that.
--
-- Then what was the front page's own (front_page and its lists, 012
-- to 074) becomes the home page's sections: the hero first, then
-- each band in its order, hidden ones kept hidden; and the Community
-- page's blog settings (community_page) move into its blog section.
-- Those tables go. A timeline section whose view is 'carousel' is
-- the rail of featured moments the front page showed; the full
-- timeline otherwise.
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE page_sections_new (
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), 60 on the front page."
CHECK (length(title) <= CASE WHEN page_id = 'home' THEN 60 ELSE 30 END),
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', 'people_directory',
'feedback_form', 'request_form', 'data_request_form', 'giving', 'qr_maker',
'hero', 'countdown', 'calendar', 'stats', 'featured_cards', 'connect')),
-- 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')),
-- Organization cards (067): the kinds listed by themselves.
org_kinds TEXT CHECK (org_kinds IN ('partner', 'ministry', 'partner,ministry')),
is_hidden INTEGER NOT NULL DEFAULT 0 CHECK (is_hidden IN (0, 1)),
UNIQUE (page_id, anchor)
) STRICT;
INSERT INTO page_sections_new
(id, page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view, org_kinds)
SELECT id, page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view, org_kinds
FROM page_sections;
PRAGMA legacy_alter_table = ON;
DROP TABLE page_sections;
ALTER TABLE page_sections_new RENAME TO page_sections;
PRAGMA legacy_alter_table = OFF;
CREATE INDEX page_sections_page_idx ON page_sections (page_id, sort_order);
-- ── The settings tables ──────────────────────────────────────────
CREATE TABLE section_hero (
section_id INTEGER PRIMARY KEY REFERENCES page_sections (id) ON DELETE CASCADE,
eyebrow TEXT,
headline TEXT,
subhead TEXT,
primary_label TEXT,
primary_url TEXT,
secondary_label TEXT,
secondary_url TEXT,
backdrop TEXT NOT NULL DEFAULT 'brand' CHECK (backdrop IN ('brand', 'photos')),
slide_seconds INTEGER NOT NULL DEFAULT 7 CHECK (slide_seconds BETWEEN 3 AND 60),
feature TEXT NOT NULL DEFAULT 'none' CHECK (feature IN ('none', 'livestream', 'video', 'event')),
livestream_url TEXT,
livestream_title TEXT,
video_url TEXT,
video_title TEXT,
video_captions TEXT,
video_still TEXT,
event_id TEXT REFERENCES events (id) ON DELETE SET NULL
) STRICT;
CREATE TABLE section_slides (
id INTEGER PRIMARY KEY AUTOINCREMENT,
section_id INTEGER NOT NULL REFERENCES page_sections (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
media TEXT NOT NULL,
alt TEXT,
caption TEXT,
link_url TEXT
) STRICT;
CREATE INDEX section_slides_section_idx ON section_slides (section_id, sort_order);
CREATE TABLE section_countdown (
section_id INTEGER PRIMARY KEY REFERENCES page_sections (id) ON DELETE CASCADE,
event_id TEXT REFERENCES events (id) ON DELETE SET NULL,
scope_id TEXT REFERENCES event_scopes (id) ON DELETE SET NULL,
event_type TEXT CHECK (event_type IN ('retreat', 'class', 'workshop', 'meeting', 'other'))
) STRICT;
CREATE TABLE section_stats (
id INTEGER PRIMARY KEY AUTOINCREMENT,
section_id INTEGER NOT NULL REFERENCES page_sections (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
label TEXT NOT NULL,
source TEXT NOT NULL DEFAULT 'manual'
CHECK (source IN ('manual', 'years_since', 'regions', 'groups',
'partners', 'events_held', 'retreats_held',
'people', 'awards_given')),
value TEXT,
suffix TEXT,
note TEXT
) STRICT;
CREATE INDEX section_stats_section_idx ON section_stats (section_id, sort_order);
CREATE TABLE section_paths (
id INTEGER PRIMARY KEY AUTOINCREMENT,
section_id INTEGER NOT NULL REFERENCES page_sections (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
label TEXT NOT NULL,
icon TEXT,
blurb TEXT
) STRICT;
CREATE INDEX section_paths_section_idx ON section_paths (section_id, sort_order);
CREATE TABLE section_path_actions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
path_id INTEGER NOT NULL REFERENCES section_paths (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
label TEXT NOT NULL,
description TEXT,
url TEXT NOT NULL
) STRICT;
CREATE INDEX section_path_actions_path_idx ON section_path_actions (path_id, sort_order);
CREATE TABLE section_featured (
section_id INTEGER PRIMARY KEY REFERENCES page_sections (id) ON DELETE CASCADE,
columns INTEGER CHECK (columns IN (2, 3, 4))
) STRICT;
CREATE TABLE section_blog (
section_id INTEGER PRIMARY KEY REFERENCES page_sections (id) ON DELETE CASCADE,
internal_title TEXT,
internal_slots INTEGER NOT NULL DEFAULT 3 CHECK (internal_slots BETWEEN 0 AND 12),
external_title TEXT,
external_slots INTEGER NOT NULL DEFAULT 3 CHECK (external_slots BETWEEN 0 AND 12),
external_url TEXT,
external_label TEXT
) STRICT;
CREATE TABLE section_blog_posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
section_id INTEGER NOT NULL REFERENCES page_sections (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
post_id TEXT NOT NULL REFERENCES blog_posts (id) ON DELETE CASCADE
) STRICT;
CREATE INDEX section_blog_posts_section_idx ON section_blog_posts (section_id, sort_order);
CREATE TABLE section_feeds (
id INTEGER PRIMARY KEY AUTOINCREMENT,
section_id INTEGER NOT NULL REFERENCES page_sections (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
url TEXT NOT NULL,
label TEXT
) STRICT;
CREATE INDEX section_feeds_section_idx ON section_feeds (section_id, sort_order);
-- ── featured_cards: owned by a section ───────────────────────────
CREATE TABLE featured_cards_new (
id INTEGER PRIMARY KEY AUTOINCREMENT,
owner_kind TEXT NOT NULL CHECK (owner_kind IN ('page_section', 'organization')),
owner_id TEXT NOT NULL,
sort_order INTEGER NOT NULL DEFAULT 0,
kind TEXT NOT NULL DEFAULT 'link'
CHECK (kind IN ('record', 'link', 'video')),
ref_kind TEXT CHECK (ref_kind IN ('event', 'organization', 'person', 'team', 'award')),
ref_id TEXT,
url TEXT,
eyebrow TEXT,
title TEXT,
blurb TEXT,
image TEXT,
size TEXT CHECK (size IN ('normal', 'wide', 'tall', 'large')),
CHECK ((ref_kind IS NULL) = (ref_id IS NULL)),
CONSTRAINT "A record card needs a record to point at."
CHECK (kind != 'record' OR ref_kind IS NOT NULL),
CONSTRAINT "A link or video card needs a URL."
CHECK (kind = 'record' OR url IS NOT NULL)
) STRICT;
-- ── The Community blog into its section ──────────────────────────
INSERT INTO section_blog (section_id, internal_title, internal_slots, external_title, external_slots, external_url, external_label)
SELECT s.id, c.internal_title, c.internal_slots, c.external_title, c.external_slots, c.external_url, c.external_label
FROM page_sections s, community_page c
WHERE s.page_id = 'community' AND s.preset = 'community_blog' AND c.id = 'community';
INSERT INTO section_blog_posts (section_id, sort_order, post_id)
SELECT s.id, p.sort_order, p.post_id
FROM page_sections s JOIN community_page_pinned_posts p ON p.page_id = 'community'
WHERE s.page_id = 'community' AND s.preset = 'community_blog';
INSERT INTO section_feeds (section_id, sort_order, url, label)
SELECT s.id, f.sort_order, f.url, f.label
FROM page_sections s JOIN community_page_feeds f ON f.page_id = 'community'
WHERE s.page_id = 'community' AND s.preset = 'community_blog';
INSERT INTO featured_cards_new
(owner_kind, owner_id, sort_order, kind, ref_kind, ref_id, url, eyebrow, title, blurb, image, size)
SELECT 'page_section', CAST(s.id AS TEXT), f.sort_order, f.kind, f.ref_kind, f.ref_id, f.url, f.eyebrow, f.title, f.blurb, f.image, f.size
FROM featured_cards f
JOIN page_sections s ON s.page_id = 'community' AND s.preset = 'community_blog'
WHERE f.owner_kind = 'community_page'
AND s.id = (SELECT min(id) FROM page_sections WHERE page_id = 'community' AND preset = 'community_blog');
-- ── The front page into the home page's sections ─────────────────
-- The hero first.
INSERT INTO page_sections (page_id, sort_order, anchor, title, preset)
VALUES ('home', 0, 'hero', 'Welcome', 'hero');
INSERT INTO section_hero
(section_id, eyebrow, headline, subhead, primary_label, primary_url, secondary_label, secondary_url,
backdrop, slide_seconds, feature, livestream_url, livestream_title, video_url, video_title,
video_captions, video_still, event_id)
SELECT (SELECT id FROM page_sections WHERE page_id = 'home' AND anchor = 'hero'),
eyebrow, headline, subhead, primary_label, primary_url, secondary_label, secondary_url,
hero_backdrop, slide_seconds, hero_feature, livestream_url, livestream_title, video_url, video_title,
video_captions, video_still, hero_event_id
FROM front_page WHERE id = 'home';
INSERT INTO section_slides (section_id, sort_order, media, alt, caption, link_url)
SELECT (SELECT id FROM page_sections WHERE page_id = 'home' AND anchor = 'hero'), sort_order, media, alt, caption, link_url
FROM front_page_slides WHERE page_id = 'home';
-- A featured band, hidden, when the front page has cards but no band
-- for them, so they aren't lost.
INSERT INTO front_page_sections (page_id, sort_order, section, is_hidden)
SELECT 'home', 99, 'featured', 1
WHERE NOT EXISTS (SELECT 1 FROM front_page_sections WHERE page_id = 'home' AND section = 'featured')
AND EXISTS (SELECT 1 FROM featured_cards WHERE owner_kind = 'front_page');
-- Each band, in its order: its section type, anchor and heading.
INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, preset, scope_id, event_type, view, is_hidden)
SELECT 'home',
b.sort_order + 1,
CASE b.section
WHEN 'countdown' THEN 'next-up'
WHEN 'stats' THEN 'numbers'
WHEN 'timeline' THEN 'story'
ELSE b.section
END,
substr(COALESCE(b.title, CASE b.section
WHEN 'countdown' THEN 'Next up'
WHEN 'retreats' THEN 'National Retreats'
WHEN 'calendar' THEN 'What''s on'
WHEN 'stats' THEN 'By the numbers'
WHEN 'timeline' THEN 'Our story so far'
WHEN 'connect' THEN 'Find your way in'
ELSE 'Featured'
END), 1, 60),
b.blurb,
CASE b.section
WHEN 'retreats' THEN 'events'
WHEN 'featured' THEN 'featured_cards'
ELSE b.section
END,
CASE WHEN b.section = 'retreats' THEN 'national' END,
CASE WHEN b.section = 'retreats' THEN 'retreat' END,
CASE WHEN b.section IN ('retreats', 'timeline') THEN 'carousel' END,
b.is_hidden
FROM front_page_sections b
WHERE b.page_id = 'home'
ORDER BY b.sort_order;
-- The retreats band's link through to the Retreats page, as a button
-- above its carousel.
INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text, href)
SELECT 'page_section', CAST(id AS TEXT), 'body', 0, 'button', 'All retreats', '/retreats'
FROM page_sections WHERE page_id = 'home' AND anchor = 'retreats';
INSERT INTO section_countdown (section_id, event_id, scope_id, event_type)
SELECT (SELECT id FROM page_sections WHERE page_id = 'home' AND preset = 'countdown'),
countdown_event_id, countdown_scope_id, countdown_event_type
FROM front_page
WHERE id = 'home' AND EXISTS (SELECT 1 FROM page_sections WHERE page_id = 'home' AND preset = 'countdown');
INSERT INTO section_stats (section_id, sort_order, label, source, value, suffix, note)
SELECT (SELECT id FROM page_sections WHERE page_id = 'home' AND preset = 'stats'),
sort_order, label, source, value, suffix, note
FROM front_page_stats
WHERE page_id = 'home' AND EXISTS (SELECT 1 FROM page_sections WHERE page_id = 'home' AND preset = 'stats');
INSERT INTO section_paths (id, section_id, sort_order, label, icon, blurb)
SELECT id, (SELECT id FROM page_sections WHERE page_id = 'home' AND preset = 'connect'),
sort_order, label, icon, blurb
FROM front_page_paths
WHERE page_id = 'home' AND EXISTS (SELECT 1 FROM page_sections WHERE page_id = 'home' AND preset = 'connect');
INSERT INTO section_path_actions (path_id, sort_order, label, description, url)
SELECT a.path_id, a.sort_order, a.label, a.description, a.url
FROM front_page_path_actions a
WHERE a.path_id IN (SELECT id FROM section_paths);
INSERT INTO section_featured (section_id, columns)
SELECT (SELECT id FROM page_sections WHERE page_id = 'home' AND preset = 'featured_cards'), featured_columns
FROM front_page
WHERE id = 'home' AND EXISTS (SELECT 1 FROM page_sections WHERE page_id = 'home' AND preset = 'featured_cards');
INSERT INTO featured_cards_new
(owner_kind, owner_id, sort_order, kind, ref_kind, ref_id, url, eyebrow, title, blurb, image, size)
SELECT 'page_section', (SELECT CAST(id AS TEXT) FROM page_sections WHERE page_id = 'home' AND preset = 'featured_cards'),
sort_order, kind, ref_kind, ref_id, url, eyebrow, title, blurb, image, size
FROM featured_cards
WHERE owner_kind = 'front_page'
AND EXISTS (SELECT 1 FROM page_sections WHERE page_id = 'home' AND preset = 'featured_cards');
-- An organization's own cards (072) come along as they are.
INSERT INTO featured_cards_new
(id, owner_kind, owner_id, sort_order, kind, ref_kind, ref_id, url, eyebrow, title, blurb, image, size)
SELECT id, owner_kind, owner_id, sort_order, kind, ref_kind, ref_id, url, eyebrow, title, blurb, image, size
FROM featured_cards WHERE owner_kind = 'organization';
-- Drafts of what's gone: the Front page editor is the home page's now.
DELETE FROM drafts WHERE entity = 'front_page';
-- ── What's gone ──────────────────────────────────────────────────
-- The cleanup triggers on events, people, teams, awards and
-- organizations name featured_cards; legacy mode leaves them alone
-- through the rename.
PRAGMA legacy_alter_table = ON;
DROP TABLE featured_cards;
ALTER TABLE featured_cards_new RENAME TO featured_cards;
PRAGMA legacy_alter_table = OFF;
CREATE INDEX featured_cards_owner_idx ON featured_cards (owner_kind, owner_id, sort_order);
DROP TABLE front_page_path_actions;
DROP TABLE front_page_paths;
DROP TABLE front_page_stats;
DROP TABLE front_page_slides;
DROP TABLE front_page_sections;
DROP TABLE front_page;
DROP TABLE community_page_pinned_posts;
DROP TABLE community_page_feeds;
DROP TABLE community_page;
-- ── Triggers, last ───────────────────────────────────────────────
-- A section's blocks and its featured cards go with it.
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);
DELETE FROM featured_cards WHERE owner_kind = 'page_section' AND owner_id = CAST(old.id AS TEXT);
END;
CREATE TRIGGER featured_cards_owner_exists
BEFORE INSERT ON featured_cards
BEGIN
SELECT CASE
WHEN new.owner_kind = 'organization'
AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id)
THEN RAISE(ABORT, 'featured_cards: no such organization')
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, 'featured_cards: no such page section')
END;
END;
CREATE TRIGGER featured_cards_ref_exists
BEFORE INSERT ON featured_cards
BEGIN
SELECT CASE
WHEN new.ref_kind = 'event'
AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such event')
WHEN new.ref_kind = 'organization'
AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such organization')
WHEN new.ref_kind = 'person'
AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such person')
WHEN new.ref_kind = 'team'
AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such team')
WHEN new.ref_kind = 'award'
AND NOT EXISTS (SELECT 1 FROM awards WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such award')
END;
END;
CREATE TRIGGER featured_cards_ref_exists_update
BEFORE UPDATE OF ref_kind, ref_id ON featured_cards
BEGIN
SELECT CASE
WHEN new.ref_kind = 'event'
AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such event')
WHEN new.ref_kind = 'organization'
AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such organization')
WHEN new.ref_kind = 'person'
AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such person')
WHEN new.ref_kind = 'team'
AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such team')
WHEN new.ref_kind = 'award'
AND NOT EXISTS (SELECT 1 FROM awards WHERE id = new.ref_id)
THEN RAISE(ABORT, 'featured_cards: no such award')
END;
END;

View file

@ -0,0 +1,37 @@
-- ═══════════════════════════════════════════════════════════════
-- 084 ROTATING WORDS
--
-- A word typed as {Next|Now|Rising} in a title or text cycles
-- through its choices (src/components/RotatingWords.tsx). How it
-- moves:
--
-- word_motion slide, flip, fade, type or mirror
-- word_direction top or bottom: where a sliding or flipping word
-- comes from
-- word_seconds how long each word shows, 1 to 20
--
-- Site settings hold the defaults (null: slide, from the bottom, 3
-- seconds); a hero and a content block can each set their own, null
-- keeping the site's.
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE site_settings ADD COLUMN word_motion TEXT
CHECK (word_motion IN ('slide', 'flip', 'fade', 'type', 'mirror'));
ALTER TABLE site_settings ADD COLUMN word_direction TEXT
CHECK (word_direction IN ('top', 'bottom'));
ALTER TABLE site_settings ADD COLUMN word_seconds INTEGER
CHECK (word_seconds BETWEEN 1 AND 20);
ALTER TABLE section_hero ADD COLUMN word_motion TEXT
CHECK (word_motion IN ('slide', 'flip', 'fade', 'type', 'mirror'));
ALTER TABLE section_hero ADD COLUMN word_direction TEXT
CHECK (word_direction IN ('top', 'bottom'));
ALTER TABLE section_hero ADD COLUMN word_seconds INTEGER
CHECK (word_seconds BETWEEN 1 AND 20);
ALTER TABLE content_blocks ADD COLUMN word_motion TEXT
CHECK (word_motion IN ('slide', 'flip', 'fade', 'type', 'mirror'));
ALTER TABLE content_blocks ADD COLUMN word_direction TEXT
CHECK (word_direction IN ('top', 'bottom'));
ALTER TABLE content_blocks ADD COLUMN word_seconds INTEGER
CHECK (word_seconds BETWEEN 1 AND 20);

View file

@ -0,0 +1,17 @@
-- ═══════════════════════════════════════════════════════════════
-- 085 PLANNING CENTER
--
-- Data → Planning Center brings one Planning Center People list into
-- the site's people, by hand (planningCenter.js, routes/pco.js):
--
-- people.pco_id the Planning Center person a record is
-- linked to, once an admin confirms the
-- match; one record each
-- site_settings.pco_list_id which list (Site settings → Planning
-- Center), eg. 1234567
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE people ADD COLUMN pco_id TEXT;
CREATE UNIQUE INDEX people_pco_id_idx ON people (pco_id) WHERE pco_id IS NOT NULL;
ALTER TABLE site_settings ADD COLUMN pco_list_id TEXT;

View file

@ -14,16 +14,17 @@
── Where it comes from ── ── Where it comes from ──
/site.json (SITE_CONFIG): the site's name, address, default /site.json (SITE_CONFIG): the site's name, address, default
description and image, icons, and each static page's title and description and image, icons, and each static page's title and
description. Laid over it: Panel → Site settings (the default description and image, and icons. Laid over it: Panel →
site_settings table, 035) and Pages → Navigation's page titles Site settings (the site_settings table, 035), where anything set
(site_nav_pages, 075), where anything set wins and anything wins and anything blank falls back to site.json. siteFor(db) does
blank falls back to site.json. siteFor(db) does the merge. The the merge. Each page's title and intro are its site_pages row's
(Pages → Page management, 080). The
pages read the same merged values (renderPage writes them into pages read the same merged values (renderPage writes them into
the HTML as window.__SITE__, see src/lib/site.ts), so a the HTML as window.__SITE__, see src/lib/site.ts), so a
heading and its search title can't drift. heading and its search title can't drift.
The database: records' names, taglines, first paragraphs and The database: records' names, taglines, first paragraphs and
images. A blank site description falls back to the front page's images. A blank site description falls back to the front page's
subhead. hero's subhead.
── Rules ── ── Rules ──
published, listed indexed, in the sitemap published, listed indexed, in the sitemap
@ -47,7 +48,7 @@ import { fileURLToPath } from "node:url";
import { loadBlocks, paragraphs } from "./shape.js"; import { loadBlocks, paragraphs } from "./shape.js";
import { themeCss } from "./theme.js"; import { themeCss } from "./theme.js";
import { driveReady } from "./googleService.js"; import { driveReady } from "./googleService.js";
import { hiddenFrom, hiddenPaths, navFor } from "./siteNav.js"; import { allPages, hiddenFrom, navFor, pageAt } from "./siteNav.js";
const here = path.dirname(fileURLToPath(import.meta.url)); const here = path.dirname(fileURLToPath(import.meta.url));
@ -75,24 +76,15 @@ const origin = (site) => (site.url ?? "").replace(/\/$/, "");
/* site.json with the admin's Site settings laid over it: a value set /* site.json with the admin's Site settings laid over it: a value set
there wins, a blank one falls back. indexing 'on' / 'off' overrides there wins, a blank one falls back. indexing 'on' / 'off' overrides
robots.index for this database only. Page overrides (Pages → robots.index for this database only. pages: every page's title
Navigation) apply only to pages site.json knows. */ and intro, by path (site_pages). */
export function siteFor(db) { export function siteFor(db) {
const base = loadSite(); const base = loadSite();
const row = db.prepare(`SELECT * FROM site_settings WHERE id = 'site'`).get() ?? {}; const row = db.prepare(`SELECT * FROM site_settings WHERE id = 'site'`).get() ?? {};
const pages = { ...(base.pages ?? {}) }; const pages = Object.fromEntries(
const overrides = db allPages(db).map((page) => [page.path, { title: page.title, description: page.description ?? "" }]),
.prepare(`SELECT path, title, description FROM site_nav_pages WHERE nav_id = 'site'`) );
.all();
for (const page of overrides) {
const known = pages[page.path];
if (!known) continue;
pages[page.path] = {
title: page.title || known.title,
description: page.description || known.description,
};
}
return { return {
...base, ...base,
@ -108,7 +100,8 @@ export function siteFor(db) {
...base.robots, ...base.robots,
index: row.indexing ? row.indexing === "on" : base.robots?.index !== false, index: row.indexing ? row.indexing === "on" : base.robots?.index !== false,
}, },
privacyEmail: row.privacy_email || base.privacyEmail || "", // Rotating words' defaults (084): blank is the app's own.
words: { motion: row.word_motion ?? null, direction: row.word_direction ?? null, seconds: row.word_seconds ?? null },
// The admin's colors (theme.js): only #rrggbb values and fixed // The admin's colors (theme.js): only #rrggbb values and fixed
// text, so safe inside <style>. // text, so safe inside <style>.
themeCss: themeCss(db), themeCss: themeCss(db),
@ -122,8 +115,8 @@ export function siteFor(db) {
const forBrowser = (site, nav) => ({ const forBrowser = (site, nav) => ({
title: site.title, title: site.title,
pages: site.pages, pages: site.pages,
privacyEmail: site.privacyEmail,
requestFiles: driveReady(), requestFiles: driveReady(),
words: site.words,
nav, nav,
}); });
@ -148,6 +141,8 @@ export function plainText(text) {
const flat = String(text) const flat = String(text)
.slice(0, 2000) .slice(0, 2000)
.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1") .replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
// Rotating words ({Next|Now}, 084): the first.
.replace(/\{([^{}|\n]+)(?:\|[^{}|\n]+)+\}/g, "$1")
.replace(/\*\*(.+?)\*\*/g, "$1") .replace(/\*\*(.+?)\*\*/g, "$1")
.replace(/\*(.+?)\*/g, "$1") .replace(/\*(.+?)\*/g, "$1")
.replace(/\s+/g, " ") .replace(/\s+/g, " ")
@ -177,8 +172,18 @@ function firstParagraph(db, ownerKind, id, slot) {
const ORG_ROUTES = { region: "/regions", group: "/groups", partner: "/partners", national: "/organizations" }; const ORG_ROUTES = { region: "/regions", group: "/groups", partner: "/partners", national: "/organizations" };
/* The front page's first hero (083): its subhead is the site's
description when Site settings and site.json have none. */
const homeHero = (db) =>
db
.prepare(
`SELECT h.* FROM section_hero h JOIN page_sections s ON s.id = h.section_id
WHERE s.page_id = 'home' AND s.is_hidden = 0 ORDER BY s.sort_order LIMIT 1`,
)
.get();
function defaults(site, db, pathname) { function defaults(site, db, pathname) {
const home = db.prepare(`SELECT headline, subhead FROM front_page WHERE id = 'home'`).get(); const home = homeHero(db);
return { return {
status: 200, status: 200,
title: site.title, title: site.title,
@ -380,18 +385,16 @@ export function metaFor(db, rawPath, user = null) {
// The home page's data, and its first hero photo when the hero is // The home page's data, and its first hero photo when the hero is
// a slideshow, requested alongside the app's JavaScript instead of // a slideshow, requested alongside the app's JavaScript instead of
// after it has run. // after it has run.
const hero = db.prepare(`SELECT hero_backdrop FROM front_page WHERE id = 'home'`).get(); const hero = homeHero(db);
const slide = const slide =
hero?.hero_backdrop === "photos" hero?.backdrop === "photos"
? db ? db.prepare(`SELECT media FROM section_slides WHERE section_id = ? ORDER BY sort_order LIMIT 1`).get(hero.section_id)
.prepare(`SELECT media FROM front_page_slides WHERE page_id = 'home' ORDER BY sort_order LIMIT 1`)
.get()
: null; : null;
const slideSrc = slide?.media ? (/^(https?:|\/)/.test(slide.media) ? slide.media : `${UPLOADS}/${slide.media}`) : null; const slideSrc = slide?.media ? (/^(https?:|\/)/.test(slide.media) ? slide.media : `${UPLOADS}/${slide.media}`) : null;
return { return {
...meta, ...meta,
preload: [ preload: [
{ href: "/api/front-page", as: "fetch" }, { href: "/api/site-pages/home", as: "fetch" },
...(slideSrc ? [{ href: slideSrc, as: "image" }] : []), ...(slideSrc ? [{ href: slideSrc, as: "image" }] : []),
], ],
jsonLd: { jsonLd: {
@ -410,10 +413,17 @@ export function metaFor(db, rawPath, user = null) {
// in particular, so never indexed or in the sitemap. // in particular, so never indexed or in the sitemap.
if (ACCOUNT_PAGES[pathname]) return { ...meta, title: titled(site, ACCOUNT_PAGES[pathname]), noindex: true }; if (ACCOUNT_PAGES[pathname]) return { ...meta, title: titled(site, ACCOUNT_PAGES[pathname]), noindex: true };
const page = site.pages?.[pathname]; // A page of the site (site_pages): hidden is Not found below
// viewer; disabled stays out of search.
const page = pageAt(db, pathname);
if (page && hiddenFrom(db, user, pathname)) return notFound(meta); if (page && hiddenFrom(db, user, pathname)) return notFound(meta);
if (page) { if (page) {
return { ...meta, title: titled(site, page.title), description: plainText(page.description) ?? meta.description }; return {
...meta,
title: titled(site, page.title),
description: plainText(page.description) ?? meta.description,
noindex: page.is_disabled === 1,
};
} }
// An event's schedule presentation (SchedulePresent.tsx): the // An event's schedule presentation (SchedulePresent.tsx): the
@ -558,13 +568,13 @@ export function sitemap(db) {
const site = siteFor(db); const site = siteFor(db);
const base = origin(site); const base = origin(site);
const day = (value) => (value ? String(value).slice(0, 10) : null); const day = (value) => (value ? String(value).slice(0, 10) : null);
const hidden = hiddenPaths(db);
const entries = [ const entries = [
{ loc: "/" }, { loc: "/" },
...Object.keys(site.pages ?? {}) // Pages that are neither hidden nor disabled.
.filter((loc) => !hidden.has(loc)) ...allPages(db)
.map((loc) => ({ loc })), .filter((page) => page.path !== "/" && page.is_hidden !== 1 && page.is_disabled !== 1)
.map((page) => ({ loc: page.path })),
...db ...db
.prepare(`SELECT id, updated_at FROM events WHERE is_published = 1 AND is_listed = 1`) .prepare(`SELECT id, updated_at FROM events WHERE is_published = 1 AND is_listed = 1`)
.all() .all()

View file

@ -0,0 +1,199 @@
/* ═══════════════════════════════════════════════════════════════
PLANNING CENTER
One Planning Center People list into the site's people, by hand:
Data → Planning Center (routes/pco.js) asks for the comparison,
an admin reviews it, and only what they apply is written. Planning
Center wins where both sides have a value. One way only: nothing
is sent back.
name → people.display_name, and sort_name ("Last, First")
email → person_private.private_email (the primary one)
phone → person_private.private_phone (the primary one)
A person is matched by the Planning Center id it was linked to
(people.pco_id, 085), else suggested by the same private or public
email, else the same name; an admin confirms each suggestion, picks
another person, or makes a new one, unpublished.
PCO_APP_ID a personal access token's application id
PCO_SECRET and its secret (api.planningcenteronline.com →
Personal Access Tokens); never in the repo
PCO_BASE default https://api.planningcenteronline.com
The list is Site settings → Planning Center. Setup:
docs/planning-center.md.
═══════════════════════════════════════════════════════════════ */
const BASE = () => (process.env.PCO_BASE ?? "https://api.planningcenteronline.com").replace(/\/$/, "");
const MAX_PAGES = 50; // 100 a page: a list of 5,000 is plenty
export const pcoReady = () => Boolean(process.env.PCO_APP_ID && process.env.PCO_SECRET);
export class PcoError extends Error {}
async function call(url) {
const auth = Buffer.from(`${process.env.PCO_APP_ID}:${process.env.PCO_SECRET}`).toString("base64");
let res;
try {
res = await fetch(url, { headers: { Authorization: `Basic ${auth}`, Accept: "application/json" }, signal: AbortSignal.timeout(20_000) });
} catch {
throw new PcoError("Couldn't reach Planning Center.");
}
if (res.status === 401) throw new PcoError("Planning Center refused the token (PCO_APP_ID and PCO_SECRET).");
if (res.status === 404) throw new PcoError("Planning Center has no such list. Check Site settings → Planning Center.");
if (!res.ok) throw new PcoError(`Planning Center answered ${res.status}.`);
return res.json();
}
/* Everyone on the list: { id, first, last, name, email, phone }. */
export async function listPeople(listId) {
if (!pcoReady()) throw new PcoError("Planning Center isn't set up on the server (PCO_APP_ID, PCO_SECRET).");
if (!/^\d+$/.test(String(listId ?? ""))) throw new PcoError("Pick a list in Site settings → Planning Center (its number).");
const people = [];
let url = `${BASE()}/people/v2/lists/${listId}/people?include=emails,phone_numbers&per_page=100`;
for (let page = 0; url && page < MAX_PAGES; page++) {
const body = await call(url);
const included = new Map((body.included ?? []).map((row) => [`${row.type}:${row.id}`, row]));
for (const row of body.data ?? []) {
const pick = (type, key) => {
const rows = (row.relationships?.[key]?.data ?? []).map((ref) => included.get(`${type}:${ref.id}`)).filter(Boolean);
const main = rows.find((r) => r.attributes?.primary) ?? rows[0];
return main?.attributes ?? null;
};
const a = row.attributes ?? {};
const first = (a.nickname || a.first_name || "").trim();
const last = (a.last_name || "").trim();
people.push({
id: String(row.id),
first,
last,
name: [first, last].filter(Boolean).join(" ") || (a.name ?? "").trim(),
email: pick("Email", "emails")?.address?.trim().toLowerCase() || null,
phone: pick("PhoneNumber", "phone_numbers")?.number?.trim() || null,
});
}
url = body.links?.next ?? null;
}
return people;
}
const norm = (value) => String(value ?? "").trim().toLowerCase().replace(/\s+/g, " ");
/* The comparison: each list member with its match (linked, or a
suggestion) and the fields that would change. */
export function compare(db, members) {
const site = db
.prepare(
`SELECT p.id, p.display_name, p.sort_name, p.public_email, p.pco_id,
v.private_email, v.private_phone
FROM people p LEFT JOIN person_private v ON v.person_id = p.id`,
)
.all();
const byPco = new Map(site.filter((p) => p.pco_id).map((p) => [p.pco_id, p]));
const byEmail = new Map();
for (const p of site) {
for (const email of [p.private_email, p.public_email]) if (email) byEmail.set(norm(email), p);
}
const byName = new Map(site.map((p) => [norm(p.display_name), p]));
return members.map((member) => {
let person = byPco.get(member.id);
let how = person ? "linked" : null;
if (!person && member.email && byEmail.get(norm(member.email))) {
person = byEmail.get(norm(member.email));
how = "email";
}
if (!person && byName.get(norm(member.name))) {
person = byName.get(norm(member.name));
how = "name";
}
// A suggestion that's already some other Planning Center person's isn't one.
if (person && how !== "linked" && person.pco_id && person.pco_id !== member.id) {
person = null;
how = null;
}
const sortName = member.last ? `${member.last}, ${member.first}`.replace(/, $/, "") : null;
const changes = person
? [
["display_name", "Name", person.display_name, member.name],
["sort_name", "Sort name", person.sort_name, sortName],
["private_email", "Private email", person.private_email, member.email],
["private_phone", "Private phone", person.private_phone, member.phone],
]
.filter(([, , now, next]) => next && norm(now) !== norm(next))
.map(([field, label, now, next]) => ({ field, label, site: now ?? null, pco: next }))
: [];
return {
pco: member,
match: person ? { person_id: person.id, name: person.display_name, how } : null,
changes,
};
});
}
const slug = (text) =>
String(text ?? "")
.toLowerCase()
.normalize("NFKD")
.replace(/[^\w\s-]/g, "")
.trim()
.replace(/[\s_]+/g, "-")
.replace(/-+/g, "-")
.slice(0, 60) || "person";
function freeId(db, base) {
let id = base;
for (let n = 2; db.prepare(`SELECT 1 FROM people WHERE id = ?`).get(id); n++) id = `${base}-${n}`;
return id;
}
/* Writes what the admin chose, in one transaction (the caller's):
each decision is { pco: member, action: 'link' | 'create',
person_id, update }. Returns counts. */
export function apply(db, decisions) {
const counts = { linked: 0, created: 0, updated: 0 };
const upsertPrivate = db.prepare(
`INSERT INTO person_private (person_id, private_email, private_phone) VALUES (?, ?, ?)
ON CONFLICT (person_id) DO UPDATE
SET private_email = COALESCE(excluded.private_email, private_email),
private_phone = COALESCE(excluded.private_phone, private_phone),
updated_at = datetime('now')`,
);
for (const d of decisions) {
const m = d.pco;
const sortName = m.last ? `${m.last}, ${m.first}`.replace(/, $/, "") : null;
let personId = d.person_id;
if (d.action === "create") {
personId = freeId(db, slug(m.name));
db.prepare(
`INSERT INTO people (id, display_name, sort_name, is_published, is_listed, pco_id) VALUES (?, ?, ?, 0, 1, ?)`,
).run(personId, m.name || "Unnamed", sortName, m.id);
upsertPrivate.run(personId, m.email, m.phone);
counts.created += 1;
continue;
}
if (d.action !== "link" || !personId) continue;
// A link moves: whoever had this Planning Center person lets go.
db.prepare(`UPDATE people SET pco_id = NULL WHERE pco_id = ? AND id <> ?`).run(m.id, personId);
db.prepare(`UPDATE people SET pco_id = ? WHERE id = ?`).run(m.id, personId);
counts.linked += 1;
if (d.update) {
db.prepare(
`UPDATE people SET display_name = COALESCE(?, display_name), sort_name = COALESCE(?, sort_name),
updated_at = datetime('now')
WHERE id = ?`,
).run(m.name || null, sortName, personId);
upsertPrivate.run(personId, m.email, m.phone);
counts.updated += 1;
}
}
return counts;
}

View file

@ -24,13 +24,10 @@
import { Hono } from "hono"; import { Hono } from "hono";
import { asBool, json, loadBlocks, loadFeaturedCards, marks } from "../shape.js"; import { asBool, json, loadBlocks, marks } from "../shape.js";
import { readFeeds } from "../feeds.js";
const blog = new Hono(); const blog = new Hono();
const PAGE_ID = "community";
const splitTags = (tags) => const splitTags = (tags) =>
(tags ?? "") (tags ?? "")
.split(",") .split(",")
@ -38,7 +35,7 @@ const splitTags = (tags) =>
.filter(Boolean); .filter(Boolean);
/* Published authors for a batch of posts, keyed by post id. */ /* Published authors for a batch of posts, keyed by post id. */
function loadAuthors(db, ids) { export function loadAuthors(db, ids) {
const byPost = new Map(); const byPost = new Map();
if (ids.length === 0) return byPost; if (ids.length === 0) return byPost;
const rows = db const rows = db
@ -67,7 +64,7 @@ function loadAuthors(db, ids) {
/* The first paragraph of each post with no excerpt of its own, the /* The first paragraph of each post with no excerpt of its own, the
card's fallback text, by post id. Only that one row per post: a card's fallback text, by post id. Only that one row per post: a
card doesn't need the rest of the body. */ card doesn't need the rest of the body. */
function firstParagraphs(db, rows) { export function firstParagraphs(db, rows) {
const ids = rows.filter((row) => !row.excerpt).map((row) => row.id); const ids = rows.filter((row) => !row.excerpt).map((row) => row.id);
if (ids.length === 0) return new Map(); if (ids.length === 0) return new Map();
const found = db const found = db
@ -84,7 +81,7 @@ function firstParagraphs(db, rows) {
return new Map(found.map((row) => [row.owner_id, row.text])); return new Map(found.map((row) => [row.owner_id, row.text]));
} }
function shapeSummary(row, authors, firstParagraph) { export function shapeSummary(row, authors, firstParagraph) {
return { return {
id: row.id, id: row.id,
title: row.title, title: row.title,
@ -148,83 +145,4 @@ blog.get("/blog/:id", (c) => {
}); });
}); });
/* ── The Community page's section ──────────────────────────── */
blog.get("/community-blog", async (c) => {
const db = c.get("db");
const page = db.prepare(`SELECT * FROM community_page WHERE id = ?`).get(PAGE_ID);
if (!page) return c.json({ error: "The community page hasn't been set up." }, 500);
// Ours: pinned, then newest.
const pinned = db
.prepare(
`SELECT b.*
FROM community_page_pinned_posts pp
JOIN blog_posts b ON b.id = pp.post_id AND b.is_published = 1
WHERE pp.page_id = ?
ORDER BY pp.sort_order`,
)
.all(PAGE_ID);
const room = Math.max(0, page.internal_slots - pinned.length);
const pinnedIds = pinned.map((row) => row.id);
const newest = room
? db
.prepare(
`SELECT * FROM blog_posts
WHERE is_published = 1 AND is_listed = 1
${pinnedIds.length ? `AND id NOT IN (${marks(pinnedIds.length)})` : ""}
ORDER BY published_on IS NULL, published_on DESC, created_at DESC
LIMIT ?`,
)
.all(...pinnedIds, room)
: [];
const posts = [...pinned, ...newest];
const ids = posts.map((row) => row.id);
const authors = loadAuthors(db, ids);
const first = firstParagraphs(db, posts);
// Theirs: pinned cards, then the feeds' newest.
const cards = loadFeaturedCards(db, "community_page", PAGE_ID);
const feedRows = db
.prepare(`SELECT url, label FROM community_page_feeds WHERE page_id = ? ORDER BY sort_order`)
.all(PAGE_ID);
const shown = new Set(cards.map((card) => card.url).filter(Boolean));
const spare = Math.max(0, page.external_slots - cards.length);
const fromFeeds = spare && feedRows.length ? await readFeeds(feedRows) : [];
const latest = fromFeeds
.filter((item) => !shown.has(item.url))
.slice(0, spare)
.map((item) => ({
kind: "link",
ref: null,
url: item.url,
eyebrow: item.source,
title: item.title,
blurb: item.excerpt,
image: item.image ? { file: item.image, kind: "featured" } : null,
published: item.published,
}));
return json(c, {
community_blog: {
internal: {
title: page.internal_title,
posts: posts.map((row) =>
shapeSummary(row, authors.get(row.id) ?? [], first.get(row.id)),
),
},
external: {
title: page.external_title,
url: page.external_url,
label: page.external_label,
cards: [...cards, ...latest],
},
},
});
});
export default blog; export default blog;

View file

@ -1,243 +0,0 @@
/* ═══════════════════════════════════════════════════════════════
FRONT PAGE ROUTE: read-only, mounted under /api
GET /front-page the home page's configuration, resolved
Everything the admin's Front page editor holds, shaped for the
page: hidden sections dropped, stats counted, paths carrying
their actions, and the countdown's event looked up.
The retreats carousel and the timeline rail are not in here.
They fetch /events and /history themselves, as they do on their
own pages, so the rules for which events and entries are public
live in one place each. This route only says whether those bands
appear and under what heading.
── Stats ──
A stat's source picks a query from STAT_QUERIES. Each counts
exactly what the matching public page shows: published, listed
rows, and for awards only public citations to published people
(an award's page names its recipients whether they're listed or
not, so the count does too). A count
that disagreed with the page it summarizes would be worse than
none. 'manual' and 'years_since' read the row's own value.
── Countdown ──
The pinned event if it is still published and not over, listed
or not; otherwise the next published, listed, non-canceled
event that hasn't ended. "Hasn't ended" is COALESCE(ends_on, starts_on) >= today,
so a running series with a start date in the past still counts.
The client works out the next meeting of a series from `series`.
countdown_scope_id and countdown_event_type narrow "the next
event" (National + Retreat skips a sooner regional class). Null
means any. They don't apply to a pinned event: the admin chose
that one by name.
── Hero event ──
With the 'event' feature, the hero draws the pinned hero_event_id
if it's still published and not over, else the countdown's event
(above), so the two never disagree. Its action links ride along
for the card's buttons.
── Featured ──
The featured band's cards, record cards filled in from their
records (loadFeaturedCards in shape.js, which the Community
blog will share).
═══════════════════════════════════════════════════════════════ */
import { Hono } from "hono";
import { asBool, json, loadFeaturedCards, loadLinks, shapeSeries, splitLinks } from "../shape.js";
const home = new Hono();
const PAGE_ID = "home";
const STAT_QUERIES = {
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`,
groups: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'group' AND is_published = 1 AND is_listed = 1`,
partners: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'partner' AND is_published = 1 AND is_listed = 1`,
events_held: `SELECT COUNT(*) AS n FROM v_events
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`,
retreats_held: `SELECT COUNT(*) AS n FROM v_events
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'
AND event_type = 'retreat'`,
people: `SELECT COUNT(*) AS n FROM people WHERE is_published = 1 AND is_listed = 1`,
awards_given: `SELECT COUNT(*) AS n
FROM person_awards pa
JOIN v_people_public p ON p.id = pa.person_id AND p.is_published = 1
JOIN awards a ON a.id = pa.award_id AND a.is_published = 1
WHERE pa.is_public = 1`,
};
/* The number as a string, or null when there's nothing to print:
a manual stat nobody filled in, or a year that isn't one. */
function statValue(db, row) {
if (row.source === "manual") return row.value || null;
if (row.source === "years_since") {
const year = Number.parseInt(row.value ?? "", 10);
if (!Number.isInteger(year)) return null;
return String(Math.max(0, new Date().getFullYear() - year));
}
const sql = STAT_QUERIES[row.source];
return sql ? String(db.prepare(sql).get().n) : null;
}
/* The countdown's fields plus what the hero's event card also draws:
its tagline, place, photo and buttons. */
function shapeHeroEvent(db, row) {
if (!row) return null;
const { actions } = splitLinks(loadLinks(db, "event", [row.id]).get(row.id) ?? []);
return {
...shapeCountdown(row),
tagline: row.tagline,
photo: row.photo,
photo_alt: row.photo_alt,
org_logo: row.effective_org_logo,
links: actions,
};
}
function shapeCountdown(row) {
if (!row) return null;
return {
id: row.id,
title: row.title,
theme: row.theme,
starts_on: row.starts_on,
ends_on: row.ends_on,
date_label: row.date_label,
location_label: row.location_label,
is_online: asBool(row.is_online),
color: row.effective_color,
event_logo: row.event_logo,
series: shapeSeries(row),
};
}
home.get("/front-page", (c) => {
const db = c.get("db");
const page = db.prepare(`SELECT * FROM front_page WHERE id = ?`).get(PAGE_ID);
// The schema seeds the row and the engine refuses to delete it,
// so this is a database that hasn't been migrated. Say so.
if (!page) return c.json({ error: "The front page hasn't been set up." }, 500);
const byOrder = (table) =>
db.prepare(`SELECT * FROM ${table} WHERE page_id = ? ORDER BY sort_order`).all(PAGE_ID);
const sections = byOrder("front_page_sections")
.filter((row) => !asBool(row.is_hidden))
.map((row) => ({ section: row.section, title: row.title, blurb: row.blurb }));
const slides = byOrder("front_page_slides").map((row) => ({
media: row.media,
alt: row.alt,
caption: row.caption,
link_url: row.link_url,
}));
const stats = byOrder("front_page_stats")
.map((row) => ({
label: row.label,
value: statValue(db, row),
suffix: row.suffix,
note: row.note,
}))
.filter((stat) => stat.value !== null);
const actions = db.prepare(
`SELECT label, description, url FROM front_page_path_actions
WHERE path_id = ? ORDER BY sort_order`,
);
const paths = byOrder("front_page_paths")
.map((row) => ({
label: row.label,
icon: row.icon,
blurb: row.blurb,
actions: actions.all(row.id),
}))
// A path with nothing to do is a dead tab.
.filter((path) => path.actions.length > 0);
const notOver = `is_published = 1
AND effective_status != 'cancelled'
AND COALESCE(ends_on, starts_on) >= date('now')`;
const pinned = page.countdown_event_id
? db
.prepare(`SELECT * FROM v_events WHERE id = ? AND ${notOver}`)
.get(page.countdown_event_id)
: null;
const filters = [];
const params = [];
if (page.countdown_scope_id) {
filters.push("AND scope_id = ?");
params.push(page.countdown_scope_id);
}
if (page.countdown_event_type) {
filters.push("AND event_type = ?");
params.push(page.countdown_event_type);
}
const next =
pinned ??
db
.prepare(
`SELECT * FROM v_events
WHERE ${notOver} AND is_listed = 1 ${filters.join(" ")}
ORDER BY starts_on, title
LIMIT 1`,
)
.get(...params);
const heroEvent =
page.hero_feature === "event"
? (page.hero_event_id
? db
.prepare(`SELECT * FROM v_events WHERE id = ? AND ${notOver}`)
.get(page.hero_event_id)
: null) ?? next
: null;
return json(c, {
front_page: {
hero: {
backdrop: page.hero_backdrop,
feature: page.hero_feature,
eyebrow: page.eyebrow,
headline: page.headline,
subhead: page.subhead,
primary: page.primary_label && page.primary_url
? { label: page.primary_label, url: page.primary_url }
: null,
secondary: page.secondary_label && page.secondary_url
? { label: page.secondary_label, url: page.secondary_url }
: null,
slide_seconds: page.slide_seconds,
slides,
livestream: page.livestream_url
? { url: page.livestream_url, title: page.livestream_title }
: null,
video: page.video_url
? { url: page.video_url, title: page.video_title, captions: page.video_captions, still: page.video_still }
: null,
event: shapeHeroEvent(db, heroEvent),
},
sections,
stats,
paths,
featured: loadFeaturedCards(db, "front_page", PAGE_ID),
// 2, 3 or 4 across (073); null is the grid's own default.
featured_columns: page.featured_columns,
countdown: shapeCountdown(next),
},
});
});
export default home;

View file

@ -74,6 +74,8 @@ export function importDocx(db, buffer, fileName, byEmail) {
slot: "body", slot: "body",
type: block.type, type: block.type,
text: block.text ?? null, text: block.text ?? null,
href: block.href ?? null,
cite: block.cite ?? null,
items: block.items ?? [], items: block.items ?? [],
})), })),
}); });
@ -87,6 +89,9 @@ export function importDocx(db, buffer, fileName, byEmail) {
paragraphs: count("paragraph"), paragraphs: count("paragraph"),
lists: count("list"), lists: count("list"),
tables: count("table"), tables: count("table"),
tabs: count("tab"),
// Quotes, callouts, dividers, videos and buttons.
others: doc.blocks.filter((b) => ["quote", "callout", "divider", "video", "button"].includes(b.type)).length,
skipped: doc.skipped, skipped: doc.skipped,
}, },
}; };

79
server/src/routes/pco.js Normal file
View file

@ -0,0 +1,79 @@
/* ═══════════════════════════════════════════════════════════════
PLANNING CENTER ROUTES: Data → Planning Center, mounted under
/api/admin, admins and up (planningCenter.js)
GET /pco whether it's set up, and the list's id
POST /pco/compare the list, each member with its match and what
would change; nothing is written
POST /pco/apply { decisions: [{ pco, action, person_id, update }] }
what the admin chose, in one transaction
The comparison is fetched again for apply's members rather than
trusting the browser's copy of Planning Center's values: only the
choices (which person, link or create, update or not) come from it.
═══════════════════════════════════════════════════════════════ */
import { Hono } from "hono";
import { requireRole } from "../auth.js";
import { tx } from "../db.js";
import { PcoError, apply, compare, listPeople, pcoReady } from "../planningCenter.js";
import { NO_STORE } from "../shape.js";
const pco = new Hono();
pco.use("/pco", requireRole("admin"));
pco.use("/pco/*", requireRole("admin"));
const listId = (db) => db.prepare(`SELECT pco_list_id FROM site_settings WHERE id = 'site'`).get()?.pco_list_id ?? null;
pco.get("/pco", (c) => c.json({ ready: pcoReady(), list_id: listId(c.get("db")) }, 200, NO_STORE));
pco.post("/pco/compare", async (c) => {
const db = c.get("db");
try {
const members = await listPeople(listId(db));
return c.json({ rows: compare(db, members) }, 200, NO_STORE);
} catch (err) {
if (err instanceof PcoError) return c.json({ error: err.message }, 502, NO_STORE);
throw err;
}
});
pco.post("/pco/apply", async (c) => {
const db = c.get("db");
let body;
try {
body = (await c.req.json()) ?? {};
} catch {
return c.json({ error: "Expected a JSON body." }, 400);
}
const chosen = Array.isArray(body.decisions) ? body.decisions : [];
let members;
try {
members = await listPeople(listId(db));
} catch (err) {
if (err instanceof PcoError) return c.json({ error: err.message }, 502, NO_STORE);
throw err;
}
const byId = new Map(members.map((m) => [m.id, m]));
const known = new Set(db.prepare(`SELECT id FROM people`).all().map((r) => r.id));
const decisions = chosen
.map((d) => ({
pco: byId.get(String(d?.pco_id ?? "")),
action: d?.action === "create" ? "create" : d?.action === "link" ? "link" : null,
person_id: d?.person_id && known.has(String(d.person_id)) ? String(d.person_id) : null,
update: Boolean(d?.update),
}))
.filter((d) => d.pco && d.action && (d.action === "create" || d.person_id));
const counts = tx(db, () => apply(db, decisions));
console.log(
`pco sync by ${c.get("user").email}: ${counts.linked} linked, ${counts.updated} updated, ${counts.created} created`,
);
return c.json({ counts }, 200, NO_STORE);
});
export default pco;

View file

@ -4,9 +4,12 @@
GET /nav this visitor's header and footer links and GET /nav this visitor's header and footer links and
the hidden pages (siteNav.js); not cached, the hidden pages (siteNav.js); not cached,
since it depends on who's signed in since it depends on who's signed in
GET /site-pages every site page's section headings, for GET /site-pages every page's section headings, by the
the header's dropdowns and the side nav page's path, for the header's dropdowns
GET /site-pages/:id one page's sections, in order: heading, and the side nav
GET /site-pages/:id one page's title and intro and its shown
sections, in order, each with what its type
shows (sectionData.js): heading,
accent, preset (and an events preset's accent, preset (and an events preset's
filter and view), and its blocks; Not filter and view), and its blocks; Not
found for a hidden page, below viewer found for a hidden page, below viewer
@ -18,8 +21,9 @@
import { Hono } from "hono"; import { Hono } from "hono";
import { currentUser } from "../auth.js"; import { currentUser } from "../auth.js";
import { hiddenPaths, navFor, seesHidden } from "../siteNav.js"; import { navFor, seesHidden } from "../siteNav.js";
import { NO_STORE, json, loadBlocks } from "../shape.js"; import { NO_STORE, json, loadBlocks } from "../shape.js";
import { withSectionData } from "../sectionData.js";
const sitePages = new Hono(); const sitePages = new Hono();
@ -31,26 +35,31 @@ sitePages.get("/nav", (c) => {
sitePages.get("/site-pages", (c) => { sitePages.get("/site-pages", (c) => {
const rows = c const rows = c
.get("db") .get("db")
.prepare(`SELECT page_id, anchor, title FROM page_sections ORDER BY page_id, sort_order, id`) .prepare(
`SELECT p.path, s.anchor, s.title, s.preset FROM page_sections s JOIN site_pages p ON p.id = s.page_id
WHERE s.is_hidden = 0
ORDER BY p.path, s.sort_order, s.id`,
)
.all(); .all();
const pages = {}; const pages = {};
for (const row of rows) (pages[row.page_id] ??= []).push({ anchor: row.anchor, title: row.title }); for (const row of rows) (pages[row.path] ??= []).push({ anchor: row.anchor, title: row.title, preset: row.preset });
return json(c, { pages }); return json(c, { pages });
}); });
sitePages.get("/site-pages/:id", (c) => { sitePages.get("/site-pages/:id", async (c) => {
const db = c.get("db"); const db = c.get("db");
const id = c.req.param("id"); const id = c.req.param("id");
const hidden = hiddenPaths(db).has(`/${id}`); const found = db.prepare(`SELECT title, description, is_hidden FROM site_pages WHERE id = ?`).get(id);
if (!db.prepare(`SELECT 1 FROM site_pages WHERE id = ?`).get(id) || (hidden && !seesHidden(currentUser(db, c)))) { const hidden = found?.is_hidden === 1;
if (!found || (hidden && !seesHidden(currentUser(db, c)))) {
return c.json({ error: "No such page." }, 404); return c.json({ error: "No such page." }, 404);
} }
const rows = db const rows = db
.prepare( .prepare(
`SELECT id, anchor, title, blurb, accent, preset, scope_id, event_type, view, org_kinds `SELECT id, anchor, title, blurb, accent, preset, scope_id, event_type, view, org_kinds
FROM page_sections WHERE page_id = ? ORDER BY sort_order, id`, FROM page_sections WHERE page_id = ? AND is_hidden = 0 ORDER BY sort_order, id`,
) )
.all(id); .all(id);
const blocks = loadBlocks(db, "page_section", rows.map((row) => String(row.id))); const blocks = loadBlocks(db, "page_section", rows.map((row) => String(row.id)));
@ -76,12 +85,16 @@ sitePages.get("/site-pages/:id", (c) => {
tags.set(section_id, [...(tags.get(section_id) ?? []), tag_id]); tags.set(section_id, [...(tags.get(section_id) ?? []), tag_id]);
} }
const sections = await withSectionData(db, rows);
// A hidden page is only for those signed in: never kept. // A hidden page is only for those signed in: never kept.
const send = hidden ? (body) => c.json(body, 200, NO_STORE) : (body) => json(c, body); const send = hidden ? (body) => c.json(body, 200, NO_STORE) : (body) => json(c, body);
return send({ return send({
page: { page: {
id, id,
sections: rows.map(({ id: sectionId, ...section }) => ({ title: found.title,
description: found.description,
sections: sections.map(({ id: sectionId, ...section }) => ({
...section, ...section,
blocks: blocks.get(String(sectionId)) ?? [], blocks: blocks.get(String(sectionId)) ?? [],
org_ids: picked.get(sectionId) ?? [], org_ids: picked.get(sectionId) ?? [],

290
server/src/sectionData.js Normal file
View file

@ -0,0 +1,290 @@
/* ═══════════════════════════════════════════════════════════════
SECTION DATA
What a section type shows beyond its blocks, resolved for the page
(routes/sitePages.js, GET /site-pages/:id), from its settings
tables (083_section_settings.sql):
hero its words, buttons, backdrop, slides, and the
event its card shows (with the 'event' feature)
countdown the event it counts down to
stats its numbers, counted
connect its paths, each with its links
featured_cards its cards, record cards filled in from their
records
community_blog our posts (pinned, then newest) and community
posts (pinned cards, then its feeds' newest)
── Stats ──
A stat's source picks a query from STAT_QUERIES. Each counts
exactly what the matching public page shows: published, listed
rows, and for awards only public citations to published people.
A count that disagreed with the page it summarizes would be worse
than none. 'manual' and 'years_since' read the row's own value.
── Countdown ──
The pinned event if it is still published and not over, listed
or not; otherwise the next published, listed, non-canceled event
that hasn't ended (COALESCE(ends_on, starts_on) >= today, so a
running series still counts), narrowed by the section's scope and
type. The client works out a series' next meeting from `series`.
── Hero event ──
With the 'event' feature, the hero draws its pinned event if it's
still published and not over, else the page's countdown's event,
else the next event, so the two never disagree.
═══════════════════════════════════════════════════════════════ */
import { asBool, loadFeaturedCards, loadLinks, marks, shapeSeries, splitLinks } from "./shape.js";
import { readFeeds } from "./feeds.js";
import { firstParagraphs, loadAuthors, shapeSummary } from "./routes/blog.js";
const STAT_QUERIES = {
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`,
groups: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'group' AND is_published = 1 AND is_listed = 1`,
partners: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'partner' AND is_published = 1 AND is_listed = 1`,
events_held: `SELECT COUNT(*) AS n FROM v_events
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`,
retreats_held: `SELECT COUNT(*) AS n FROM v_events
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'
AND event_type = 'retreat'`,
people: `SELECT COUNT(*) AS n FROM people WHERE is_published = 1 AND is_listed = 1`,
awards_given: `SELECT COUNT(*) AS n
FROM person_awards pa
JOIN v_people_public p ON p.id = pa.person_id AND p.is_published = 1
JOIN awards a ON a.id = pa.award_id AND a.is_published = 1
WHERE pa.is_public = 1`,
};
/* The number as a string, or null when there's nothing to print. */
function statValue(db, row) {
if (row.source === "manual") return row.value || null;
if (row.source === "years_since") {
const year = Number.parseInt(row.value ?? "", 10);
if (!Number.isInteger(year)) return null;
return String(Math.max(0, new Date().getFullYear() - year));
}
const sql = STAT_QUERIES[row.source];
return sql ? String(db.prepare(sql).get().n) : null;
}
function shapeCountdown(row) {
if (!row) return null;
return {
id: row.id,
title: row.title,
theme: row.theme,
starts_on: row.starts_on,
ends_on: row.ends_on,
date_label: row.date_label,
location_label: row.location_label,
is_online: asBool(row.is_online),
color: row.effective_color,
event_logo: row.event_logo,
series: shapeSeries(row),
};
}
/* The countdown's fields plus what the hero's event card also draws. */
function shapeHeroEvent(db, row) {
if (!row) return null;
const { actions } = splitLinks(loadLinks(db, "event", [row.id]).get(row.id) ?? []);
return {
...shapeCountdown(row),
tagline: row.tagline,
photo: row.photo,
photo_alt: row.photo_alt,
org_logo: row.effective_org_logo,
links: actions,
};
}
const NOT_OVER = `is_published = 1
AND effective_status != 'cancelled'
AND COALESCE(ends_on, starts_on) >= date('now')`;
const pinnedEvent = (db, id) =>
id ? db.prepare(`SELECT * FROM v_events WHERE id = ? AND ${NOT_OVER}`).get(id) ?? null : null;
/* A countdown's event: the pinned one, else the next of its scope and type. */
function countdownEvent(db, settings) {
const pinned = pinnedEvent(db, settings?.event_id);
if (pinned) return pinned;
const filters = [];
const params = [];
if (settings?.scope_id) {
filters.push("AND scope_id = ?");
params.push(settings.scope_id);
}
if (settings?.event_type) {
filters.push("AND event_type = ?");
params.push(settings.event_type);
}
return (
db
.prepare(
`SELECT * FROM v_events
WHERE ${NOT_OVER} AND is_listed = 1 ${filters.join(" ")}
ORDER BY starts_on, title
LIMIT 1`,
)
.get(...params) ?? null
);
}
const byOrder = (db, table, column, id) =>
db.prepare(`SELECT * FROM ${table} WHERE ${column} = ? ORDER BY sort_order, id`).all(id);
function heroOf(db, section, pageCountdown) {
const h = db.prepare(`SELECT * FROM section_hero WHERE section_id = ?`).get(section.id) ?? {};
const event =
h.feature === "event" ? pinnedEvent(db, h.event_id) ?? pageCountdown ?? countdownEvent(db, null) : null;
return {
backdrop: h.backdrop ?? "brand",
feature: h.feature ?? "none",
eyebrow: h.eyebrow ?? null,
headline: h.headline ?? "",
subhead: h.subhead ?? null,
primary: h.primary_label && h.primary_url ? { label: h.primary_label, url: h.primary_url } : null,
secondary: h.secondary_label && h.secondary_url ? { label: h.secondary_label, url: h.secondary_url } : null,
slide_seconds: h.slide_seconds ?? 7,
slides: byOrder(db, "section_slides", "section_id", section.id).map((row) => ({
media: row.media,
alt: row.alt,
caption: row.caption,
link_url: row.link_url,
})),
livestream: h.livestream_url ? { url: h.livestream_url, title: h.livestream_title } : null,
video: h.video_url
? { url: h.video_url, title: h.video_title, captions: h.video_captions, still: h.video_still }
: null,
event: shapeHeroEvent(db, event),
// Its rotating words' motion (084); null keeps the site's.
words: { motion: h.word_motion ?? null, direction: h.word_direction ?? null, seconds: h.word_seconds ?? null },
};
}
function pathsOf(db, section) {
const actions = db.prepare(
`SELECT label, description, url FROM section_path_actions WHERE path_id = ? ORDER BY sort_order, id`,
);
return (
byOrder(db, "section_paths", "section_id", section.id)
.map((row) => ({ label: row.label, icon: row.icon, blurb: row.blurb, actions: actions.all(row.id) }))
// A path with nothing to do is a dead tab.
.filter((path) => path.actions.length > 0)
);
}
async function blogOf(db, section) {
const page = db.prepare(`SELECT * FROM section_blog WHERE section_id = ?`).get(section.id) ?? {
internal_slots: 3,
external_slots: 3,
};
// Ours: pinned, then newest.
const pinned = db
.prepare(
`SELECT b.*
FROM section_blog_posts pp
JOIN blog_posts b ON b.id = pp.post_id AND b.is_published = 1
WHERE pp.section_id = ?
ORDER BY pp.sort_order`,
)
.all(section.id);
const room = Math.max(0, page.internal_slots - pinned.length);
const pinnedIds = pinned.map((row) => row.id);
const newest = room
? db
.prepare(
`SELECT * FROM blog_posts
WHERE is_published = 1 AND is_listed = 1
${pinnedIds.length ? `AND id NOT IN (${marks(pinnedIds.length)})` : ""}
ORDER BY published_on IS NULL, published_on DESC, created_at DESC
LIMIT ?`,
)
.all(...pinnedIds, room)
: [];
const posts = [...pinned, ...newest];
const authors = loadAuthors(db, posts.map((row) => row.id));
const first = firstParagraphs(db, posts);
// Theirs: pinned cards, then the feeds' newest.
const cards = loadFeaturedCards(db, "page_section", String(section.id));
const feedRows = db
.prepare(`SELECT url, label FROM section_feeds WHERE section_id = ? ORDER BY sort_order`)
.all(section.id);
const shown = new Set(cards.map((card) => card.url).filter(Boolean));
const spare = Math.max(0, page.external_slots - cards.length);
const fromFeeds = spare && feedRows.length ? await readFeeds(feedRows) : [];
const latest = fromFeeds
.filter((item) => !shown.has(item.url))
.slice(0, spare)
.map((item) => ({
kind: "link",
ref: null,
url: item.url,
eyebrow: item.source,
title: item.title,
blurb: item.excerpt,
image: item.image ? { file: item.image, kind: "featured" } : null,
published: item.published,
}));
return {
internal: {
title: page.internal_title,
posts: posts.map((row) => shapeSummary(row, authors.get(row.id) ?? [], first.get(row.id))),
},
external: {
title: page.external_title,
url: page.external_url,
label: page.external_label,
cards: [...cards, ...latest],
},
};
}
/* Each section with what its type shows, as `data`. A page's first
countdown is the event its heroes fall back to. */
export async function withSectionData(db, sections) {
const countdown = sections.find((s) => s.preset === "countdown");
const pageCountdown = countdown
? countdownEvent(db, db.prepare(`SELECT * FROM section_countdown WHERE section_id = ?`).get(countdown.id))
: null;
return Promise.all(
sections.map(async (section) => {
switch (section.preset) {
case "hero":
return { ...section, data: heroOf(db, section, pageCountdown) };
case "countdown": {
const settings = db.prepare(`SELECT * FROM section_countdown WHERE section_id = ?`).get(section.id);
const event = section === countdown ? pageCountdown : countdownEvent(db, settings);
return { ...section, data: shapeCountdown(event) };
}
case "stats":
return {
...section,
data: byOrder(db, "section_stats", "section_id", section.id)
.map((row) => ({ label: row.label, value: statValue(db, row), suffix: row.suffix, note: row.note }))
.filter((stat) => stat.value !== null),
};
case "connect":
return { ...section, data: pathsOf(db, section) };
case "featured_cards":
return {
...section,
data: {
cards: loadFeaturedCards(db, "page_section", String(section.id)),
columns: db.prepare(`SELECT columns FROM section_featured WHERE section_id = ?`).get(section.id)?.columns ?? null,
},
};
case "community_blog":
return { ...section, data: await blogOf(db, section) };
default:
return section;
}
}),
);
}

View file

@ -70,7 +70,8 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
const blockRows = db const blockRows = db
.prepare( .prepare(
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id `SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id,
word_motion, word_direction, word_seconds
FROM content_blocks FROM content_blocks
WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)}) WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)})
ORDER BY owner_id, sort_order`, ORDER BY owner_id, sort_order`,
@ -91,6 +92,10 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
cite: row.cite, cite: row.cite,
captions: row.captions, captions: row.captions,
team_id: row.team_id, team_id: row.team_id,
// Its rotating words' motion (084), when it has its own.
words: row.word_motion || row.word_direction || row.word_seconds
? { motion: row.word_motion, direction: row.word_direction, seconds: row.word_seconds }
: null,
items: [], items: [],
}; };
byId.set(row.id, block); byId.set(row.id, block);
@ -212,7 +217,7 @@ export function splitLinks(links = []) {
first; an empty list means "starts_on's weekday", which the first; an empty list means "starts_on's weekday", which the
client resolves since it already holds starts_on. Occurrences client resolves since it already holds starts_on. Occurrences
are not sent, they are derived, and the client derives them are not sent, they are derived, and the client derives them
against its own today. Shared by /events and /front-page. against its own today. Shared by /events and the sections (sectionData.js).
───────────────────────────────────────────────────────────── */ ───────────────────────────────────────────────────────────── */
const SERIES_WEEKDAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]; const SERIES_WEEKDAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];

View file

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

View file

@ -2,7 +2,6 @@
"title": "Next Generation of Unity", "title": "Next Generation of Unity",
"url": "https://nextgenerationofunity.org", "url": "https://nextgenerationofunity.org",
"description": "", "description": "",
"privacyEmail": "",
"robots": { "robots": {
"index": true "index": true
}, },
@ -12,55 +11,5 @@
"accessibility": { "accessibility": {
"addBypassLinks": false, "addBypassLinks": false,
"ignoreReducedMotion": false "ignoreReducedMotion": false
},
"pages": {
"/retreats": {
"title": "Retreats",
"description": "Retreats hosted by Next Generation of Unity, our regions, and our partners throughout the year."
},
"/community": {
"title": "Community",
"description": "Groups, regions and the people who make up Next Generation of Unity."
},
"/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",
"description": "Teachings, brand assets, and material for groups and partners."
},
"/history": {
"title": "History",
"description": "A near-complete timeline of Next Generation of Unity (NGU), and other Unity Young Adult programs."
},
"/feedback": {
"title": "Feedback",
"description": "Tell us what's working, what isn't, and what you'd like to see next."
},
"/request": {
"title": "Request",
"description": "Ask for a blog post, an event, or a new or updated group, region, partner, team, award or person on the site."
},
"/qr": {
"title": "QR Codes",
"description": "Codes for flyers, slides and signs, pointing at any page on the site or any link, in your choice of colors."
},
"/give": {
"title": "Giving",
"description": "Support the work of Next Generation of Unity."
},
"/privacy": {
"title": "Privacy Policy",
"description": "How Next Generation of Unity collects, uses, and protects your information."
},
"/shop": {
"title": "Shop",
"description": "Shirts, stickers and more from Next Generation of Unity. Every purchase supports our retreats and programs."
},
"/terms": {
"title": "Terms of Service",
"description": "The terms that apply when you use this site and our programs."
}
} }
} }

View file

@ -14,13 +14,12 @@ import { AuthProvider, RequireAuth } from "./lib/auth.tsx"
import RequireRole from "./pages/admin/RequireRole.tsx" import RequireRole from "./pages/admin/RequireRole.tsx"
/*Pages*/ /*Pages*/
// Home is the landing page, so it ships in the main bundle. Every // Every page, the front page included, and all of the admin, is
// other page, and all of the admin, is fetched when first visited: // fetched when first visited: a visitor never downloads the admin,
// a visitor to the front page never downloads the admin, the QR // and a page's own parts come with it. The front page's data is asked
// encoder, the calendar or the group map. Layout and AdminLayout // for by its HTML before this runs (pageMeta.js, preload). Layout and
// wrap their <Outlet /> in <Suspense>, so the header stays put while // AdminLayout wrap their <Outlet /> in <Suspense>, so the header stays
// a page loads. // put while a page loads.
import Home from "./pages/Home.tsx"
/* A page's chunk can be missing when a deploy replaced the build while /* A page's chunk can be missing when a deploy replaced the build while
this tab still ran the old one. Reload once to pick up the new this tab still ran the old one. Reload once to pick up the new
@ -49,16 +48,10 @@ const lazyPage = (load) =>
throw err throw err
}), }),
) )
// Community, Retreats, Resources, Organization, History and Shop: // Every page at its address (Pages → Page management): its sections.
// each built in the admin from sections. const PageAtPath = lazyPage(() => import("./pages/PageAtPath.tsx"))
// The front page: its sections, in the front page's layout.
const SitePage = lazyPage(() => import("./pages/SitePage.tsx")) 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"))
const QrCodes = lazyPage(() => import("./pages/QrCodes.tsx"))
const Privacy = lazyPage(() => import("./pages/Privacy.tsx"))
const Terms = lazyPage(() => import("./pages/Terms.tsx"))
const NotFound = lazyPage(() => import("./pages/NotFound.tsx"))
// Profile accounts (076): signing in, an invite's welcome, the profile. // Profile accounts (076): signing in, an invite's welcome, the profile.
const SignIn = lazyPage(() => import("./pages/SignIn.tsx")) const SignIn = lazyPage(() => import("./pages/SignIn.tsx"))
const AccountWelcome = lazyPage(() => import("./pages/AccountWelcome.tsx")) const AccountWelcome = lazyPage(() => import("./pages/AccountWelcome.tsx"))
@ -88,6 +81,7 @@ const AdminVideoFrames = lazyPage(() => import("./pages/admin/AdminVideoFrames.t
const AdminNewsletter = lazyPage(() => import("./pages/admin/AdminNewsletter.tsx")) const AdminNewsletter = lazyPage(() => import("./pages/admin/AdminNewsletter.tsx"))
const AdminProfiles = lazyPage(() => import("./pages/admin/AdminProfiles.tsx")) const AdminProfiles = lazyPage(() => import("./pages/admin/AdminProfiles.tsx"))
const AdminConvert = lazyPage(() => import("./pages/admin/AdminConvert.tsx")) const AdminConvert = lazyPage(() => import("./pages/admin/AdminConvert.tsx"))
const AdminPco = lazyPage(() => import("./pages/admin/AdminPco.tsx"))
const EntityList = lazyPage(() => import("./pages/admin/EntityList.tsx")) const EntityList = lazyPage(() => import("./pages/admin/EntityList.tsx"))
const EntityEdit = lazyPage(() => import("./pages/admin/EntityEdit.tsx")) const EntityEdit = lazyPage(() => import("./pages/admin/EntityEdit.tsx"))
@ -99,10 +93,8 @@ export default function App() {
<Routes> <Routes>
{/* Layout renders the nav once and swaps page content into <Outlet /> */} {/* Layout renders the nav once and swaps page content into <Outlet /> */}
<Route element={<Layout />}> <Route element={<Layout />}>
<Route index element={<Home />} /> <Route index element={<SitePage key="home" id="home" />} />
<Route path="retreats" element={<SitePage key="retreats" id="retreats" />} />
<Route path="/events/:id" element={<EventDetail />} /> <Route path="/events/:id" element={<EventDetail />} />
<Route path="community" element={<SitePage key="community" id="community" />} />
<Route path="/regions/:id" element={<OrganizationDetail />} /> <Route path="/regions/:id" element={<OrganizationDetail />} />
<Route path="/groups/:id" element={<OrganizationDetail />} /> <Route path="/groups/:id" element={<OrganizationDetail />} />
<Route path="/partners/:id" element={<OrganizationDetail />} /> <Route path="/partners/:id" element={<OrganizationDetail />} />
@ -112,20 +104,11 @@ export default function App() {
<Route path="/people/:id" element={<PersonDetail />} /> <Route path="/people/:id" element={<PersonDetail />} />
<Route path="/blog/:id" element={<BlogPost />} /> <Route path="/blog/:id" element={<BlogPost />} />
<Route path="/directory/:id" element={<DirectoryPage />} /> <Route path="/directory/:id" element={<DirectoryPage />} />
<Route path="organization" element={<SitePage key="organization" id="organization" />} />
<Route path="resources" element={<SitePage key="resources" id="resources" />} />
<Route path="history" element={<SitePage key="history" id="history" />} />
<Route path="shop" element={<SitePage key="shop" id="shop" />} />
<Route path="feedback" element={<Feedback />} />
<Route path="request" element={<Request />} />
<Route path="qr" element={<QrCodes />} />
<Route path="give" element={<Giving />} />
<Route path="privacy" element={<Privacy />} />
<Route path="terms" element={<Terms />} />
<Route path="sign-in" element={<SignIn />} /> <Route path="sign-in" element={<SignIn />} />
<Route path="account" element={<Account />} /> <Route path="account" element={<Account />} />
<Route path="account/welcome" element={<AccountWelcome />} /> <Route path="account/welcome" element={<AccountWelcome />} />
<Route path="*" element={<NotFound />} /> {/* Every page of the site: Pages → Page management (PageAtPath). */}
<Route path="*" element={<PageAtPath />} />
</Route> </Route>
{/* A schedule as a slideshow for a screen: full screen, no Layout. */} {/* A schedule as a slideshow for a screen: full screen, no Layout. */}
<Route <Route
@ -163,6 +146,7 @@ export default function App() {
<Route element={<RequireRole role="admin" />}> <Route element={<RequireRole role="admin" />}>
<Route path="clips" element={<AdminClips />} /> <Route path="clips" element={<AdminClips />} />
<Route path="profiles" element={<AdminProfiles />} /> <Route path="profiles" element={<AdminProfiles />} />
<Route path="pco" element={<AdminPco />} />
</Route> </Route>
<Route path=":entity" element={<EntityList />} /> <Route path=":entity" element={<EntityList />} />
<Route path=":entity/:id" element={<EntityEdit />} /> <Route path=":entity/:id" element={<EntityEdit />} />

View file

@ -55,6 +55,7 @@ import { headingAnchors } from '../lib/contents.ts'
import { SITE_NAME } from '../lib/site.ts' import { SITE_NAME } from '../lib/site.ts'
import { useSmallImage } from '../lib/useSmallImage.ts' import { useSmallImage } from '../lib/useSmallImage.ts'
import { useReadingMode } from '../lib/readingMode.ts' import { useReadingMode } from '../lib/readingMode.ts'
import { WordMotion, Words } from './RotatingWords.tsx'
const BODY = 'var(--color-muted)' const BODY = 'var(--color-muted)'
@ -96,14 +97,15 @@ export default function ContentBlocks({
return ( return (
<div className={`space-y-6 ${className}`}> <div className={`space-y-6 ${className}`}>
{blocks.map((block, index) => ( {blocks.map((block, index) => (
<WordMotion key={block.id ?? index} settings={block.words}>
<Block <Block
key={block.id ?? index}
block={block} block={block}
accent={accent} accent={accent}
anchor={idAt.get(index)} anchor={idAt.get(index)}
level={levels[index]} level={levels[index]}
presentHref={presentHrefs[index]} presentHref={presentHrefs[index]}
/> />
</WordMotion>
))} ))}
</div> </div>
) )
@ -191,14 +193,14 @@ function Block({
case 'heading': case 'heading':
return ( return (
<h3 id={anchor} className="text-2xl font-bold" style={{ color: accentText(accent) }}> <h3 id={anchor} className="text-2xl font-bold" style={{ color: accentText(accent) }}>
{text} <Words text={text} />
</h3> </h3>
) )
case 'subheading': case 'subheading':
return ( return (
<h4 id={anchor} className="text-lg font-normal" style={{ color: accentText(accent) }}> <h4 id={anchor} className="text-lg font-normal" style={{ color: accentText(accent) }}>
{text} <Words text={text} />
</h4> </h4>
) )

View file

@ -42,7 +42,7 @@ import HomeLink from '../pages/sections/home/HomeLink.tsx'
import VideoPlayer from './VideoPlayer.tsx' import VideoPlayer from './VideoPlayer.tsx'
import { refHref } from '../lib/hrefs.ts' import { refHref } from '../lib/hrefs.ts'
import { mediaUrl } from '../lib/media.ts' import { mediaUrl } from '../lib/media.ts'
import type { FeaturedCard, FeaturedColumns, FeaturedSize } from '../lib/useFrontPage.ts' import type { FeaturedCard, FeaturedColumns, FeaturedSize } from '../lib/sectionTypes.ts'
import { useReadingMode } from '../lib/readingMode.ts' import { useReadingMode } from '../lib/readingMode.ts'
import { useSmallImage } from '../lib/useSmallImage.ts' import { useSmallImage } from '../lib/useSmallImage.ts'

View file

@ -4,7 +4,7 @@
The little formatting a content block's text may carry, typed in The little formatting a content block's text may carry, typed in
the admin as plain characters: the admin as plain characters:
**bold** *italic* [link text](url) **bold** *italic* [link text](url) {Next|Now} (rotating words)
a line break keeps its place a line break keeps its place
a blank line starts a new paragraph a blank line starts a new paragraph
@ -21,8 +21,9 @@
import { Fragment, type CSSProperties, type ReactNode } from 'react' import { Fragment, type CSSProperties, type ReactNode } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { accentText } from '../lib/color.ts' import { accentText } from '../lib/color.ts'
import { RotatingWords } from './RotatingWords.tsx'
const TOKEN = /\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)\s]+)\)/g const TOKEN = /\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)\s]+)\)|\{([^{}|\n]+(?:\|[^{}|\n]+)+)\}/g
const SAFE_URL = /^(\/(?!\/)|#|https?:\/\/|mailto:|tel:)/i const SAFE_URL = /^(\/(?!\/)|#|https?:\/\/|mailto:|tel:)/i
/** External if it has a scheme or starts with //; otherwise it's /** External if it has a scheme or starts with //; otherwise it's
@ -83,9 +84,10 @@ function line(text: string, accent: string, key: string): ReactNode[] {
for (const match of text.matchAll(TOKEN)) { for (const match of text.matchAll(TOKEN)) {
const at = match.index ?? 0 const at = match.index ?? 0
if (at > last) out.push(text.slice(last, at)) if (at > last) out.push(text.slice(last, at))
const [whole, bold, italic, label, url] = match const [whole, bold, italic, label, url, words] = match
const k = `${key}-${n++}` const k = `${key}-${n++}`
if (bold != null) out.push(<strong key={k} className="font-semibold">{bold}</strong>) if (words != null) out.push(<RotatingWords key={k} words={words.split('|').map((word) => word.trim())} />)
else if (bold != null) out.push(<strong key={k} className="font-semibold">{bold}</strong>)
else if (italic != null) out.push(<em key={k}>{italic}</em>) else if (italic != null) out.push(<em key={k}>{italic}</em>)
else if (label != null && SAFE_URL.test(url)) { else if (label != null && SAFE_URL.test(url)) {
out.push( out.push(

View file

@ -1,46 +0,0 @@
/* ═══════════════════════════════════════════════════════════════
LEGAL TEXT
The Privacy and Terms pages: a list of headed parts, each a few
paragraphs or a bullet list, in a readable column. The words live
in the page files; this only lays them out the same way.
═══════════════════════════════════════════════════════════════ */
import type { ReactNode } from 'react'
export type LegalPart = {
/** Anchor for linking to one part, eg. 'cookies'. */
id: string
heading: string
body: ReactNode[]
list?: ReactNode[]
/** After the list. */
after?: ReactNode[]
}
export default function LegalText({ parts }: { parts: LegalPart[] }) {
return (
<div className="mx-auto max-w-3xl space-y-10 px-6 leading-relaxed text-body">
{parts.map((part) => (
<section key={part.id} id={part.id}>
<h3 className="text-xl font-bold text-ink">{part.heading}</h3>
<div className="mt-3 space-y-3">
{part.body.map((paragraph, i) => (
<p key={i}>{paragraph}</p>
))}
{part.list && (
<ul className="list-disc space-y-2 pl-6">
{part.list.map((item, i) => (
<li key={i}>{item}</li>
))}
</ul>
)}
{part.after?.map((paragraph, i) => (
<p key={i}>{paragraph}</p>
))}
</div>
</section>
))}
</div>
)
}

View file

@ -45,6 +45,8 @@ import { documentTitle } from "../lib/site.ts";
import { accentText, ACCENTS, BRAND } from '../lib/color.ts' import { accentText, ACCENTS, BRAND } from '../lib/color.ts'
import { SectionNav, useActiveSection } from "./admin/SectionNav.tsx"; import { SectionNav, useActiveSection } from "./admin/SectionNav.tsx";
import "./PageShell.css"; import "./PageShell.css";
import { Words } from "./RotatingWords.tsx"
import { firstWords } from "../lib/words.ts";
export type ShellSection = { export type ShellSection = {
@ -54,6 +56,10 @@ export type ShellSection = {
accent: string; accent: string;
actions?: ReactNode; actions?: ReactNode;
content: ReactNode; content: ReactNode;
/** It draws its own heading (a band, sections/Bands.tsx): the shell adds none. */
bare?: boolean;
/** Left out of the side nav (the hero, a countdown). */
unlisted?: boolean;
}; };
type PageShellProps = { type PageShellProps = {
@ -75,8 +81,12 @@ export function Section({ section }: { section: ShellSection }) {
// shell just gives it a place to sit. // shell just gives it a place to sit.
actions, actions,
content, content,
bare,
} = section; } = section;
// A band brings its own heading, padding and anchor.
if (bare) return <>{content}</>;
return ( return (
<section <section
id={id} id={id}
@ -89,7 +99,7 @@ export function Section({ section }: { section: ShellSection }) {
<div className="flex flex-wrap items-end justify-between gap-4"> <div className="flex flex-wrap items-end justify-between gap-4">
<div> <div>
<h2 className="text-3xl md:text-4xl font-bold" style={{ color: accentText(accent) }}> <h2 className="text-3xl md:text-4xl font-bold" style={{ color: accentText(accent) }}>
{title} <Words text={title} />
</h2> </h2>
{blurb && <p className="mt-2 text-muted max-w-xl">{blurb}</p>} {blurb && <p className="mt-2 text-muted max-w-xl">{blurb}</p>}
</div> </div>
@ -179,7 +189,9 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
ro.observe(column); ro.observe(column);
return () => ro.disconnect(); return () => ro.disconnect();
}, [sideNav]); }, [sideNav]);
const navSections = sideNav ? sections.map((s) => ({ id: s.id, label: s.title, accent: s.accent })) : []; const navSections = sideNav
? sections.filter((s) => !s.unlisted).map((s) => ({ id: s.id, label: firstWords(s.title), accent: s.accent }))
: [];
const active = useActiveSection(navSections); const active = useActiveSection(navSections);
const activeAccent = sections.find((s) => s.id === active)?.accent; const activeAccent = sections.find((s) => s.id === active)?.accent;
@ -269,7 +281,7 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
// comes from the server (pageMeta.js), which also sets the page's // comes from the server (pageMeta.js), which also sets the page's
// description and preview for search and link sharing. // description and preview for search and link sharing.
useEffect(() => { useEffect(() => {
if (typeof title === "string") document.title = documentTitle(title); if (typeof title === "string") document.title = documentTitle(firstWords(title));
}, [title]); }, [title]);
// The thin solid banner between sections, the page's full width // The thin solid banner between sections, the page's full width
@ -289,7 +301,7 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
<div className="pt-24 pb-12 px-6"> <div className="pt-24 pb-12 px-6">
<div className="max-w-6xl mx-auto"> <div className="max-w-6xl mx-auto">
<h1 className="text-4xl sm:text-5xl md:text-6xl font-bold [overflow-wrap:anywhere] hyphens-auto" 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} {typeof title === "string" ? <Words text={title} /> : title}
</h1> </h1>
{intro && <p className="mt-3 text-lg text-muted max-w-2xl">{intro}</p>} {intro && <p className="mt-3 text-lg text-muted max-w-2xl">{intro}</p>}
</div> </div>

View file

@ -48,7 +48,7 @@ export default function PrivacyNotice() {
<p> <p>
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press
play or show them, and those services may set their own cookies then.{' '} play or show them, and those services may set their own cookies then.{' '}
<Link to="/privacy#cookies" className="font-semibold text-link underline underline-offset-2"> <Link to="/privacy#cookies-and-browser-storage" className="font-semibold text-link underline underline-offset-2">
Privacy Policy Privacy Policy
</Link> </Link>
</p> </p>

View file

@ -0,0 +1,94 @@
/* Rotating words (RotatingWords.tsx): every word in one grid cell,
so the space is the longest word's; the current one 'in', the one
it replaced 'out', the rest 'idle' (hidden). */
.rotating-words {
display: inline-block;
vertical-align: bottom;
}
.rotating-words-stack {
display: inline-grid;
/* Room for descenders, and clipped so a sliding word comes in from
behind the line, not over the one above. */
padding-bottom: 0.08em;
overflow: hidden;
perspective: 600px;
}
.rotating-word {
grid-area: 1 / 1;
white-space: nowrap;
transition:
transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1),
opacity 0.55s ease;
backface-visibility: hidden;
}
.rotating-word[data-state="idle"] {
opacity: 0;
transition: none;
}
/* slide */
.rotating-words[data-motion="slide"][data-direction="top"] .rotating-word[data-state="idle"] {
transform: translateY(-100%);
}
.rotating-words[data-motion="slide"][data-direction="top"] .rotating-word[data-state="out"] {
transform: translateY(100%);
opacity: 0;
}
.rotating-words[data-motion="slide"][data-direction="bottom"] .rotating-word[data-state="idle"] {
transform: translateY(100%);
}
.rotating-words[data-motion="slide"][data-direction="bottom"] .rotating-word[data-state="out"] {
transform: translateY(-100%);
opacity: 0;
}
/* flip: like a card turning over on its horizontal edge */
.rotating-words[data-motion="flip"][data-direction="top"] .rotating-word[data-state="idle"] {
transform: rotateX(90deg);
}
.rotating-words[data-motion="flip"][data-direction="top"] .rotating-word[data-state="out"] {
transform: rotateX(-90deg);
opacity: 0;
}
.rotating-words[data-motion="flip"][data-direction="bottom"] .rotating-word[data-state="idle"] {
transform: rotateX(-90deg);
}
.rotating-words[data-motion="flip"][data-direction="bottom"] .rotating-word[data-state="out"] {
transform: rotateX(90deg);
opacity: 0;
}
/* mirror: turning on its upright, the new word coming round from behind */
.rotating-words[data-motion="mirror"] .rotating-word[data-state="idle"] {
transform: rotateY(-180deg);
}
.rotating-words[data-motion="mirror"] .rotating-word[data-state="out"] {
transform: rotateY(180deg);
opacity: 0;
}
/* fade, and type (the letters appear; the old word fades) */
.rotating-words[data-motion="fade"] .rotating-word[data-state="out"],
.rotating-words[data-motion="type"] .rotating-word[data-state="out"] {
opacity: 0;
}
.rotating-words-caret {
display: inline-block;
width: 0.08em;
height: 0.9em;
margin-left: 0.04em;
vertical-align: -0.08em;
background: currentColor;
animation: rotating-words-blink 1s steps(1) infinite;
}
@keyframes rotating-words-blink {
50% {
opacity: 0;
}
}

View file

@ -0,0 +1,117 @@
/* ═══════════════════════════════════════════════════════════════
ROTATING WORDS
A word that cycles through choices in place, typed into any title
or text as {Next|Now|Rising}: the hero's headline, a section's
title, a heading or a paragraph (InlineText.tsx parses the braces).
How it moves comes from the nearest WordMotion (the hero's or a
block's own settings) over the site's defaults (Site settings →
Animated words, window.__SITE__.words):
motion slide, flip, fade, type or mirror
direction where a sliding or flipping word comes from: top
or bottom
seconds how long each word shows
The space it takes is the longest word's, every word stacked in
one grid cell, so the line never jumps. With less motion (the
system's setting, or reading mode) it's the first word, still;
screen readers always get the first word, not a changing one.
═══════════════════════════════════════════════════════════════ */
import { createContext, useContext, useEffect, useState, type ReactNode } from 'react'
import { prefersLessMotion } from '../lib/motion.ts'
import { WORD_DEFAULTS, type WordSettings } from '../lib/site.ts'
import { WORD_GROUP } from '../lib/words.ts'
import './RotatingWords.css'
/* Settings for the words inside: a hero's or a block's (blank keeps
what's around it). */
const WordContext = createContext<WordSettings>(WORD_DEFAULTS)
/* Blank (null) keeps what's around it. */
type WordOverrides = { motion?: WordSettings['motion'] | null; direction?: WordSettings['direction'] | null; seconds?: number | null }
export function WordMotion({ settings, children }: { settings?: WordOverrides | null; children: ReactNode }) {
const around = useContext(WordContext)
const value = {
motion: settings?.motion || around.motion,
direction: settings?.direction || around.direction,
seconds: settings?.seconds || around.seconds,
}
return <WordContext.Provider value={value}>{children}</WordContext.Provider>
}
/** A text with its groups as rotating words, the rest as it is. */
export function Words({ text }: { text?: string | null }) {
const parts: ReactNode[] = []
const source = text ?? ''
let last = 0
let n = 0
for (const match of source.matchAll(WORD_GROUP)) {
const at = match.index ?? 0
if (at > last) parts.push(source.slice(last, at))
parts.push(<RotatingWords key={n++} words={match[1].split('|').map((word) => word.trim())} />)
last = at + match[0].length
}
if (last < source.length) parts.push(source.slice(last))
return <>{parts}</>
}
const TYPE_STEP_MS = 70
export function RotatingWords({ words }: { words: string[] }) {
const { motion, direction, seconds } = useContext(WordContext)
const [index, setIndex] = useState(0)
const [still, setStill] = useState(true)
// For 'type': how many letters of the current word show.
const [typed, setTyped] = useState(words[0]?.length ?? 0)
useEffect(() => {
if (prefersLessMotion() || words.length < 2) return undefined
setStill(false)
const timer = window.setInterval(() => setIndex((i) => (i + 1) % words.length), Math.max(1, seconds) * 1000)
return () => window.clearInterval(timer)
}, [words.length, seconds])
// Typing: the word appears a letter at a time.
useEffect(() => {
if (still || motion !== 'type') return undefined
setTyped(0)
const word = words[index] ?? ''
let shown = 0
const timer = window.setInterval(() => {
shown += 1
setTyped(shown)
if (shown >= word.length) window.clearInterval(timer)
}, TYPE_STEP_MS)
return () => window.clearInterval(timer)
}, [index, motion, still, words])
if (still) return <>{words[0]}</>
return (
<span className="rotating-words" data-motion={motion} data-direction={direction}>
<span className="sr-only">{words[0]}</span>
<span className="rotating-words-stack" aria-hidden="true">
{words.map((word, i) => {
const state = i === index ? 'in' : i === (index + words.length - 1) % words.length ? 'out' : 'idle'
return (
<span key={i} className="rotating-word" data-state={state}>
{motion === 'type' && i === index ? (
<>
{word.slice(0, typed)}
<span className="rotating-words-caret" />
</>
) : (
word
)}
</span>
)
})}
</span>
</span>
)
}

View file

@ -233,7 +233,8 @@ const helpText = (field, row) => (typeof field.help === "function" ? field.help(
export function Field({ field, value, row, options, error, onChange, onPatch }: any) { export function Field({ field, value, row, options, error, onChange, onPatch }: any) {
const id = `f-${field.path.replace(/\./g, "-")}`; const id = `f-${field.path.replace(/\./g, "-")}`;
const widget = field.widget ?? "text"; const widget = field.widget ?? "text";
const locked = Boolean(field.readOnly); // readOnly may be a test of the row (a core page's address).
const locked = Boolean(typeof field.readOnly === "function" ? field.readOnly(row) : field.readOnly);
// The select's options, rebuilt only when their source changes // The select's options, rebuilt only when their source changes
// (or, with filterBy, the row they're filtered by), not on every // (or, with filterBy, the row they're filtered by), not on every

View file

@ -1,7 +1,7 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
PATH ICONS PATH ICONS
The icons a "Find your way in" path can show (Front page → The icons a "Find your way in" path can show (Pages → a page's Connect nav section →
Connect Nav → Icon), as [key, label]. The admin's dropdown lists Connect Nav → Icon), as [key, label]. The admin's dropdown lists
the labels; Pathfinder.tsx draws the Phosphor icon for each key. the labels; Pathfinder.tsx draws the Phosphor icon for each key.
Adding one is a line here and one in ICONS in Pathfinder.tsx. Adding one is a line here and one in ICONS in Pathfinder.tsx.

View file

@ -216,7 +216,7 @@ h1, h2, h3, h4, h5, h6 {
margin: 1.5cm; margin: 1.5cm;
} }
/* Church Center's giving modal (Giving.tsx) is a transparent iframe /* Church Center's giving modal (the giving section, FormSections.tsx) is a transparent iframe
over the whole page, drawn for light pages. On a dark page the over the whole page, drawn for light pages. On a dark page the
browser sees the iframe's scheme differ from ours and paints its browser sees the iframe's scheme differ from ours and paints its
background opaque, so the page behind goes solid white. Telling it background opaque, so the page behind goes solid white. Telling it

View file

@ -25,7 +25,6 @@ import { people } from "./adminSchema/people.ts";
import { teams } from "./adminSchema/teams.ts"; import { teams } from "./adminSchema/teams.ts";
import { awards } from "./adminSchema/awards.ts"; import { awards } from "./adminSchema/awards.ts";
import { timeline } from "./adminSchema/timeline.ts"; import { timeline } from "./adminSchema/timeline.ts";
import { frontPage } from "./adminSchema/frontPage.ts";
import { blogPosts } from "./adminSchema/blog.ts"; import { blogPosts } from "./adminSchema/blog.ts";
import { siteSettings } from "./adminSchema/siteSettings.ts"; import { siteSettings } from "./adminSchema/siteSettings.ts";
import { siteNav } from "./adminSchema/siteNav.ts"; import { siteNav } from "./adminSchema/siteNav.ts";
@ -33,14 +32,7 @@ import { personTagTypes } from "./adminSchema/personTags.ts";
import { tags } from "./adminSchema/tags.ts"; import { tags } from "./adminSchema/tags.ts";
import { contactTypes } from "./adminSchema/contactTypes.ts"; import { contactTypes } from "./adminSchema/contactTypes.ts";
import { redirects } from "./adminSchema/redirects.ts"; import { redirects } from "./adminSchema/redirects.ts";
import { import { pages } from "./adminSchema/sitePages.ts";
communityPage,
retreatsPage,
resourcesPage,
organizationPage,
historyPage,
shopPage,
} from "./adminSchema/sitePages.ts";
export const ADMIN_ENTITIES: Record<string, any> = { export const ADMIN_ENTITIES: Record<string, any> = {
organizations, organizations,
@ -53,14 +45,8 @@ export const ADMIN_ENTITIES: Record<string, any> = {
teams, teams,
awards, awards,
timeline, timeline,
front_page: frontPage,
blog_posts: blogPosts, blog_posts: blogPosts,
community_page: communityPage, pages,
retreats_page: retreatsPage,
resources_page: resourcesPage,
organization_page: organizationPage,
history_page: historyPage,
shop_page: shopPage,
navigation: siteNav, navigation: siteNav,
site_settings: siteSettings, site_settings: siteSettings,
}; };
@ -77,14 +63,8 @@ export const PREVIEW_PATHS: Record<string, (row: any) => string | null> = {
teams: (row) => teamHref(row.id), teams: (row) => teamHref(row.id),
awards: (row) => awardHref(row.id), awards: (row) => awardHref(row.id),
timeline: () => "/history", timeline: () => "/history",
front_page: () => "/",
blog_posts: (row) => blogHref(row.id), blog_posts: (row) => blogHref(row.id),
community_page: () => "/community", pages: (row) => row.path || null,
retreats_page: () => "/retreats",
resources_page: () => "/resources",
organization_page: () => "/organization",
history_page: () => "/history",
shop_page: () => "/shop",
// The menus are on every page. // The menus are on every page.
navigation: () => "/", navigation: () => "/",
site_settings: () => "/", site_settings: () => "/",

View file

@ -46,7 +46,32 @@ export const blogPosts = {
idLabel: "URL ID", idLabel: "URL ID",
slugFrom: "title", slugFrom: "title",
// Blog posts → Import from Word (server/src/routes/import.js). // Blog posts → Import from Word (server/src/routes/import.js).
importer: { label: "Import from Word", endpoint: "/admin/import/docx", accept: ".docx" }, // `guide` is what becomes what (server/src/docx.js, docs/importing.md),
// shown beside the button.
importer: {
label: "Import from Word",
endpoint: "/admin/import/docx",
accept: ".docx",
guide: {
intro: "A .docx becomes a new, unpublished post. In the document:",
rows: [
["The Title style, or the first Heading 1", "The post's title"],
["A date line under it, eg. Sep 28, 2026", "The post's date"],
["Heading 1 and Heading 2", "Heading blocks"],
["Heading 3 and smaller", "Subheading blocks"],
["A line starting Tab:, eg. Tab: Overview (any style)", "A Tab: the post is split into tabs from there"],
["The Quote style", "A Quote (a dash and a name at the end is who said it)"],
["The Intense Quote style", "A Callout"],
["Bulleted or numbered paragraphs", "One List block"],
["Tables", "Table blocks"],
["A line of --- alone", "A Divider"],
["A YouTube, Vimeo or Facebook link alone on its line", "A Video"],
["Button: Register, with Register linked", "A Button, its label and link"],
["Other paragraphs", "Paragraphs, keeping bold, italic and links"],
],
outro: "Images, text boxes, footnotes, comments, colors and fonts aren't carried over: add images as Image blocks after. PDFs: save as .docx first.",
},
},
list: { list: {
columns: [ columns: [

View file

@ -1,306 +0,0 @@
import { mediaUrl } from "../media.ts";
import { featuredCardsChild } from "./shared.ts";
import { PATH_ICONS } from "../../data/pathIcons.ts";
/* ── Front page ──────────────────────────────────────────────────
One record (see the singleton note in server/src/admin-schema.js).
The groups are the hero; the collections below are the rest of
the page. Photos, the livestream and the featured video are
editable whatever the mode, so each can be ready before the
switch is flipped.
Section keys and stat sources are the CHECK lists on
front_page_sections and front_page_stats. The labels here are what the admin reads; the values are
what the page and the API key on. */
const FRONT_PAGE_SECTIONS = [
["countdown", "Event Countdown"],
["retreats", "Events Carousel (National Retreats)"],
["calendar", "Event Calendar"],
["stats", "Stats"],
["timeline", "Featured Timeline"],
["connect", "Connect Nav"],
["featured", "Featured Content"],
];
const STAT_SOURCES = [
["manual", "Print Value Field"],
["years_since", "Years Since Value"],
["regions", "Count: regions"],
["groups", "Count: groups"],
["partners", "Count: partners"],
["events_held", "Count: past events"],
["retreats_held", "Count: past retreats"],
["people", "Count: people in database"],
["awards_given", "Count: public awards given"],
];
export const frontPage = {
key: "front_page",
label: "Front page",
singular: "front page",
idLabel: "Page",
singleton: "home",
list: { columns: [], filters: [] },
groups: [
{
legend: "Hero - Primary Section",
note: "The first thing a visitor sees. Blank buttons don't render.",
fields: [
{
path: "hero_backdrop",
label: "Background",
widget: "select",
options: [
["brand", "Brand: animated color and the dove"],
["photos", "Photos: cycles through the photos below"],
],
blankLabel: "Default: brand",
help: "Photos with none added shows the brand background",
},
{
path: "hero_feature",
label: "Feature",
widget: "select",
options: [
["none", "Nothing: No additional overlay"],
["livestream", "Livestream: the stream, with a LIVE badge"],
["video", "Featured video: click to play"],
["event", "Featured event: an event's card"],
],
blankLabel: "Default: nothing",
help: "Switch to Livestream when you go live, and back when you're done",
},
{ path: "eyebrow", label: "Eyebrow", help: "Small line above the headline" },
{ path: "headline", label: "Headline", full: true },
{ path: "subhead", label: "Subhead", widget: "textarea", full: true },
{ path: "primary_label", label: "Main button label" },
{ path: "primary_url", label: "Main button link", help: "/page, #section-id or a full URL" },
{ path: "secondary_label", label: "Second button label" },
{ path: "secondary_url", label: "Second button link" },
],
},
{
legend: "Photos, livestream, video and event",
fields: [
{
path: "slide_seconds",
label: "Seconds per photo",
widget: "number",
help: "Photos Background. Set from 3 to 60 seconds",
},
{
path: "livestream_url",
label: "Livestream link",
full: true,
help: "A YouTube, Facebook or Vimeo link, or any embed URL",
},
{ path: "livestream_title", label: "Livestream title", full: true },
{
path: "video_url",
label: "Featured video",
full: true,
help:
"A YouTube, Vimeo or Facebook link, or a video file: a filename in " +
"the uploads folder, or a link ending in .mp4 or .webm",
},
{
path: "video_still",
label: "Video still",
widget: "image",
crop: 16 / 9,
resolve: mediaUrl,
full: true,
frameFrom: "video_url",
help: "Shown before it plays. Default: YouTube's own thumbnail, or a video file's first frame. Frame at takes a still from a YouTube or Facebook video.",
},
{
path: "video_captions",
label: "Video captions",
widget: "image",
folder: "captions",
resolve: mediaUrl,
full: true,
help: "A WebVTT (.vtt) file, for a video file; YouTube, Vimeo and Facebook show their own. Default: none.",
},
{ path: "video_title", label: "Video title", full: true, help: "Shown after \"Featured video\" above the headline" },
{
path: "hero_event_id",
label: "Featured event",
widget: "select",
optionsFrom: "events",
blankLabel: "Default: the countdown's event",
full: true,
help: "For the Featured event feature. A pinned event that's over falls back to the countdown's",
},
],
},
{
legend: "Countdown",
fields: [
{
path: "countdown_event_id",
label: "Count down to",
widget: "select",
optionsFrom: "events",
blankLabel: "Default: the next upcoming event",
help: "Leave blank almost always. A pinned event that's over falls back to the next one",
},
{
path: "countdown_scope_id",
label: "Only this scope",
widget: "select",
optionsFrom: "event_scopes",
blankLabel: "Default: any scope",
help: "Narrows the next upcoming event. Ignored when an event is pinned above",
},
{
path: "countdown_event_type",
label: "Only this type",
widget: "select",
options: [
["retreat", "Retreat"],
["class", "Class"],
["workshop", "Workshop"],
["meeting", "Meeting"],
["other", "Other"],
],
blankLabel: "Default: any type",
help: "Combines with the scope: National + Retreat counts down to the next national retreat",
},
],
},
{
legend: "Featured Content",
note: "The cards themselves are under Featured cards below, each with its own Size.",
fields: [
{
path: "featured_columns",
label: "Columns",
widget: "select",
options: [
["2", "2 across"],
["3", "3 across"],
["4", "4 across"],
],
blankLabel: "Default: 3 across",
help: "On a wide screen. Tablets show 2, phones 1",
},
],
},
],
children: [
{
key: "sections",
label: "Page sections",
note: "Drag to reorder. Each section can appear once; leave one out to drop it.",
addLabel: "Add section",
title: (row) =>
FRONT_PAGE_SECTIONS.find(([key]) => key === row.section)?.[1] ?? "New section",
blank: { section: "", title: "", blurb: "" },
fields: [
{
path: "section",
label: "Section",
widget: "select",
options: FRONT_PAGE_SECTIONS,
required: true,
},
{ 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" },
],
},
{
key: "slides",
label: "Hero photos",
note: "Shown in Photos mode, in this order.",
addLabel: "Add photo",
title: (row) => row.caption || row.media || "New photo",
blank: { media: "", alt: "", caption: "" },
fields: [
{ path: "media", label: "Photo", required: true, widget: "image", crop: 16 / 9, resolve: mediaUrl, full: true },
{ path: "alt", label: "Description", help: "For screen readers" },
{ path: "caption", label: "Caption", full: true },
{ path: "link_url", label: "Link", help: "Optional; makes the caption a link" },
],
},
{
key: "stats",
label: "Numbers",
note: "Counts update themselves. A typed-in number with no value is left out.",
addLabel: "Add number",
title: (row) => row.label || "New number",
blank: { label: "", source: "", value: "" },
fields: [
{ path: "label", label: "Label", required: true },
{
path: "source",
label: "Number Source",
widget: "select",
options: STAT_SOURCES,
blankLabel: "Default: Print Value",
},
{ path: "value", label: "Value", help: "The number thats printed" },
{ path: "suffix", label: "Suffix", help: "+, k, % …" },
{ path: "note", label: "Note", full: true },
],
},
{
...featuredCardsChild,
fields: [
...featuredCardsChild.fields,
{
path: "size",
label: "Size",
widget: "select",
options: [
["normal", "Normal: one cell"],
["wide", "Wide: two columns"],
["tall", "Tall: two rows"],
["large", "Large: two columns, two rows"],
],
blankLabel: "Default: automatic (the first of three or more is large)",
help: "On a wide screen. Phones show one card per row",
},
],
},
{
key: "paths",
label: "Connect Nav",
note: "Each path is a choice a visitor can pick; its actions appear when they do.",
addLabel: "Add path",
title: (row) => row.label || "New path",
blank: { label: "", icon: "", blurb: "" },
fields: [
{ path: "label", label: "Label", required: true, help: "eg. Attend, Serve…" },
{
path: "icon",
label: "Icon",
widget: "select",
options: PATH_ICONS,
blankLabel: "Default: a dot",
},
{ path: "blurb", label: "Blurb", full: true },
],
children: [
{
key: "actions",
label: "Actions",
addLabel: "Add action",
title: (row) => row.label || "New action",
blank: { label: "", url: "" },
fields: [
{ path: "label", label: "Label", required: true },
{ path: "url", label: "Link", required: true },
{ path: "description", label: "Description", full: true },
],
},
],
},
],
};

View file

@ -346,6 +346,45 @@ export const HREF_HELP = {
video: "The video's page, eg. https://www.youtube.com/watch?v=…, or a video file", video: "The video's page, eg. https://www.youtube.com/watch?v=…, or a video file",
}; };
/* Rotating words (084): text typed as {Next|Now|Rising} cycles
through its choices. These pick how, for a block or a hero; Site
settings → Animated words holds the defaults. */
export const WORD_MOTIONS = [
["slide", "Slide"],
["flip", "Flip, like a card"],
["fade", "Fade"],
["type", "Type, letter by letter"],
["mirror", "Mirror, turning round"],
];
export const WORD_DIRECTIONS = [
["bottom", "From the bottom"],
["top", "From the top"],
];
export const WORD_HELP = "Type choices in braces to rotate them, eg. {Next|Now|Rising} Generation of {Unity|New Thought}.";
/* The three fields, under `prefix` (eg. "hero."), shown `when`. */
export const wordFields = (prefix: string, label: string, when?: any) => [
{
path: `${prefix}word_motion`,
label: label ? `${label}rotating words` : "Rotating words",
widget: "select",
options: WORD_MOTIONS,
blankLabel: "Default: the site's (Site settings → Animated words)",
help: WORD_HELP,
when,
},
{
path: `${prefix}word_direction`,
label: label ? `${label}words come in` : "Words come in",
widget: "select",
options: WORD_DIRECTIONS,
blankLabel: "Default: the site's",
help: "For Slide and Flip",
when,
},
{ path: `${prefix}word_seconds`, label: label ? `${label}seconds per word` : "Seconds per word", widget: "number", help: "1 to 20. Default: the site's", when },
];
export const blocksChild = { export const blocksChild = {
key: "content_blocks", key: "content_blocks",
label: "Content blocks", label: "Content blocks",
@ -441,6 +480,7 @@ export const blocksChild = {
help: "Shows the team's members as tiles, its leads first. People added as items show after it.", help: "Shows the team's members as tiles, its leads first. People added as items show after it.",
when: { path: "type", value: "people" }, when: { path: "type", value: "people" },
}, },
...wordFields("", "", { path: "type", value: ["heading", "subheading", "paragraph", "callout", "quote"] }),
], ],
children: [ children: [
{ {

View file

@ -1,16 +1,10 @@
import siteConfiguration from "../../../site.json";
/* ── Navigation (075_site_nav.sql) ─────────────────────────────── /* ── Navigation (075_site_nav.sql) ───────────────────────────────
Pages → Navigation: the header's and footer's links, and each Pages → Navigation: the header's and footer's links. The pages
static page's title, intro and whether it's hidden. Admins and up themselves (titles, intros, Hidden, Disabled) are Page
save it, since hiding takes a page off the site. Server side: management's (sitePages.ts). Admins and up. Server side:
server/src/admin-schema/siteNav.js; the site reads it through server/src/admin-schema/siteNav.js; the site reads it through
server/src/siteNav.js and src/lib/useSiteNav.ts. */ server/src/siteNav.js and src/lib/useSiteNav.ts. */
const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).map(
([path, page]) => [path, `${page.title} (${path})`],
);
const PLACES: [string, string][] = [ const PLACES: [string, string][] = [
["main", "Header: pages"], ["main", "Header: pages"],
["action", "Header: buttons"], ["action", "Header: buttons"],
@ -36,7 +30,7 @@ export const siteNav = {
{ {
key: "links", key: "links",
label: "Links", label: "Links",
note: "Top to bottom, in the order each place shows them. A link to a hidden page is only shown to signed-in admin accounts. A header page lists its sections under it by itself (Pages → the page).", note: "Top to bottom, in the order each place shows them. A link to a hidden page is only shown to signed-in admin accounts, and one to a disabled page to no one. A header page lists its sections under it by itself (Pages → the page).",
addLabel: "Add link", addLabel: "Add link",
title: (row) => (row.label ? `${row.label} · ${placeLabel(row.place) ?? "No place"}` : "New link"), title: (row) => (row.label ? `${row.label} · ${placeLabel(row.place) ?? "No place"}` : "New link"),
blank: { place: "", label: "", path: "", parent_path: "", style: "", new_tab: 0 }, blank: { place: "", label: "", path: "", parent_path: "", style: "", new_tab: 0 },
@ -54,7 +48,7 @@ export const siteNav = {
path: "parent_path", path: "parent_path",
label: "Under page", label: "Under page",
widget: "select", widget: "select",
options: [["/", "Home (/)"], ...SITE_PAGES], optionsFrom: "site_pages",
blankLabel: "Default: its own place in the header", blankLabel: "Default: its own place in the header",
help: "Lists it in that page's menu, after its sections, instead of in the header's row", help: "Lists it in that page's menu, after its sections, instead of in the header's row",
when: { path: "place", value: "main" }, when: { path: "place", value: "main" },
@ -70,35 +64,5 @@ export const siteNav = {
{ path: "new_tab", label: "Opens in a new tab", widget: "checkbox" }, { path: "new_tab", label: "Opens in a new tab", widget: "checkbox" },
], ],
}, },
{
key: "pages",
label: "Pages",
note: "A page's heading and intro (also its search title and description), and whether it's hidden. A hidden page is out of the menus and the sitemap and says Not found to everyone but signed-in admin accounts, who see it with a bar saying it's hidden. Blank fields keep site.json's. A page not listed here shows as site.json has it.",
addLabel: "Add page",
title: (row) =>
`${SITE_PAGES.find(([path]) => path === row.path)?.[1] ?? "New page"}${row.is_hidden ? " · Hidden" : ""}`,
blank: { path: "", title: "", description: "", is_hidden: 0 },
fields: [
{ path: "path", label: "Page", widget: "select", options: SITE_PAGES, required: true },
{
path: "is_hidden",
label: "Hidden",
widget: "checkbox",
help: "Not found to everyone but signed-in admin accounts, eg. a page that isn't done",
},
{
path: "title",
label: "Title",
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.title ?? ""}` : undefined),
},
{
path: "description",
label: "Intro",
widget: "textarea",
full: true,
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.description ?? ""}` : undefined),
},
],
},
], ],
}; };

View file

@ -1,6 +1,6 @@
/* ── The site's own pages (056_site_pages.sql) ─────────────────── /* ── The site's pages (056_site_pages.sql, 080_page_registry.sql) ──
Pages → Community, Retreats, Resources, Organization, History, Pages → Page management: every page, its address, title, intro,
Shop (075): Hidden and Disabled, and new pages made here.
each page is its sections, in order, and each section is its 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 heading and its own content blocks, then a preset if it has one
(a prebuilt part of the site, drawn under the blocks). Server (a prebuilt part of the site, drawn under the blocks). Server
@ -8,9 +8,12 @@
src/pages/SitePage.tsx. src/pages/SitePage.tsx.
The preset values are the CHECK list on page_sections.preset; The preset values are the CHECK list on page_sections.preset;
each page offers the ones that belong on it. */ every page offers them all. The Community blog's settings show on
the Community page only (its id), for now. */
import { FEATURED_KINDS, featuredCardsChild, blocksChild } from "./shared.ts"; import { FEATURED_KINDS, featuredCardsChild, blocksChild, wordFields } from "./shared.ts";
import { mediaUrl } from "../media.ts";
import { PATH_ICONS } from "../../data/pathIcons.ts";
const PRESETS = { const PRESETS = {
community_blog: "Community blog (its settings are below)", community_blog: "Community blog (its settings are below)",
@ -19,7 +22,18 @@ const PRESETS = {
partner_list: "Organization cards (partners, ministries)", partner_list: "Organization cards (partners, ministries)",
events: "Event carousel or grid", events: "Event carousel or grid",
timeline: "Timeline", timeline: "Timeline",
people_directory: "People directory (a tag's people)", people_directory: "People directory (tabs of people tags)",
feedback_form: "Website feedback form",
request_form: "Request form",
data_request_form: "Data request form (see, correct or delete)",
giving: "Giving button (Church Center)",
qr_maker: "QR code maker",
hero: "Hero (headline, photos, video, livestream or event)",
countdown: "Event countdown",
calendar: "Event calendar",
stats: "Numbers",
featured_cards: "Featured cards",
connect: "Connect nav (paths to choose from)",
}; };
const ACCENT_OPTIONS = [ const ACCENT_OPTIONS = [
@ -37,6 +51,273 @@ const EVENT_TYPES = [
["other", "Other"], ["other", "Other"],
]; ];
/* Gates on the section's type. */
const IS = (preset) => ({ path: "preset", value: preset });
const STAT_SOURCES = [
["manual", "Print Value Field"],
["years_since", "Years Since Value"],
["regions", "Count: regions"],
["groups", "Count: groups"],
["partners", "Count: partners"],
["events_held", "Count: past events"],
["retreats_held", "Count: past retreats"],
["people", "Count: people in database"],
["awards_given", "Count: public awards given"],
];
/* The settings of the section types that need them (083): each shows
only for its type. A band draws its own heading from the section's
title and blurb. */
const BAND_FIELDS = [
{
path: "hero.backdrop",
label: "Hero: background",
widget: "select",
options: [
["brand", "Brand: animated color and the dove"],
["photos", "Photos: cycles through the hero photos below"],
],
blankLabel: "Default: brand",
help: "Photos with none added shows the brand background",
when: IS("hero"),
},
{
path: "hero.feature",
label: "Hero: feature",
widget: "select",
options: [
["none", "Nothing: No additional overlay"],
["livestream", "Livestream: the stream, with a LIVE badge"],
["video", "Featured video: click to play"],
["event", "Featured event: an event's card"],
],
blankLabel: "Default: nothing",
help: "Switch to Livestream when you go live, and back when you're done",
when: IS("hero"),
},
{ path: "hero.eyebrow", label: "Hero: eyebrow", help: "Small line above the headline", when: IS("hero") },
{ path: "hero.headline", label: "Hero: headline", full: true, when: IS("hero") },
{ path: "hero.subhead", label: "Hero: subhead", widget: "textarea", full: true, when: IS("hero") },
{ path: "hero.primary_label", label: "Hero: main button label", when: IS("hero") },
{ path: "hero.primary_url", label: "Hero: main button link", help: "/page, #section-id or a full URL", when: IS("hero") },
{ path: "hero.secondary_label", label: "Hero: second button label", when: IS("hero") },
{ path: "hero.secondary_url", label: "Hero: second button link", when: IS("hero") },
{ path: "hero.slide_seconds", label: "Hero: seconds per photo", widget: "number", help: "Photos background. 3 to 60. Default: 7", when: IS("hero") },
{ path: "hero.livestream_url", label: "Hero: livestream link", full: true, help: "A YouTube, Facebook or Vimeo link, or any embed URL", when: IS("hero") },
{ path: "hero.livestream_title", label: "Hero: livestream title", full: true, when: IS("hero") },
{
path: "hero.video_url",
label: "Hero: featured video",
full: true,
help: "A YouTube, Vimeo or Facebook link, or a video file: a filename in the uploads folder, or a link ending in .mp4 or .webm",
when: IS("hero"),
},
{
path: "hero.video_still",
label: "Hero: video still",
widget: "image",
crop: 16 / 9,
resolve: mediaUrl,
full: true,
frameFrom: "hero.video_url",
help: "Shown before it plays. Default: YouTube's own thumbnail, or a video file's first frame. Frame at takes a still from a YouTube or Facebook video.",
when: IS("hero"),
},
{
path: "hero.video_captions",
label: "Hero: video captions",
widget: "image",
folder: "captions",
resolve: mediaUrl,
full: true,
help: "A WebVTT (.vtt) file, for a video file; YouTube, Vimeo and Facebook show their own. Default: none.",
when: IS("hero"),
},
{ path: "hero.video_title", label: "Hero: video title", full: true, help: "Shown after \"Featured video\" above the headline", when: IS("hero") },
{
path: "hero.event_id",
label: "Hero: featured event",
widget: "select",
optionsFrom: "events",
blankLabel: "Default: the page's countdown's event",
full: true,
help: "For the Featured event feature. A pinned event that's over falls back to the countdown's",
when: IS("hero"),
},
...wordFields("hero.", "Hero: ", IS("hero")),
{
path: "countdown.event_id",
label: "Count down to",
widget: "select",
optionsFrom: "events",
blankLabel: "Default: the next upcoming event",
help: "Leave blank almost always. A pinned event that's over falls back to the next one",
when: IS("countdown"),
},
{
path: "countdown.scope_id",
label: "Countdown: only this scope",
widget: "select",
optionsFrom: "event_scopes",
blankLabel: "Default: any scope",
help: "Narrows the next upcoming event. Ignored when an event is pinned above",
when: IS("countdown"),
},
{
path: "countdown.event_type",
label: "Countdown: only this type",
widget: "select",
options: [
["retreat", "Retreat"],
["class", "Class"],
["workshop", "Workshop"],
["meeting", "Meeting"],
["other", "Other"],
],
blankLabel: "Default: any type",
help: "Combines with the scope: National + Retreat counts down to the next national retreat",
when: IS("countdown"),
},
{
path: "featured.columns",
label: "Featured cards: columns",
widget: "select",
options: [
["2", "2 across"],
["3", "3 across"],
["4", "4 across"],
],
blankLabel: "Default: 3 across",
help: "On a wide screen. Tablets show 2, phones 1",
when: IS("featured_cards"),
},
{ path: "blog.internal_title", label: "Blog: our posts' heading", help: "Default: From NGU", when: IS("community_blog") },
{ path: "blog.internal_slots", label: "Blog: our posts' slots", widget: "number", help: "0 to 12. Pinned posts first, then the newest. Default: 3", when: IS("community_blog") },
{ path: "blog.external_title", label: "Blog: community posts' heading", help: "Default: From our community", when: IS("community_blog") },
{ path: "blog.external_slots", label: "Blog: community posts' slots", widget: "number", help: "0 to 12. Pinned cards first, then the feeds' newest. Default: 3", when: IS("community_blog") },
{ path: "blog.external_url", label: "Blog: button link", help: "eg. https://ngu.substack.com", full: true, when: IS("community_blog") },
{ path: "blog.external_label", label: "Blog: button text", help: "Default: Read more on Substack", when: IS("community_blog") },
];
const BAND_CHILDREN = [
{
key: "slides",
label: "Hero photos",
note: "Shown with the Photos background, in this order.",
addLabel: "Add photo",
when: IS("hero"),
title: (row) => row.caption || row.media || "New photo",
blank: { media: "", alt: "", caption: "" },
fields: [
{ path: "media", label: "Photo", required: true, widget: "image", crop: 16 / 9, resolve: mediaUrl, full: true },
{ path: "alt", label: "Description", help: "For screen readers" },
{ path: "caption", label: "Caption", full: true },
{ path: "link_url", label: "Link", help: "Optional; makes the caption a link" },
],
},
{
key: "stats",
label: "Numbers",
note: "Counts update themselves. A typed-in number with no value is left out.",
addLabel: "Add number",
when: IS("stats"),
title: (row) => row.label || "New number",
blank: { label: "", source: "", value: "" },
fields: [
{ path: "label", label: "Label", required: true },
{ path: "source", label: "Number Source", widget: "select", options: STAT_SOURCES, blankLabel: "Default: Print Value" },
{ path: "value", label: "Value", help: "The number that's printed" },
{ path: "suffix", label: "Suffix", help: "+, k, % …" },
{ path: "note", label: "Note", full: true },
],
},
{
...featuredCardsChild,
label: "Featured cards",
when: IS("featured_cards"),
fields: [
...featuredCardsChild.fields,
{
path: "size",
label: "Size",
widget: "select",
options: [
["normal", "Normal: one cell"],
["wide", "Wide: two columns"],
["tall", "Tall: two rows"],
["large", "Large: two columns, two rows"],
],
blankLabel: "Default: automatic (the first of three or more is large)",
help: "On a wide screen. Phones show one card per row",
},
],
},
{
...featuredCardsChild,
label: "Blog: pinned community posts",
note: "Always shown, before the feeds' newest. Paste a post's link and press Fetch preview.",
addLabel: "Pin a post",
when: IS("community_blog"),
blank: { kind: "", url: "", title: "" },
fields: featuredCardsChild.fields.map((field) =>
field.path === "kind" ? { ...field, options: FEATURED_KINDS.filter(([kind]) => kind !== "record") } : field,
),
},
{
key: "blog_posts",
label: "Blog: pinned posts (ours)",
note: "Always shown, before the newest.",
addLabel: "Pin a post",
when: IS("community_blog"),
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 }],
},
{
key: "feeds",
label: "Blog: feeds",
note: "RSS or Atom feeds whose newest posts fill the community slots. Read about every 30 minutes.",
addLabel: "Add feed",
when: IS("community_blog"),
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" },
],
},
{
key: "paths",
label: "Connect nav: paths",
note: "Each path is a choice a visitor can pick; its actions appear when they do.",
addLabel: "Add path",
when: IS("connect"),
title: (row) => row.label || "New path",
blank: { label: "", icon: "", blurb: "" },
fields: [
{ path: "label", label: "Label", required: true, help: "eg. Attend, Serve…" },
{ path: "icon", label: "Icon", widget: "select", options: PATH_ICONS, blankLabel: "Default: a dot" },
{ path: "blurb", label: "Blurb", full: true },
],
children: [
{
key: "actions",
label: "Actions",
addLabel: "Add action",
title: (row) => row.label || "New action",
blank: { label: "", url: "" },
fields: [
{ path: "label", label: "Label", required: true },
{ path: "url", label: "Link", required: true },
{ path: "description", label: "Description", full: true },
],
},
],
},
];
const EVENTS = { path: "preset", value: "events" }; const EVENTS = { path: "preset", value: "events" };
const CARDS = { path: "preset", value: "partner_list" }; const CARDS = { path: "preset", value: "partner_list" };
@ -52,7 +333,7 @@ const sectionsChild = (presets: string[]) => ({
path: "title", path: "title",
label: "Title", label: "Title",
required: true, required: true,
help: "Up to 30 characters, so it fits the side nav. eg. Mission, Vision & Values", help: "Up to 30 characters, so it fits the side nav (60 on the front page). A band (hero, numbers...) draws it as its heading; the hero's isn't shown. eg. Mission, Vision & Values",
}, },
{ {
path: "anchor", path: "anchor",
@ -62,6 +343,7 @@ const sectionsChild = (presets: string[]) => ({
}, },
{ path: "blurb", label: "Blurb", widget: "textarea", full: true, help: "A line under the title" }, { 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" }, { path: "accent", label: "Accent", widget: "select", options: ACCENT_OPTIONS, blankLabel: "Default: Teal" },
{ path: "is_hidden", label: "Hidden", widget: "checkbox", help: "Left off the page for now, kept here." },
...(presets.length ...(presets.length
? [ ? [
{ {
@ -119,6 +401,19 @@ const sectionsChild = (presets: string[]) => ({
}, },
] ]
: []), : []),
...(presets.includes("timeline")
? [
{
path: "view",
label: "Shows",
widget: "select",
options: [["carousel", "A rail of the featured moments (the front page's)"]],
blankLabel: "Default: the whole timeline",
when: { path: "preset", value: "timeline" },
},
]
: []),
...BAND_FIELDS,
...(presets.includes("group_map") ...(presets.includes("group_map")
? [ ? [
{ {
@ -133,6 +428,7 @@ const sectionsChild = (presets: string[]) => ({
: []), : []),
], ],
children: [ children: [
...BAND_CHILDREN,
{ {
key: "tags", key: "tags",
label: "Directory: tags", label: "Directory: tags",
@ -162,94 +458,64 @@ const sectionsChild = (presets: string[]) => ({
], ],
}); });
const sitePage = (id: string, label: string, presets: string[], more: Record<string, any> = {}) => ({ const ALL_PRESETS = Object.keys(PRESETS);
key: `${id}_page`,
label,
singular: label.toLowerCase(),
idLabel: "Page",
singleton: id,
list: { columns: [], filters: [] }, /* Pages the site's own code links to: their address stays
(server/src/admin-schema/sitePages.js, CORE_PAGES). */
const CORE_PAGE_IDS = ["home", "give", "feedback", "request", "qr", "privacy", "terms"];
groups: [], export const pages = {
...more, key: "pages",
children: [sectionsChild(presets), ...(more.children ?? [])], label: "Page management",
}); singular: "page",
idLabel: "URL ID",
export const communityPage = sitePage( slugFrom: "title",
"community", // The server refuses to delete these (CORE_PAGES); no Delete button.
"Community page", undeletable: CORE_PAGE_IDS,
["community_blog", "group_map", "region_list", "partner_list", "people_directory"], // Every page's address, title, intro and switches, then its own
{ // sections, the front page's included (its hero and bands).
groups: [ list: {
{ columns: [
legend: "Community blog: our posts", { key: "title", label: "Page", primary: true },
note: "For the Community blog preset. Pinned posts first, then the newest published, listed posts, up to the number of slots.", { key: "path", label: "Address" },
fields: [ { key: "is_hidden", label: "Hidden", widget: "bool" },
{ path: "blog.internal_title", label: "Heading", help: "Default: From NGU" }, { key: "is_disabled", label: "Disabled", widget: "bool" },
{ 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" },
],
},
], ],
filters: [],
}, },
);
export const retreatsPage = sitePage("retreats", "Retreats page", ["events"]); groups: [
export const resourcesPage = sitePage("resources", "Resources page", ["people_directory"]); {
export const organizationPage = sitePage("organization", "Organization page", ["people_directory"]); legend: "The page",
export const historyPage = sitePage("history", "History page", ["timeline"]); fields: [
export const shopPage = sitePage("shop", "Shop page", []); { path: "title", label: "Title", required: true, help: "The page's heading, and its title in search and the browser tab, eg. Library" },
{
path: "path",
label: "Address",
required: true,
help: (row) =>
CORE_PAGE_IDS.includes(row?.id)
? "The site's own links point here, so this page's address stays."
: "Where it lives on the site, eg. /library. Lowercase letters, numbers, hyphens and /. Changing it breaks old links: update Navigation's too.",
readOnly: (row) => CORE_PAGE_IDS.includes(row?.id),
},
{ path: "description", label: "Intro", widget: "textarea", full: true, help: "The line under the title, and its description in search." },
{
path: "is_hidden",
label: "Hidden",
widget: "checkbox",
help: "Not found to everyone but signed-in admin accounts, eg. a page that isn't done. Out of the menus and the sitemap.",
},
{
path: "is_disabled",
label: "Disabled",
widget: "checkbox",
help: "Out of the menus, the sitemap and search; its address still works for anyone with the link.",
},
{ path: "sort_order", label: "Order", widget: "number", help: "Where its card sits on the admin home, lowest first. Default: 0" },
],
},
],
children: [sectionsChild(ALL_PRESETS)],
};

View file

@ -1,6 +1,7 @@
import siteConfiguration from "../../../site.json"; import siteConfiguration from "../../../site.json";
import { mediaUrl } from "../media.ts"; import { mediaUrl } from "../media.ts";
import { THEME_DEFAULTS } from "../../../server/src/themeDefaults.js"; import { THEME_DEFAULTS } from "../../../server/src/themeDefaults.js";
import { WORD_DIRECTIONS, WORD_HELP, WORD_MOTIONS } from "./shared.ts";
/* ── Site settings (035_site_settings.sql) ─────────────────────── /* ── Site settings (035_site_settings.sql) ───────────────────────
Overrides for site.json, superadmins only: every blank falls back Overrides for site.json, superadmins only: every blank falls back
@ -110,18 +111,6 @@ export const siteSettings = {
}, },
], ],
}, },
{
legend: "Privacy",
fields: [
{
path: "privacy_email",
label: "Privacy contact email",
help: `The Privacy page gives this for privacy questions and data requests, eg. privacy@nextgenerationofunity.org. ${
siteConfiguration.privacyEmail ? `Default: ${siteConfiguration.privacyEmail}` : "Default: none, the page offers its request form only"
}.`,
},
],
},
{ {
legend: "Access (Google groups)", legend: "Access (Google groups)",
note: "Anyone in one of these Workspace groups can sign in to the admin with Google; their account is made at first sign-in, with the highest role their groups give. Their role follows the groups (checked at sign-in, hourly, and by Panel → Re-sync now); out of every group, the account is disabled. Superadmins and accounts made with admin-cli aren't affected. Needs GOOGLE_DIRECTORY_AS on the server (docs/google-sign-in.md).", note: "Anyone in one of these Workspace groups can sign in to the admin with Google; their account is made at first sign-in, with the highest role their groups give. Their role follows the groups (checked at sign-in, hourly, and by Panel → Re-sync now); out of every group, the account is disabled. Superadmins and accounts made with admin-cli aren't affected. Needs GOOGLE_DIRECTORY_AS on the server (docs/google-sign-in.md).",
@ -170,6 +159,25 @@ export const siteSettings = {
}, },
], ],
}, },
{
legend: "Planning Center",
fields: [
{
path: "pco_list_id",
label: "People list",
help: "The Planning Center list Data → Planning Center brings in: its number, from the list's address in Planning Center People, eg. 1234567. Needs PCO_APP_ID and PCO_SECRET on the server (docs/planning-center.md).",
},
],
},
{
legend: "Animated words",
note: WORD_HELP + " Works in the hero's headline, section titles, headings and paragraphs. These are the defaults; a hero or a block can set its own. Visitors who ask for less motion see the first word, still.",
fields: [
{ path: "word_motion", label: "Motion", widget: "select", options: WORD_MOTIONS, blankLabel: "Default: Slide" },
{ path: "word_direction", label: "Words come in", widget: "select", options: WORD_DIRECTIONS, blankLabel: "Default: from the bottom", help: "For Slide and Flip" },
{ path: "word_seconds", label: "Seconds per word", widget: "number", help: "1 to 20. Default: 3" },
],
},
{ {
legend: "Notices", legend: "Notices",
fields: [ fields: [

View file

@ -13,7 +13,7 @@
renders as its own name, so a CHECK is enough. renders as its own name, so a CHECK is enough.
Adding a type is three edits: the CHECKs in a migration (on Adding a type is three edits: the CHECKs in a migration (on
events.event_type and front_page.countdown_event_type), the enums events.event_type and section_countdown.event_type), the enums
in both descriptor halves (the event's type and the front page's in both descriptor halves (the event's type and the front page's
countdown type), and this list. Adding it here alone countdown type), and this list. Adding it here alone
means the site offers a filter the database will refuse to store. means the site offers a filter the database will refuse to store.

View file

@ -1,38 +0,0 @@
/* ═══════════════════════════════════════════════════════════════
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
}
}

View file

@ -3,39 +3,28 @@
dropdowns, the mobile menu and the footer's site map dropdowns, the mobile menu and the footer's site map
Every page's list comes from the page itself, so adding, moving Every page's list comes from the page itself, so adding, moving
or renaming a section changes the menus too: the site pages' or renaming a section changes the menus too (Pages → Page
sections (Pages → each page, GET /site-pages), and the front management, GET /site-pages), the front page's included. The hero
page's bands it is showing, in the admin's order, each under its and a countdown aren't listed: they're the top of a page, not a
heading (Front page → Sections). place to jump to (sections/Bands.tsx).
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { useCallback } from 'react' import { useCallback } from 'react'
import { useSitePageHeadings } from './useSitePages.ts' import { useSitePageHeadings } from './useSitePages.ts'
import { useFrontPage } from './useFrontPage.ts' import { UNLISTED_PRESETS } from '../pages/sections/Bands.tsx'
import { FRONT_PAGE_BANDS, bandShows } from './frontPageBands.ts' import { firstWords } from '../lib/words.ts'
export type NavSection = { label: string; hash: string } export type NavSection = { label: string; hash: string }
export function useNavSections(): (path: string) => NavSection[] { export function useNavSections(): (path: string) => NavSection[] {
const { data: page } = useFrontPage()
const { data: sitePages } = useSitePageHeadings() const { data: sitePages } = useSitePageHeadings()
return useCallback( return useCallback(
(path: string) => { (path: string) =>
if (path !== '/') { (sitePages?.[path] ?? [])
return (sitePages?.[path.slice(1)] ?? []).map((section) => ({ .filter((section) => !UNLISTED_PRESETS.includes(section.preset ?? ''))
label: section.title, .map((section) => ({ label: firstWords(section.title), hash: `#${section.anchor}` })),
hash: `#${section.anchor}`, [sitePages],
}))
}
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],
) )
} }

View file

@ -38,6 +38,7 @@
import { readableOn } from './color.ts' import { readableOn } from './color.ts'
import { PLATFORMS } from './platforms.ts' import { PLATFORMS } from './platforms.ts'
import { firstWords } from '../lib/words.ts'
export type NewsletterItem = { export type NewsletterItem = {
title: string title: string
@ -186,7 +187,8 @@ const imageTag = (src: string, alt: string) =>
`<img src="${escape(src)}" width="552" alt="${escape(alt)}" style="display:block;margin:0 auto;width:100%;max-width:552px;height:auto;border:0;">` `<img src="${escape(src)}" width="552" alt="${escape(alt)}" style="display:block;margin:0 auto;width:100%;max-width:552px;height:auto;border:0;">`
function blockHtml(block: NewsletterPart, n: Newsletter): string { function blockHtml(block: NewsletterPart, n: Newsletter): string {
const text = block.text?.trim() ?? '' // An email can't animate: rotating words ({Next|Now}) are their first.
const text = firstWords(block.text).trim()
const href = block.href ? safeHref(block.href, n) : null const href = block.href ? safeHref(block.href, n) : null
const items = block.items ?? [] const items = block.items ?? []
const align = alignOf(block) const align = alignOf(block)
@ -412,7 +414,7 @@ export function newsletterHtml(n: Newsletter): string {
} }
function blockText(block: NewsletterPart, n: Newsletter): string[] { function blockText(block: NewsletterPart, n: Newsletter): string[] {
const text = block.text?.trim() ?? '' const text = firstWords(block.text).trim()
const items = block.items ?? [] const items = block.items ?? []
const link = (url: string) => safeHref(url, n) ?? url const link = (url: string) => safeHref(url, n) ?? url
switch (block.type) { switch (block.type) {

View file

@ -1,16 +1,11 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
FRONT PAGE DATA SECTION TYPES' DATA
GET /front-page, as routes/home.js shapes it: the hero, the What a band section's `data` holds (server/src/sectionData.js,
visible sections in order, counted stats, paths with actions, in GET /site-pages/:id): a hero, a countdown's event, stats, a
and the countdown's event. Edited in the admin under Front page. pathfinder's paths, featured cards. sections/Bands.tsx draws them.
No fallback content. If the request fails the page says so: a
plausible default home page would hide a broken server behind
something that looks fine.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { useRecord, type Resource } from './useRecord.ts'
import type { EventSeries } from './eventSeries.ts' import type { EventSeries } from './eventSeries.ts'
import type { Link } from './useContent.ts' import type { Link } from './useContent.ts'
@ -20,16 +15,6 @@ export type HeroBackdrop = 'brand' | 'photos'
/** What sits beside the words, over the backdrop. */ /** What sits beside the words, over the backdrop. */
export type HeroFeature = 'none' | 'livestream' | 'video' | 'event' export type HeroFeature = 'none' | 'livestream' | 'video' | 'event'
/** The CHECK list on front_page_sections.section. */
export type FrontPageSectionKey =
| 'countdown'
| 'retreats'
| 'calendar'
| 'stats'
| 'timeline'
| 'connect'
| 'featured'
export type HeroButton = { label: string; url: string } export type HeroButton = { label: string; url: string }
export type HeroSlide = { export type HeroSlide = {
@ -53,18 +38,13 @@ export type Hero = {
/** A link to embed or a video file; see videoSource in embeds.ts. */ /** A link to embed or a video file; see videoSource in embeds.ts. */
/** `still` is shown before it plays; resolve it with mediaUrl. */ /** `still` is shown before it plays; resolve it with mediaUrl. */
video: { url: string; title?: string | null; captions?: string | null; still?: string | null } | null video: { url: string; title?: string | null; captions?: string | null; still?: string | null } | null
/** With the 'event' feature: the pinned event, else the countdown's. */ /** With the 'event' feature: the pinned event, else the page's countdown's. */
event: HeroEvent | null event: HeroEvent | null
/** Its rotating words' own motion (084), else the site's. */
words?: { motion?: any; direction?: any; seconds?: number | null } | null
} }
export type FrontPageSection = { export type SectionStat = {
section: FrontPageSectionKey
/** Null → the section's own heading. */
title?: string | null
blurb?: string | null
}
export type FrontPageStat = {
label: string label: string
/** Already counted or typed; never null, since the API drops those. */ /** Already counted or typed; never null, since the API drops those. */
value: string value: string
@ -74,7 +54,7 @@ export type FrontPageStat = {
export type PathAction = { label: string; description?: string | null; url: string } export type PathAction = { label: string; description?: string | null; url: string }
export type FrontPagePath = { export type SectionPath = {
label: string label: string
icon?: string | null icon?: string | null
blurb?: string | null blurb?: string | null
@ -122,17 +102,3 @@ export type HeroEvent = CountdownEvent & {
org_logo?: string | null org_logo?: string | null
links: Link[] links: Link[]
} }
export type FrontPage = {
hero: Hero
sections: FrontPageSection[]
stats: FrontPageStat[]
paths: FrontPagePath[]
featured: FeaturedCard[]
/** Columns across on a wide screen; null is the grid's default. */
featured_columns: FeaturedColumns | null
countdown: CountdownEvent | null
}
export const useFrontPage = (): Resource<FrontPage> =>
useRecord<FrontPage>('/front-page', 'front_page')

View file

@ -10,8 +10,9 @@
serves the plain index.html, it isn't there and site.json alone serves the plain index.html, it isn't there and site.json alone
applies. applies.
A page's visible heading and intro and its search title and A page's heading and intro are its site_pages row's (Pages → Page
description come from the same values, so they can't drift. management), which also give its search title and description, so
they can't drift: useSiteNav and the page's own data carry them.
SITE_ORIGIN is the public address of the live site. It's used SITE_ORIGIN is the public address of the live site. It's used
where a URL has to leave the browser and still work: a printed QR where a URL has to leave the browser and still work: a printed QR
@ -22,9 +23,10 @@
import siteConfiguration from '../../site.json' import siteConfiguration from '../../site.json'
type PageText = { title: string; description: string } /** How rotating words move (RotatingWords.tsx, 084). */
export type WordSettings = { motion: 'slide' | 'flip' | 'fade' | 'type' | 'mirror'; direction: 'top' | 'bottom'; seconds: number }
type SiteText = { title?: string; pages?: Record<string, PageText>; privacyEmail?: string; requestFiles?: boolean } type SiteText = { title?: string; requestFiles?: boolean; words?: Partial<WordSettings> | null }
/* What the server wrote into the page, if it did. */ /* What the server wrote into the page, if it did. */
const fromServer: SiteText = const fromServer: SiteText =
@ -34,9 +36,13 @@ export const SITE_NAME: string = fromServer.title || siteConfiguration.title
export const SITE_ORIGIN: string = siteConfiguration.url export const SITE_ORIGIN: string = siteConfiguration.url
/** Where privacy questions and data requests go (Panel → Site /** Rotating words' defaults: Site settings → Animated words, else
* settings, else site.json). Blank: the Privacy page's form only. */ * sliding up from the bottom, three seconds a word. */
export const PRIVACY_EMAIL: string = fromServer.privacyEmail ?? siteConfiguration.privacyEmail export const WORD_DEFAULTS: WordSettings = {
motion: fromServer.words?.motion || 'slide',
direction: fromServer.words?.direction || 'bottom',
seconds: fromServer.words?.seconds || 3,
}
/** Whether the Request form takes files (Google Drive is set up on /** Whether the Request form takes files (Google Drive is set up on
* the server). Unknown (the Vite dev server) offers them, and the * the server). Unknown (the Vite dev server) offers them, and the
@ -46,18 +52,6 @@ export const REQUEST_FILES: boolean = fromServer.requestFiles ?? true
/** A site path as a full URL on the live site. */ /** A site path as a full URL on the live site. */
export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href 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]
if (!page) throw new Error(`site.json has no "pages" entry for ${path}`)
return page
}
/** The browser tab's title for a page: "Retreats | Next Generation /** The browser tab's title for a page: "Retreats | Next Generation
* of Unity", or the site name alone for the home page. */ * of Unity", or the site name alone for the home page. */
export const documentTitle = (title?: string | null): string => export const documentTitle = (title?: string | null): string =>

View file

@ -1,15 +1,16 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
BLOG DATA BLOG DATA
GET /blog/:id and GET /community-blog, as routes/blog.js shapes GET /blog/:id, as routes/blog.js shapes it, and what a Community
them. The section's community posts arrive as featured cards, so blog section shows (its `data`, server/src/sectionData.js). The
section's community posts arrive as featured cards, so
FeaturedCards.tsx draws them unchanged. FeaturedCards.tsx draws them unchanged.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { detailPath } from './hrefs.ts' import { detailPath } from './hrefs.ts'
import { useRecord, type Resource } from './useRecord.ts' import { useRecord, type Resource } from './useRecord.ts'
import type { ContentBlock } from './useContent.ts' import type { ContentBlock } from './useContent.ts'
import type { FeaturedCard } from './useFrontPage.ts' import type { FeaturedCard } from './sectionTypes.ts'
export type BlogAuthor = { export type BlogAuthor = {
id: string id: string
@ -59,8 +60,6 @@ export type CommunityBlog = {
export const useBlogPost = (id?: string | null): Resource<BlogPostRecord> => export const useBlogPost = (id?: string | null): Resource<BlogPostRecord> =>
useRecord<BlogPostRecord>(detailPath('/blog', id), 'post') useRecord<BlogPostRecord>(detailPath('/blog', id), 'post')
export const useCommunityBlog = (): Resource<CommunityBlog> =>
useRecord<CommunityBlog>('/community-blog', 'community_blog')
/** '2026-09-01' → 'September 1, 2026'. Parsed as a local date, so /** '2026-09-01' → 'September 1, 2026'. Parsed as a local date, so
* it can't slip a day in a timezone west of UTC. */ * it can't slip a day in a timezone west of UTC. */

View file

@ -12,7 +12,7 @@
*/ */
import type { BlogPostSummary } from './useBlog.ts' import type { BlogPostSummary } from './useBlog.ts'
import type { FeaturedCard } from './useFrontPage.ts' import type { FeaturedCard } from './sectionTypes.ts'
import { detailPath } from './hrefs.ts' import { detailPath } from './hrefs.ts'
import { useRecord, type Resource } from './useRecord.ts' import { useRecord, type Resource } from './useRecord.ts'
import type { EventType } from './eventTypes.ts' import type { EventType } from './eventTypes.ts'
@ -24,6 +24,8 @@ import type { EventSeries } from './eventSeries.ts'
export type ContentBlock = { export type ContentBlock = {
id?: number | string id?: number | string
slot?: 'card' | 'body' slot?: 'card' | 'body'
/** Its rotating words' own motion (084), else the site's. */
words?: { motion?: any; direction?: any; seconds?: number | null } | null
type: type:
| 'heading' | 'heading'
| 'subheading' | 'subheading'

View file

@ -1,12 +1,15 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
SITE NAV: the header's and footer's links, and the hidden pages SITE NAV: the site's pages, the header's and footer's links, and
the hidden pages
Pages → Navigation, for this visitor (server/src/siteNav.js): a Pages → Page management and Pages → Navigation, for this visitor
link to a hidden page is only sent to a viewer and up. The page (server/src/siteNav.js): a hidden page, and links to it, are only
HTML carries it (window.__SITE__.nav), so the menus draw on the sent to a viewer and up; a disabled page's links to no one. The
first paint; GET /api/nav asks again, which is also how the dev page HTML carries it (window.__SITE__.nav), so the menus draw on
server (no page metadata) and a sign-in in another tab get it. the first paint; GET /api/nav asks again, which is also how the
Until either answers, navConfig.ts's defaults. dev server (no page metadata) and a sign-in in another tab get it.
Until either answers, navConfig.ts's links, and no pages yet
(`ready` false).
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { useMemo } from 'react' import { useMemo } from 'react'
@ -14,9 +17,20 @@ import { useMemo } from 'react'
import { NAV_DEFAULTS, type NavLink } from '../navConfig.ts' import { NAV_DEFAULTS, type NavLink } from '../navConfig.ts'
import { useRecord } from './useRecord.ts' import { useRecord } from './useRecord.ts'
/** A page of the site (site_pages). */
export type SitePageInfo = {
id: string
path: string
title: string
description: string | null
hidden: boolean
disabled: boolean
}
export type SiteNav = { export type SiteNav = {
links: NavLink[] links: NavLink[]
/** Paths of hidden pages, eg. '/shop'. */ pages: SitePageInfo[]
/** Paths of hidden pages, eg. '/shop' (sent to a viewer and up only). */
hidden: string[] hidden: string[]
/** This visitor sees hidden pages (signed in, viewer and up). */ /** This visitor sees hidden pages (signed in, viewer and up). */
seesHidden: boolean seesHidden: boolean
@ -25,7 +39,7 @@ export type SiteNav = {
const fromPage: SiteNav | undefined = const fromPage: SiteNav | undefined =
typeof window !== 'undefined' ? (window as unknown as { __SITE__?: { nav?: SiteNav } }).__SITE__?.nav : undefined typeof window !== 'undefined' ? (window as unknown as { __SITE__?: { nav?: SiteNav } }).__SITE__?.nav : undefined
const DEFAULTS: SiteNav = { links: NAV_DEFAULTS, hidden: [], seesHidden: false } const DEFAULTS: SiteNav = { links: NAV_DEFAULTS, pages: [], hidden: [], seesHidden: false }
/** A path's page: no #section or ?query, no trailing slash. */ /** A path's page: no #section or ?query, no trailing slash. */
export const pageOf = (path: string): string => path.split(/[?#]/)[0].replace(/(.)\/+$/, '$1') || '/' export const pageOf = (path: string): string => path.split(/[?#]/)[0].replace(/(.)\/+$/, '$1') || '/'
@ -38,19 +52,24 @@ export function useSiteNav() {
const main = nav.links.filter((l) => l.place === 'main') const main = nav.links.filter((l) => l.place === 'main')
const top = main.filter((l) => !l.parent) const top = main.filter((l) => !l.parent)
const tops = new Set(top.map((l) => pageOf(l.path))) const tops = new Set(top.map((l) => pageOf(l.path)))
const byPath = new Map(nav.pages.map((page) => [page.path, page]))
return { return {
...nav, ...nav,
/** Whether the pages have arrived (else a page can't be told from a missing one). */
ready: Boolean(data ?? fromPage),
/** The header's pages, each with the links set under it. */ /** The header's pages, each with the links set under it. */
main: top.map((page) => ({ main: top.map((page) => ({
...page, ...page,
children: main.filter((l) => l.parent && l.parent === pageOf(page.path)), children: main.filter((l) => l.parent && l.parent === pageOf(page.path)),
})), })),
/** Every main link, children included, for lists of the site's pages. */ /** Every main link, children included, for lists of the site's pages. */
pages: main.filter((l) => !l.parent || tops.has(l.parent)), pageLinks: main.filter((l) => !l.parent || tops.has(l.parent)),
actions: nav.links.filter((l) => l.place === 'action'), actions: nav.links.filter((l) => l.place === 'action'),
footer: nav.links.filter((l) => l.place === 'footer'), footer: nav.links.filter((l) => l.place === 'footer'),
legal: nav.links.filter((l) => l.place === 'legal'), legal: nav.links.filter((l) => l.place === 'legal'),
isHidden: (path: string) => nav.hidden.includes(pageOf(path)), isHidden: (path: string) => nav.hidden.includes(pageOf(path)),
/** The page at this path, or null. */
pageAt: (path: string): SitePageInfo | null => byPath.get(pageOf(path)) ?? null,
} }
}, [nav]) }, [nav, data])
} }

View file

@ -1,7 +1,7 @@
/* The site's own pages (Community, Retreats, Resources, Organization, /* The site's pages of sections (Pages → Page management): GET
History), built in the admin from sections: GET /site-pages/:id /site-pages/:id for one page's title, intro and sections, GET
for one page's sections, GET /site-pages for every page's section /site-pages for every page's section headings by the page's path
headings (the header's dropdowns, the footer, the side nav). */ (the header's dropdowns, the footer, the side nav). */
import { useRecord, type Resource } from './useRecord.ts' import { useRecord, type Resource } from './useRecord.ts'
import type { ContentBlock } from './useContent.ts' import type { ContentBlock } from './useContent.ts'
@ -21,11 +21,14 @@ export type SitePageSection = {
org_kinds?: string | null org_kinds?: string | null
/** Organization cards: a hand-picked list, in order, shown instead. */ /** Organization cards: a hand-picked list, in order, shown instead. */
org_ids: string[] org_ids: string[]
/** What its type shows beyond its blocks (server/src/sectionData.js):
* a hero, a countdown's event, stats, paths, featured cards, a blog. */
data?: any
blocks: ContentBlock[] blocks: ContentBlock[]
} }
export const useSitePage = (id: string): Resource<{ id: string; sections: SitePageSection[] }> => export const useSitePage = (id: string): Resource<{ id: string; title: string; description: string | null; sections: SitePageSection[] }> =>
useRecord(`/site-pages/${id}`, 'page') useRecord(`/site-pages/${id}`, 'page')
export const useSitePageHeadings = (): Resource<Record<string, Array<{ anchor: string; title: string }>>> => export const useSitePageHeadings = (): Resource<Record<string, Array<{ anchor: string; title: string; preset: string | null }>>> =>
useRecord('/site-pages', 'pages') useRecord('/site-pages', 'pages')

10
src/lib/words.ts Normal file
View file

@ -0,0 +1,10 @@
/* Rotating words as plain text (src/components/RotatingWords.tsx
draws them moving): a group typed as {Next|Now|Rising}. */
/** {A|B} groups in a text. */
export const WORD_GROUP = /\{([^{}|\n]+(?:\|[^{}|\n]+)+)\}/g
/** The text as plain words, each group its first choice: for menus,
* tab titles, emails and anywhere that can't move. */
export const firstWords = (text?: string | null): string =>
(text ?? '').replace(WORD_GROUP, (_, group: string) => group.split('|')[0].trim())

View file

@ -1,47 +0,0 @@
import PageShell from "../components/PageShell.tsx";
import { sitePage } from "../lib/site.ts";
import FeedbackForm from "./sections/FeedbackForm.tsx";
import { BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/feedback");
/* ═══════════════════════════════════════════════════════════════
Feedback page.
Section ids match the nav hashes. Right now there's one:
#website. Add more entries to SECTIONS as the page grows,
program feedback, retreat surveys, etc.
The form itself lives in sections/FeedbackForm, including its
own type list, location picker, and the POST to /api/feedback.
This file only decides where it sits on the page.
═══════════════════════════════════════════════════════════════ */
const SECTIONS = [
{
id: "website",
title: "Website Feedback",
blurb:
"Found a broken link, spotted something out of date, or want the site to do something it doesn't? This form goes straight to the people who maintain it.",
accent: BRAND,
content: (
// Narrower than the usual max-w-6xl: full-width form fields
// are unpleasant to fill in.
<div className="mx-auto max-w-3xl px-6">
<FeedbackForm />
</div>
),
},
];
export default function Feedback() {
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={SECTIONS}
/>
);
}

View file

@ -1,96 +0,0 @@
import { useEffect } from "react";
import PageShell from "../components/PageShell.tsx";
import { sitePage } from "../lib/site.ts";
import { BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/give");
const GIVING_URL =
"https://ngu.churchcenteronline.com/giving?open-in-church-center-modal=true";
const MODAL_SCRIPT_SRC = "https://js.churchcenter.com/modal/v1";
function useChurchCenterModal() {
useEffect(() => {
if (document.querySelector(`script[src="${MODAL_SCRIPT_SRC}"]`)) return;
const script = document.createElement("script");
script.src = MODAL_SCRIPT_SRC;
script.async = true;
document.head.appendChild(script);
// Deliberately not removed on unmount: the script registers a
// document-level click handler, and tearing it down on every
// route change would mean re-fetching it on the way back.
}, []);
}
/* ═══════════════════════════════════════════════════════════════
GIVING SECTION
═══════════════════════════════════════════════════════════════ */
function GivingPanel() {
return (
<div className="max-w-2xl mx-auto px-6 text-center">
<p className="text-body leading-relaxed">
Gifts are processed securely through Church Center. The form opens
right here on the page and you can give once or set up a recurring
gift, and you don&rsquo;t need an account to do either.
</p>
<a
href={GIVING_URL}
className="
mt-8 inline-flex items-center justify-center
btn px-10 py-4
text-base font-semibold tracking-wide text-white
shadow-sm transition
hover:brightness-110 hover:shadow-md
focus-visible:outline-none focus-visible:ring-2
focus-visible:ring-offset-2
motion-reduce:transition-none
"
style={{ backgroundColor: BRAND, "--tw-ring-color": BRAND } as React.CSSProperties}
>
Give through Church Center
</a>
<p className="mt-4 text-sm text-muted">
If you would like to send a check, please email our Board Treasurer at{" "}
<a href="mailto:treasurer@nextgenerationofunity.org" className="text-link underline">
treasurer@nextgenerationofunity.org
</a>{" "}
to get an address.
</p>
</div>
);
}
/* ═══════════════════════════════════════════════════════════════
PAGE
═══════════════════════════════════════════════════════════════ */
export default function GivingPage() {
useChurchCenterModal();
const sections = [
{
id: "give",
title: "Give to NGU",
blurb:
"Your giving funds scholarships, retreats, leadership development and the continued growth of the Next Generation of Unity leaders, teachers and community members.",
accent: BRAND,
content: <GivingPanel />,
},
];
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={sections}
/>
);
}

View file

@ -1,129 +0,0 @@
/* ═══════════════════════════════════════════════════════════════
HOME: /
Not a PageShell page: the front page has no title bar, and each
band draws its own heading in its own style.
Driven by the admin's Front page editor through GET /front-page.
The hero comes first, always. After it, the bands in the order
the admin dragged them into, minus any they hid. Which component
draws a band is decided here, in SECTIONS, keyed on the same list
the CHECK on front_page_sections holds, the database says "retreats,
third, called National Retreats"; this file says what a retreats
band looks like.
A band with nothing to show draws nothing: the countdown with no
upcoming event, the numbers with no numbers, the timeline with
nothing featured, the pathfinder with no paths, the featured band
with no cards.
If /front-page fails, the hero still draws (empty) and the error
takes the place of the bands, with a retry. There's deliberately
no default page to fall back to: it would look fine and hide a
broken server.
═══════════════════════════════════════════════════════════════ */
import { useEffect, type ReactNode } from 'react'
import HeroStage from './sections/home/HeroStage.tsx'
import NextEventCountdown from './sections/home/NextEventCountdown.tsx'
import RetreatsBand from './sections/home/RetreatsBand.tsx'
import CalendarBand from './sections/home/CalendarBand.tsx'
import StatsBand from './sections/home/StatsBand.tsx'
import FeaturedBand from './sections/home/FeaturedBand.tsx'
import FeaturedTimelineRail from './sections/home/FeaturedTimelineRail.tsx'
import Pathfinder from './sections/home/Pathfinder.tsx'
import { get } from '../lib/api.ts'
import { documentTitle } from '../lib/site.ts'
import {
useFrontPage,
type FrontPage,
type FrontPageSection,
type FrontPageSectionKey,
} from '../lib/useFrontPage.ts'
import { FRONT_PAGE_BANDS, bandShows } from '../lib/frontPageBands.ts'
import './sections/home/home.css'
type BandProps = {
page: FrontPage
section: FrontPageSection
title: string
/** Position among the visible bands, 0 = straight after the hero. */
position: number
}
/* 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} columns={page.featured_columns} />
),
}
export default function Home() {
const { data: page, error, reload } = useFrontPage()
// The bands below ask for the timeline once the front page has said
// which of them to show. Start it now, alongside it: api.ts hands the
// same request to the band when it mounts, so the page waits for one
// round trip instead of two. Events aren't fetched ahead: each band
// asks the server for only its own, so there's no one list to start.
useEffect(() => {
get('/history').catch(() => {})
}, [])
// Back to the site name when a visitor returns here from a page.
useEffect(() => {
document.title = documentTitle()
}, [])
return (
<>
<HeroStage hero={page?.hero ?? null} />
{error && (
<section className="px-6 py-24 text-center">
<p className="text-danger">Couldn’t load the front page. {error}</p>
<button
type="button"
onClick={reload}
className="mt-4 btn border border-brand px-5 py-2 text-link hover:bg-tint"
>
Try again
</button>
</section>
)}
{page?.sections.map((section, position) => {
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}>
{render({
page,
section,
title: section.title || FRONT_PAGE_BANDS[section.section].title,
position,
})}
</div>
)
})}
</>
)
}

View file

@ -2,7 +2,7 @@
NOT FOUND: any address no route matches NOT FOUND: any address no route matches
Rather than a dead end, the closest pages to the address that Rather than a dead end, the closest pages to the address that
failed: the static pages (site.json's) and every public, listed failed: the site's pages (Page management's) and every public, listed
record (GET /directory), scored by suggest.ts against the record (GET /directory), scored by suggest.ts against the
address. So /organisation offers Organization, /retreat offers address. So /organisation offers Organization, /retreat offers
Retreats, and an old /chapters/lynnwood offers the Lynnwood group. Retreats, and an old /chapters/lynnwood offers the Lynnwood group.
@ -18,8 +18,7 @@ import { useMemo } from 'react'
import { Link, useLocation } from 'react-router-dom' import { Link, useLocation } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx' import PageShell from '../components/PageShell.tsx'
import { useSiteNav } from '../lib/useSiteNav.ts' import { useSiteNav, type SitePageInfo } from '../lib/useSiteNav.ts'
import { SITE_PAGES } from '../lib/site.ts'
import { useDirectory, type Directory } from '../lib/useContent.ts' import { useDirectory, type Directory } from '../lib/useContent.ts'
import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts' import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts'
import { suggest, type Candidate } from '../lib/suggest.ts' import { suggest, type Candidate } from '../lib/suggest.ts'
@ -36,12 +35,12 @@ const ORG_KIND_LABEL: Record<string, string> = {
/* Everything an address could have meant: the static pages (not the /* Everything an address could have meant: the static pages (not the
hidden ones), then each kind of record, with the words to match hidden ones), then each kind of record, with the words to match
it by. */ it by. */
function candidates(directory: Directory | null, isHidden: (path: string) => boolean): Candidate[] { function candidates(directory: Directory | null, sitePages: SitePageInfo[]): Candidate[] {
const pages: Candidate[] = Object.entries(SITE_PAGES).filter(([path]) => !isHidden(path)).map(([path, page]) => ({ const pages: Candidate[] = sitePages.filter((page) => !page.hidden && page.path !== '/').map((page) => ({
href: path, href: page.path,
label: page.title, label: page.title,
detail: 'Page', detail: 'Page',
keys: [path.slice(1), page.title], keys: [page.path.slice(1), page.title],
})) }))
if (!directory) return pages if (!directory) return pages
@ -66,10 +65,10 @@ function candidates(directory: Directory | null, isHidden: (path: string) => boo
export default function NotFound() { export default function NotFound() {
const { pathname } = useLocation() const { pathname } = useLocation()
const { data: directory, loading } = useDirectory() const { data: directory, loading } = useDirectory()
const { main: pages, isHidden } = useSiteNav() const { main: pages, pages: sitePages } = useSiteNav()
const matches = useMemo( const matches = useMemo(
() => suggest(pathname, candidates(directory ?? null, isHidden)), () => suggest(pathname, candidates(directory ?? null, sitePages)),
[pathname, directory, isHidden], [pathname, directory, sitePages],
) )
const reading = useReadingMode() const reading = useReadingMode()

26
src/pages/PageAtPath.tsx Normal file
View file

@ -0,0 +1,26 @@
/* ═══════════════════════════════════════════════════════════════
PAGE AT PATH: any address the record routes don't take
Pages → Page management decides what's where: the site_pages row
at this path (useSiteNav), drawn as its sections (SitePage). The
front page is the index route, SitePage too. No page there
(or a hidden one, below viewer, which isn't sent): Not found.
═══════════════════════════════════════════════════════════════ */
import { useLocation } from 'react-router-dom'
import { useSiteNav } from '../lib/useSiteNav.ts'
import NotFound from './NotFound.tsx'
import SitePage from './SitePage.tsx'
export default function PageAtPath() {
const { pathname } = useLocation()
const { ready, pageAt } = useSiteNav()
// Before the pages arrive (the dev server's first moment), nothing
// rather than a Not found that turns into the page.
if (!ready) return null
const page = pageAt(pathname)
if (!page || page.path === '/') return <NotFound />
return <SitePage key={page.id} id={page.id} />
}

View file

@ -1,215 +0,0 @@
import { Link } from "react-router-dom";
import LegalText, { type LegalPart } from "../components/LegalText.tsx";
import PageShell from "../components/PageShell.tsx";
import { DATA_REQUEST } from "../data/feedbackTypes.ts";
import { PRIVACY_EMAIL, sitePage } from "../lib/site.ts";
import FeedbackForm from "./sections/FeedbackForm.tsx";
import { BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/privacy");
/* ═══════════════════════════════════════════════════════════════
Privacy policy, cookie notice included.
What it says must stay true of the code: what the feedback and
request forms store (routes/feedback.js, routes/requests.js), what the browser keeps (Banner,
PrivacyNotice, the theme toggle), which embeds wait for a click
(VideoPlayer, HeroStage, ScheduleBlock), and that nothing about
a minor is shown. Change the date when the wording changes.
The contact address is Panel → Site settings → Privacy contact
email. Requests from the form below are feedback rows of type
'privacy', in Admin → Forms → Data requests.
═══════════════════════════════════════════════════════════════ */
const LAST_UPDATED = "October 3, 2026";
const link = "underline underline-offset-2 text-link";
const contact = PRIVACY_EMAIL ? (
<>
email <a className={link} href={`mailto:${PRIVACY_EMAIL}`}>{PRIVACY_EMAIL}</a> or use the{" "}
<a className={link} href="#requests">request form</a> below
</>
) : (
<>
use the <a className={link} href="#requests">request form</a> below
</>
);
const PARTS: LegalPart[] = [
{
id: "summary",
heading: "In short",
body: [
"We collect some information about the people who use this site and take part in Next Generation of Unity (NGU). We use it to run our programs and this website, we don't sell it, and we don't use advertising or tracking cookies.",
<>If you want to see, correct or delete what we hold about you, {contact}.</>,
],
},
{
id: "what-we-collect",
heading: "What we collect",
body: ["Depending on how you use the site and our programs:"],
list: [
<>
<strong>Feedback and requests you send.</strong> Your message, the page it's about, and, if you
give them, your name and email. With it we keep your browser's description (its user agent) and
a scrambled form of your IP address that can't be turned back into the address; we use it only to
spot abuse. Files you attach to a <Link to="/request" className={link}>request</Link> are kept with it.
</>,
<>
<strong>People on the site.</strong> Leaders, speakers and volunteers can appear with a name,
photo, role, short bio and public contact details. Staff may also keep private details, such as a
birth date, private email, phone number or address, which are never shown on the site and can
only be seen by our editors.
</>,
<>
<strong>Server records.</strong> Like most websites, our server keeps short-lived logs of
requests (the page asked for, the time, and the IP address that asked) to keep the site running
and secure.
</>,
<>
<strong>Staff accounts.</strong> For NGU staff and volunteers who sign in to edit the site: name,
email, role, and a record of sign-ins. Passwords are stored only in a form that can't be read back.
</>,
],
},
{
id: "minors",
heading: "Young people",
body: [
"We don't show information about anyone under 18 on this site: no names, photos or details. If you believe something about a minor appears here, tell us and we'll take it down.",
],
},
{
id: "how-we-use",
heading: "How we use it",
body: [
"To answer you, to run our retreats, groups and other programs, to keep this site accurate and working, and to keep it secure. We don't sell or rent your information, and we don't use it for advertising.",
],
},
{
id: "ai",
heading: "Artificial intelligence",
body: [
"We used AI tools to help write this website's code and build its structure. Those tools have no access to our database. Information you give us, and information we hold about the people in our community, is not given to AI systems, and isn't used to train them.",
],
},
{
id: "third-parties",
heading: "Other services",
body: [
"We try not to rely on other companies, but a few parts of the site are provided by them. When you use those parts, what you enter or do there goes to that company and is covered by its own privacy policy:",
],
list: [
<>
<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
Maps. Nothing from them loads until you press play or choose to show the map.
</>,
<>
<strong>Links</strong> to social media, Substack and other sites take you to those sites, which
follow their own rules.
</>,
<>
<strong>Staff sign-in</strong> can use a Google account on our own domain.
</>,
<>
<strong>Files attached to requests</strong> are stored in our Google Workspace (Google Drive), and
our staff may be told of a new request by email through it.
</>,
],
after: [
"This site runs on a server we rent and manage ourselves; your information is stored there, not with an outside website service, apart from request files as above.",
],
},
{
id: "cookies",
heading: "Cookies and browser storage",
body: [
<>
This site doesn't use advertising or tracking cookies, and doesn't use Google Analytics. To see which
pages are read, we use{" "}
<a href="https://plausible.io" className="text-link underline underline-offset-2">
Plausible Analytics
</a>
, which we host ourselves on our own server using its free, open-source{" "}
<a
href="https://github.com/plausible/community-edition/"
className="text-link underline underline-offset-2"
>
Community Edition
</a>
: 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.",
"Whether you chose the light or dark look.",
"Your accessibility choices: the dyslexia-friendly font, reading mode and color blind mode.",
"For staff who sign in: a sign-in cookie that keeps you signed in, and a short-lived one used while signing in with Google.",
],
after: [
"None of these are shared with anyone. If you press play on a video or show a map, that service (YouTube, Facebook, Vimeo or Google) may set its own cookies from then on. You can clear all of this in your browser's settings at any time.",
],
},
{
id: "your-rights",
heading: "Your choices",
body: [
<>
You can ask to see the information we hold about you, to correct it, or to have it deleted. To do
that, {contact}. We may ask you to confirm it's you before we change or delete anything, and we'll
tell you when it's done. Some records we may need to keep, such as records of gifts that the law
requires; if so, we'll say which and why.
</>,
],
},
{
id: "changes",
heading: "Changes to this policy",
body: [
<>
If we change how we handle information, we'll update this page and the date at the top. See also
our <Link className={link} to="/terms">Terms of Service</Link>.
</>,
],
},
];
const SECTIONS = [
{
id: "privacy",
title: "Privacy Policy",
blurb: `Last updated: ${LAST_UPDATED}`,
accent: BRAND,
content: <LegalText parts={PARTS} />,
},
{
id: "requests",
title: "Data requests",
blurb: "Ask to see, correct or delete the information we hold about you.",
accent: BRAND,
content: (
<div className="mx-auto max-w-3xl px-6">
<FeedbackForm fixedType={DATA_REQUEST.id} />
</div>
),
},
];
export default function PrivacyPage() {
return <PageShell title={PAGE.title} intro={PAGE.description} sections={SECTIONS} />;
}

View file

@ -1,41 +0,0 @@
import PageShell from '../components/PageShell.tsx'
import { sitePage } from '../lib/site.ts'
import QrCodeMaker from './sections/QrCodeMaker.tsx'
import { BRAND } from '../lib/color.ts'
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage('/qr')
/* ═══════════════════════════════════════════════════════════════
QR CODES PAGE: /qr
A QR code for any page on the site, for flyers, slides and
signs. Unlisted: not in Pages → Navigation's links, so neither
the header nor the footer links here. It lists only published records, so there is
nothing on it a visitor couldn't already reach.
═══════════════════════════════════════════════════════════════ */
const SECTIONS = [
{
id: 'make',
title: 'Make a QR code',
blurb:
'Pick a page from the main navigation, any event, organization, team, award, person or blog post, or type any link. Site pages always point at the live site. Choose what sits in the center and the colors; a warning shows if the code might not scan.',
accent: BRAND,
content: (
<div className="mx-auto max-w-6xl px-6">
<QrCodeMaker />
</div>
),
},
]
export default function QrCodes() {
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={SECTIONS}
/>
)
}

View file

@ -1,32 +0,0 @@
import PageShell from "../components/PageShell.tsx";
import { sitePage } from "../lib/site.ts";
import RequestForm from "./sections/RequestForm.tsx";
import { BRAND } from "../lib/color.ts";
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/request");
/* ═══════════════════════════════════════════════════════════════
Request page: ask for something to be added to the site or
changed on it. The form (sections/RequestForm) reads ?type= to
start on one kind of request; requestLink() makes those links.
═══════════════════════════════════════════════════════════════ */
const SECTIONS = [
{
id: "request",
title: "Send a request",
blurb:
"Tell us what you'd like on the site, or what should change. Attach a Word document with the details and we'll take it from there.",
accent: BRAND,
content: (
<div className="mx-auto max-w-3xl px-6">
<RequestForm />
</div>
),
},
];
export default function Request() {
return <PageShell title={PAGE.title} intro={PAGE.description} sections={SECTIONS} />;
}

View file

@ -1,24 +1,35 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
SITE PAGE: /community, /retreats, /resources, /organization, SITE PAGE: every page of the site, the front page included
/history
Each is a list of sections built in the admin (Pages → the page, Each is a list of sections built in the admin (Pages → Page
GET /site-pages/:id). A section is its heading, then its own management, GET /site-pages/:id). A section is its heading, then
content blocks, then its preset if it has one: a prebuilt part of its own content blocks, then its preset if it has one: a prebuilt
the site, from PRESETS below. A section with neither says it's part of the site, from PRESETS below. A section with neither says
coming (ComingSoon) rather than showing a heading over nothing. it's coming (ComingSoon) rather than showing a heading over
nothing. A band (the hero, the countdown, the numbers...:
sections/Bands.tsx) draws itself, heading and all.
The title and intro are site.json's, which also gives the search Two layouts:
metadata. the front page no title bar: the bands one after another, as
they always were, and any other section as a
band of its own in the same style
any other page PageShell: the title and intro, then each
section under its heading (a band without one,
since it draws its own)
The title and intro are its site_pages row's (Pages → Page
management), which also give the search metadata.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { useEffect } from 'react' import { useEffect } from 'react'
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx' import PageShell from '../components/PageShell.tsx'
import { documentTitle } from '../lib/site.ts'
import { bandFor, UNLISTED_PRESETS } from './sections/Bands.tsx'
import ComingSoon from '../components/ComingSoon.tsx' import ComingSoon from '../components/ComingSoon.tsx'
import ContentBlocks from '../components/ContentBlocks.tsx' import ContentBlocks from '../components/ContentBlocks.tsx'
import { sitePage } from '../lib/site.ts' import { useSiteNav } from '../lib/useSiteNav.ts'
import { useSectionManifest } from '../lib/sections.tsx' import { useSectionManifest } from '../lib/sections.tsx'
import { useSitePage, type SitePageSection } from '../lib/useSitePages.ts' import { useSitePage, type SitePageSection } from '../lib/useSitePages.ts'
import { useHistory } from '../lib/useHistory.ts' import { useHistory } from '../lib/useHistory.ts'
@ -32,6 +43,8 @@ import EventListCards, { EventCardsToggle } from './sections/EventList-Cards.tsx
import CommunityBlog from './sections/CommunityBlog.tsx' import CommunityBlog from './sections/CommunityBlog.tsx'
import HistoryTimeline from './sections/history/HistoryTimeline.tsx' import HistoryTimeline from './sections/history/HistoryTimeline.tsx'
import { DirectoryTabs, DIRECTORY_PREVIEW } from './sections/PeopleDirectory.tsx' import { DirectoryTabs, DIRECTORY_PREVIEW } from './sections/PeopleDirectory.tsx'
import { DataRequestSection, FeedbackSection, GivingSection, QrSection, RequestSection } from './sections/FormSections.tsx'
import { Words } from '../components/RotatingWords.tsx'
/* Year the program starts: decades ending before it get the /* Year the program starts: decades ending before it get the
pre-program look on the timeline. */ pre-program look on the timeline. */
@ -44,9 +57,10 @@ const PROGRAM_START_YEAR = 2000
const NO_EVENT_REQUEST_SCOPES = ['national'] const NO_EVENT_REQUEST_SCOPES = ['national']
const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>> = { const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>> = {
community_blog: () => ({ community_blog: (section) => ({
Component: CommunityBlog, Component: CommunityBlog,
request: { type: 'blog', label: 'Write for the blog' }, request: { type: 'blog', label: 'Write for the blog' },
props: { blog: section.data },
}), }),
group_map: (section) => ({ group_map: (section) => ({
Component: OrgListMap, Component: OrgListMap,
@ -94,13 +108,25 @@ const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>>
Component: DirectoryTabs, Component: DirectoryTabs,
props: { tags: section.tag_ids, limit: DIRECTORY_PREVIEW }, props: { tags: section.tag_ids, limit: DIRECTORY_PREVIEW },
}), }),
// What used to be whole pages (081): FormSections.tsx.
feedback_form: () => ({ Component: FeedbackSection }),
request_form: () => ({ Component: RequestSection }),
data_request_form: () => ({ Component: DataRequestSection }),
giving: () => ({ Component: GivingSection }),
qr_maker: () => ({ Component: QrSection }),
} }
export default function SitePage({ id }: { id: string }) { /* The front page's id (site_pages). */
const PAGE = sitePage(`/${id}`) export const HOME = 'home'
const { data: page, loading, error } = useSitePage(id)
if (page) return <Sections title={PAGE.title} intro={PAGE.description} sections={page.sections} /> export default function SitePage({ id }: { id: string }) {
const { data: page, loading, error, reload } = useSitePage(id)
// Its title and intro: its own data, or the nav's until that comes.
const known = useSiteNav().pages.find((p) => p.id === id)
const PAGE = { title: page?.title ?? known?.title ?? '', description: page?.description ?? known?.description ?? undefined }
if (id === HOME) return <FrontPage sections={page?.sections ?? null} error={error} reload={reload} />
if (page) return <Sections title={PAGE.title} intro={PAGE.description ?? undefined} sections={page.sections} />
return ( return (
<> <>
@ -127,8 +153,21 @@ function Sections({ title, intro, sections }: { title: string; intro?: string; s
}, [hash]) }, [hash])
const manifest = useSectionManifest( const manifest = useSectionManifest(
sections.map((section) => { sections.map((section, index) => {
const accent = ACCENTS[section.accent ?? 'teal'] ?? BRAND const accent = ACCENTS[section.accent ?? 'teal'] ?? BRAND
// A band draws itself, heading and all: no heading of the shell's.
const band = bandFor(section)
if (band) {
const node = band(section, { afterHero: sections[index - 1]?.preset === 'hero' })
return {
id: section.anchor,
title: section.title,
accent,
bare: true,
unlisted: UNLISTED_PRESETS.includes(section.preset ?? ''),
Component: () => node,
}
}
const preset = section.preset ? PRESETS[section.preset]?.(section) : null const preset = section.preset ? PRESETS[section.preset]?.(section) : null
return { return {
id: section.anchor, id: section.anchor,
@ -146,6 +185,74 @@ function Sections({ title, intro, sections }: { title: string; intro?: string; s
return <PageShell sideNav title={title} intro={intro} sections={manifest} /> return <PageShell sideNav title={title} intro={intro} sections={manifest} />
} }
/* The front page: its bands one after another, under no title bar. A
section that isn't a band is one in the same style: its heading,
then its blocks and preset. If the page can't load, the error
takes the bands' place, with a retry: there's deliberately no
default page to fall back to, which would hide a broken server. */
function FrontPage({ sections, error, reload }: { sections: SitePageSection[] | null; error: string | null; reload: () => void }) {
const { hash } = useLocation()
useEffect(() => {
if (hash) jumpTo(decodeURIComponent(hash.slice(1)))
}, [hash, sections])
// Back to the site name when a visitor returns here from a page.
useEffect(() => {
document.title = documentTitle()
}, [])
if (error) {
return (
<section className="px-6 py-24 text-center">
<p className="text-danger">Couldn’t load the front page. {error}</p>
<button type="button" onClick={reload} className="mt-4 btn border border-brand px-5 py-2 text-link hover:bg-tint">
Try again
</button>
</section>
)
}
if (!sections) return null
return (
<>
{sections.map((section, index) => {
const band = bandFor(section)
return (
<div key={section.anchor}>
{band ? band(section, { afterHero: sections[index - 1]?.preset === 'hero' }) : <PlainBand section={section} />}
</div>
)
})}
</>
)
}
/* A section on the front page that isn't a band: the bands' heading,
then its blocks and preset as on any page. */
function PlainBand({ section }: { section: SitePageSection }) {
const accent = ACCENTS[section.accent ?? 'teal'] ?? BRAND
const preset = section.preset ? PRESETS[section.preset]?.(section) : null
const views = preset?.views
return (
<section id={section.anchor} className="py-24">
<div className="mx-auto mb-12 max-w-6xl px-6">
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
<Words text={section.title} />
</h2>
{section.blurb && <p className="mt-3 max-w-xl text-lg text-muted">{section.blurb}</p>}
</div>
<SectionBody
blocks={section.blocks}
title={section.title}
Preset={preset?.Component}
presetProps={preset?.props}
accent={accent}
{...(views ? { view: views.default } : {})}
/>
</section>
)
}
function SectionBody({ blocks, title, Preset, presetProps, ...rest }: any) { function SectionBody({ blocks, title, Preset, presetProps, ...rest }: any) {
if (!blocks.length && !Preset) return <ComingSoon what={`our ${title}`} /> if (!blocks.length && !Preset) return <ComingSoon what={`our ${title}`} />
return ( return (

View file

@ -1,93 +0,0 @@
import { Link } from "react-router-dom";
import LegalText, { type LegalPart } from "../components/LegalText.tsx";
import PageShell from "../components/PageShell.tsx";
import { sitePage } from "../lib/site.ts";
import { BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/terms");
/* Change the date when the wording changes. */
const LAST_UPDATED = "September 28, 2026";
const link = "underline underline-offset-2 text-link";
const PARTS: LegalPart[] = [
{
id: "using-the-site",
heading: "Using this site",
body: [
"This website belongs to Next Generation of Unity (NGU). By using it you agree to these terms. If you don't agree, please don't use the site.",
"You're welcome to read, share and link to anything here. Please don't try to break or overload the site, get into parts of it you haven't been given access to, or use it to break the law.",
],
},
{
id: "our-content",
heading: "Our content",
body: [
"The words, logos, photos and videos on this site belong to NGU or to the people who made them, and are used with permission. You can share them for personal and non-commercial use with credit to NGU. For anything else, including using our name or logo, ask us first.",
],
},
{
id: "what-you-send",
heading: "What you send us",
body: [
"When you send feedback or a request, you let us use it to answer you and to improve the site and our programs. Please don't send anything unlawful, abusive, or someone else's private information.",
],
},
{
id: "programs-and-giving",
heading: "Programs, events and giving",
body: [
"Dates, places and details of retreats and other events can change. The event's organizers have the final word, and registering for an event may come with its own terms.",
"Gifts are made through Church Center (Planning Center), under its terms. Questions about a gift can come to us.",
],
},
{
id: "other-sites",
heading: "Other sites",
body: [
"We link to and show videos, maps and posts from other sites. We don't control them and aren't responsible for what they say or do; their own terms and privacy policies apply.",
],
},
{
id: "staff-accounts",
heading: "Staff accounts",
body: [
"Accounts for editing the site are for NGU staff and volunteers we've set up. Keep your password and sign-in to yourself. We can change or close an account at any time.",
],
},
{
id: "no-guarantees",
heading: "No guarantees",
body: [
"We work to keep this site accurate and running, but it's provided as it is, without guarantees that it will always be available, complete or free of mistakes. To the extent the law allows, NGU isn't liable for losses that come from using it.",
],
},
{
id: "changes",
heading: "Changes",
body: [
<>
We may update these terms; the date at the top says when they last changed. How we handle personal
information is in our <Link className={link} to="/privacy">Privacy Policy</Link>, and you can reach
us through the <Link className={link} to="/feedback">feedback form</Link>.
</>,
],
},
];
const SECTIONS = [
{
id: "terms",
title: "Terms of Service",
blurb: `Last updated: ${LAST_UPDATED}`,
accent: BRAND,
content: <LegalText parts={PARTS} />,
},
];
export default function TermsPage() {
return <PageShell title={PAGE.title} intro={PAGE.description} sections={SECTIONS} />;
}

View file

@ -23,7 +23,9 @@
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { ArrowRight, ArrowUpRight } from "@phosphor-icons/react"; import { ArrowRight, ArrowUpRight } from "@phosphor-icons/react";
import { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { get } from "../../lib/api.ts";
import { useAuth } from "../../lib/auth.tsx"; import { useAuth } from "../../lib/auth.tsx";
import { useWideAdminPage } from "../../lib/adminWidth.tsx"; import { useWideAdminPage } from "../../lib/adminWidth.tsx";
import { SITE_VERSION, VERSION_NAME } from "../../lib/version.ts"; import { SITE_VERSION, VERSION_NAME } from "../../lib/version.ts";
@ -40,6 +42,8 @@ const tintOf = (color: string) => `color-mix(in srgb, ${color} 12%, var(--color-
function NavCard({ item, color }) { function NavCard({ item, color }) {
const to = target(item); const to = target(item);
// The group's banner (Page management): the whole row, a stronger fill.
const banner = Boolean(item.banner);
// Drop the child that just repeats the card's own destination: // Drop the child that just repeats the card's own destination:
// "All organizations" under Organizations. // "All organizations" under Organizations.
@ -47,11 +51,13 @@ function NavCard({ item, color }) {
return ( return (
<div <div
className="group relative flex flex-col border-l-4 p-5 shadow-sm transition-shadow hover:shadow-md" className={`group relative flex flex-col border-l-4 p-5 shadow-sm transition-shadow hover:shadow-md ${
style={{ borderColor: color, background: tintOf(color) }} banner ? "sm:col-span-2 xl:col-span-3" : ""
}`}
style={{ borderColor: color, background: banner ? `color-mix(in srgb, ${color} 22%, var(--color-surface))` : tintOf(color) }}
> >
<div className="flex items-baseline gap-3"> <div className="flex items-baseline gap-3">
<h3 className="text-base font-bold text-link"> <h3 className={`font-bold text-link ${banner ? "text-lg" : "text-base"}`}>
<Link <Link
to={to} to={to}
className="after:absolute after:inset-0 after:content-['']" className="after:absolute after:inset-0 after:content-['']"
@ -127,10 +133,32 @@ const QUICK_ADD = [
{ to: "/admin/timeline/new", label: "New timeline entry" }, { to: "/admin/timeline/new", label: "New timeline entry" },
]; ];
/* A card per page (Pages → Page management), in its order. */
function usePageCards() {
const [cards, setCards] = useState<any[]>([]);
useEffect(() => {
get("/admin/pages?limit=200", { ttl: 0 })
.then((list) =>
setCards(
list.rows.map((page) => ({
to: `/admin/pages/${page.id}`,
label: page.title,
blurb: [page.path, page.is_hidden ? "Hidden" : null, page.is_disabled ? "Disabled" : null]
.filter(Boolean)
.join(" · "),
})),
),
)
.catch(() => setCards([]));
}, []);
return cards;
}
export default function AdminHome() { export default function AdminHome() {
const { user } = useAuth(); const { user } = useAuth();
const role = ROLE_LABELS[user?.role] ?? user?.role; const role = ROLE_LABELS[user?.role] ?? user?.role;
useWideAdminPage(); useWideAdminPage();
const pageCards = usePageCards();
return ( return (
<div className="grid gap-8 lg:grid-cols-[1fr_17rem] lg:items-start"> <div className="grid gap-8 lg:grid-cols-[1fr_17rem] lg:items-start">
@ -142,9 +170,15 @@ export default function AdminHome() {
{GROUPS.map(({ nav, color }) => ( {GROUPS.map(({ nav, color }) => (
<CardBlock key={nav.label} title={nav.label} blurb={nav.blurb} color={color}> <CardBlock key={nav.label} title={nav.label} blurb={nav.blurb} color={color}>
{visibleItems(nav.children, user).map((item) => ( {visibleItems(nav.children, user)
<NavCard key={item.to} item={item} color={color} /> .flatMap((item) =>
))} // Every page gets a card of its own after the banner.
item.banner
? [<NavCard key={item.to} item={item} color={color} />, ...pageCards.map((card) => (
<NavCard key={card.to} item={card} color={color} />
))]
: [<NavCard key={item.to} item={item} color={color} />],
)}
</CardBlock> </CardBlock>
))} ))}

View file

@ -35,7 +35,8 @@ import { blocksChild, BLOCK_TYPES } from '../../lib/adminSchema/shared.ts'
import { Repeater } from '../../components/admin/fields.tsx' import { Repeater } from '../../components/admin/fields.tsx'
import NewsletterRecipients from '../../components/admin/NewsletterRecipients.tsx' import NewsletterRecipients from '../../components/admin/NewsletterRecipients.tsx'
import { useEvents } from '../../lib/eventData.ts' import { useEvents } from '../../lib/eventData.ts'
import { useFrontPage, type FeaturedCard } from '../../lib/useFrontPage.ts' import type { FeaturedCard } from '../../lib/sectionTypes.ts'
import { useSitePage } from '../../lib/useSitePages.ts'
import type { BlogPostRecord } from '../../lib/useBlog.ts' import type { BlogPostRecord } from '../../lib/useBlog.ts'
import { blogHref, eventHref, refHref } from '../../lib/hrefs.ts' import { blogHref, eventHref, refHref } from '../../lib/hrefs.ts'
import { mediaUrl } from '../../lib/media.ts' import { mediaUrl } from '../../lib/media.ts'
@ -274,8 +275,11 @@ export default function AdminNewsletter() {
const [message, setMessage] = useState<{ tone: 'ok' | 'error'; text: string } | null>(null) const [message, setMessage] = useState<{ tone: 'ok' | 'error'; text: string } | null>(null)
const { events, loading: eventsLoading } = useEvents({ status: 'upcoming' }) const { events, loading: eventsLoading } = useEvents({ status: 'upcoming' })
const { data: frontPage } = useFrontPage() // The front page's featured cards: its featured card sections'.
const cards = frontPage?.featured ?? [] const { data: frontPage } = useSitePage('home')
const cards: FeaturedCard[] = (frontPage?.sections ?? [])
.filter((section) => section.preset === 'featured_cards')
.flatMap((section) => section.data?.cards ?? [])
useEffect(() => { useEffect(() => {
get('/admin/blog_posts?is_published=1&is_listed=1&limit=200', { ttl: 0 }) get('/admin/blog_posts?is_published=1&is_listed=1&limit=200', { ttl: 0 })

View file

@ -0,0 +1,240 @@
/* ═══════════════════════════════════════════════════════════════
ADMIN: PLANNING CENTER (Data → Planning Center, admins and up)
One Planning Center People list into the site's people, by hand
(server/src/planningCenter.js). Compare fetches the list and shows
each member: the site person they're linked to, or the one
suggested (same email, else same name), and the fields that would
change, Planning Center's value winning. For each, choose: link
(and update), another person, a new unpublished person, or skip.
Nothing is written until Apply.
═══════════════════════════════════════════════════════════════ */
import { useEffect, useMemo, useState } from "react";
import { Link } from "react-router-dom";
import { ApiError, get, post } from "../../lib/api.ts";
const MUTED = "var(--color-muted)";
const button =
"btn border border-brand px-4 py-2 text-sm text-link transition-colors hover:bg-tint disabled:cursor-default disabled:opacity-50";
const primary =
"btn bg-action px-5 py-2.5 text-white transition-colors hover:bg-action-hover disabled:bg-muted/25";
const input =
"border border-muted/25 bg-surface px-2 py-1.5 text-sm text-body outline-none focus:border-brand focus:ring-2 focus:ring-brand/25";
type Member = { id: string; first: string; last: string; name: string; email: string | null; phone: string | null };
type Row = {
pco: Member;
match: { person_id: string; name: string; how: "linked" | "email" | "name" } | null;
changes: { field: string; label: string; site: string | null; pco: string }[];
};
/* What the admin picked for a member: a person id, "new", or "" (skip). */
type Choice = { target: string; update: boolean };
const HOW: Record<string, string> = {
linked: "Linked",
email: "Suggested: same email",
name: "Suggested: same name",
};
const message = (err: unknown) => (err instanceof ApiError ? err.message : "Couldn't reach the server.");
export default function AdminPco() {
const [status, setStatus] = useState<{ ready: boolean; list_id: string | null } | null>(null);
const [rows, setRows] = useState<Row[] | null>(null);
const [people, setPeople] = useState<{ id: string; label: string }[]>([]);
const [choices, setChoices] = useState<Record<string, Choice>>({});
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const [done, setDone] = useState<string | null>(null);
useEffect(() => {
get("/admin/pco", { ttl: 0 }).then(setStatus).catch((err) => setError(message(err)));
get("/admin/options?only=people", { ttl: 0 })
.then((body) => setPeople(body.options.people))
.catch(() => setPeople([]));
}, []);
async function compare() {
setBusy(true);
setError(null);
setDone(null);
try {
const body = await post("/admin/pco/compare", {});
setRows(body.rows);
// Linked or suggested: that person, updated; else skip.
setChoices(
Object.fromEntries(
body.rows.map((row: Row) => [row.pco.id, { target: row.match?.person_id ?? "", update: Boolean(row.match) }]),
),
);
} catch (err) {
setError(message(err));
} finally {
setBusy(false);
}
}
async function applyAll() {
if (!rows) return;
setBusy(true);
setError(null);
try {
const decisions = rows
.map((row) => ({ row, choice: choices[row.pco.id] }))
.filter(({ choice }) => choice?.target)
.map(({ row, choice }) =>
choice.target === "new"
? { pco_id: row.pco.id, action: "create" }
: { pco_id: row.pco.id, action: "link", person_id: choice.target, update: choice.update },
);
const body = await post("/admin/pco/apply", { decisions });
setDone(`Done: ${body.counts.linked} linked, ${body.counts.updated} updated, ${body.counts.created} new (unpublished).`);
await compare();
} catch (err) {
setError(message(err));
} finally {
setBusy(false);
}
}
const counts = useMemo(() => {
const picked = Object.values(choices);
return {
link: picked.filter((c) => c.target && c.target !== "new").length,
create: picked.filter((c) => c.target === "new").length,
};
}, [choices]);
const setChoice = (id: string, next: Partial<Choice>) =>
setChoices((current) => ({ ...current, [id]: { ...current[id], ...next } }));
return (
<div>
<div className="flex flex-wrap items-baseline gap-3">
<h1 className="text-2xl font-bold text-link">Planning Center</h1>
<p className="text-sm" style={{ color: MUTED }}>
Bring a Planning Center People list into the site's people. Planning Center wins; you review each person first.
</p>
</div>
<section className="mt-6 bg-raised p-5 shadow-md">
{!status ? (
<p className="text-sm" style={{ color: MUTED }}>Checking…</p>
) : !status.ready ? (
<p className="text-sm text-body">
Not set up on the server: it needs PCO_APP_ID and PCO_SECRET (docs/planning-center.md).
</p>
) : !status.list_id ? (
<p className="text-sm text-body">
Pick the list in <Link to="/admin/site_settings" className="text-link underline">Site settings → Planning Center</Link> (superadmins).
</p>
) : (
<div className="flex flex-wrap items-center gap-3">
<button type="button" className={primary} disabled={busy} onClick={compare}>
{busy && !rows ? "Fetching…" : rows ? "Compare again" : "Compare with Planning Center"}
</button>
<span className="text-sm" style={{ color: MUTED }}>
List {status.list_id}. Name, and email and phone into the private fields.
</span>
</div>
)}
{error && <p className="mt-3 text-sm text-danger">{error}</p>}
{done && <p className="mt-3 text-sm text-body">{done}</p>}
</section>
{rows && (
<>
<div className="mt-6 flex flex-wrap items-center gap-3">
<button type="button" className={primary} disabled={busy || counts.link + counts.create === 0} onClick={applyAll}>
{busy ? "Applying…" : `Apply: ${counts.link} linked, ${counts.create} new`}
</button>
<span className="text-sm" style={{ color: MUTED }}>
{rows.length} on the list. Skipped ones aren't touched.
</span>
</div>
<ul className="mt-4 space-y-3">
{rows.map((row) => {
const choice = choices[row.pco.id] ?? { target: "", update: false };
const sameAsMatch = choice.target && choice.target === row.match?.person_id;
return (
<li key={row.pco.id} className="bg-raised p-4 shadow-sm">
<div className="flex flex-wrap items-start justify-between gap-3">
<div>
<p className="font-semibold text-body">{row.pco.name || "(no name)"}</p>
<p className="text-xs" style={{ color: MUTED }}>
{[row.pco.email, row.pco.phone].filter(Boolean).join(" · ") || "No email or phone"}
</p>
<p className="mt-1 text-xs text-body">
{row.match ? `${HOW[row.match.how]}: ${row.match.name}` : "No match on the site"}
</p>
</div>
<div className="flex flex-wrap items-center gap-2">
<label className="sr-only" htmlFor={`pco-${row.pco.id}`}>
What to do with {row.pco.name}
</label>
<select
id={`pco-${row.pco.id}`}
value={choice.target}
onChange={(e) => setChoice(row.pco.id, { target: e.target.value, update: e.target.value !== "new" })}
className={input}
>
<option value="">Skip</option>
<option value="new">Make a new person (unpublished)</option>
{row.match && <option value={row.match.person_id}>Link to {row.match.name}</option>}
<optgroup label="Link to someone else">
{people
.filter((p) => p.id !== row.match?.person_id)
.map((p) => (
<option key={p.id} value={p.id}>
{p.label}
</option>
))}
</optgroup>
</select>
{choice.target && choice.target !== "new" && (
<label className="flex items-center gap-2 text-sm text-body">
<input
type="checkbox"
checked={choice.update}
onChange={(e) => setChoice(row.pco.id, { update: e.target.checked })}
/>
Update from Planning Center
</label>
)}
</div>
</div>
{sameAsMatch && row.changes.length > 0 && (
<table className="mt-3 w-full text-left text-sm">
<thead className="text-xs uppercase tracking-wider" style={{ color: MUTED }}>
<tr>
<th className="py-1 pr-4 font-medium">Field</th>
<th className="py-1 pr-4 font-medium">On the site</th>
<th className="py-1 font-medium">Planning Center</th>
</tr>
</thead>
<tbody>
{row.changes.map((change) => (
<tr key={change.field} className="border-t border-muted/10">
<td className="py-1 pr-4 text-body">{change.label}</td>
<td className="py-1 pr-4" style={{ color: MUTED }}>{change.site ?? "-"}</td>
<td className="py-1 text-body">{change.pco}</td>
</tr>
))}
</tbody>
</table>
)}
{sameAsMatch && row.changes.length === 0 && (
<p className="mt-2 text-xs" style={{ color: MUTED }}>Already the same.</p>
)}
</li>
);
})}
</ul>
</>
)}
</div>
);
}

View file

@ -418,7 +418,9 @@ export default function EntityEdit() {
} }
} }
const visible = (when) => !when || getPath(form, when.path) === when.value; // A gate is a field's value, or a test of the whole form (a page's
// id deciding it has sections: sitePages.ts).
const visible = (when) => !when || (when.test ? when.test(form) : getPath(form, when.path) === when.value);
const groups = manifest.groups.filter((group) => visible(group.when)); const groups = manifest.groups.filter((group) => visible(group.when));
const shownChildren = children.filter((child) => visible(child.when)); const shownChildren = children.filter((child) => visible(child.when));
@ -636,7 +638,7 @@ export default function EntityEdit() {
Discard draft Discard draft
</button> </button>
)} )}
{!isNew && !singleton && canDelete && ( {!isNew && !singleton && canDelete && !manifest.undeletable?.includes(id) && (
<button <button
type="button" type="button"
onClick={remove} onClick={remove}
@ -691,6 +693,8 @@ function ImportedNote() {
`${summary.paragraphs} paragraphs`, `${summary.paragraphs} paragraphs`,
`${summary.lists} lists`, `${summary.lists} lists`,
`${summary.tables} tables`, `${summary.tables} tables`,
...(summary.tabs ? [`${summary.tabs} tabs`] : []),
...(summary.others ? [`${summary.others} quotes, callouts, dividers, videos and buttons`] : []),
]; ];
return ( return (
<p role="status" className="mt-4 border border-brand/20 bg-tint px-4 py-3 text-sm text-body"> <p role="status" className="mt-4 border border-brand/20 bg-tint px-4 py-3 text-sm text-body">

View file

@ -282,13 +282,40 @@ function ImportButton({ manifest }: { manifest: any }) {
} }
} }
const guide = manifest.importer.guide;
return ( return (
<div className="ml-auto flex items-center gap-3"> <div className="ml-auto flex flex-wrap items-center gap-3">
{error && ( {error && (
<span role="alert" className="text-sm text-danger"> <span role="alert" className="text-sm text-danger">
{error} {error}
</span> </span>
)} )}
{guide && (
<details className="relative">
<summary className="cursor-pointer text-sm text-link hover:underline">What becomes what</summary>
<div className="absolute right-0 z-20 mt-2 w-[min(36rem,90vw)] bg-raised p-4 text-sm shadow-xl">
<p className="text-body">{guide.intro}</p>
<table className="mt-3 w-full text-left">
<thead className="text-xs uppercase tracking-wider text-muted">
<tr>
<th className="py-1 pr-4 font-medium">In Word</th>
<th className="py-1 font-medium">In the post</th>
</tr>
</thead>
<tbody>
{guide.rows.map(([from, to]) => (
<tr key={from} className="border-t border-muted/10 align-top">
<td className="py-1.5 pr-4 text-body">{from}</td>
<td className="py-1.5 text-muted">{to}</td>
</tr>
))}
</tbody>
</table>
{guide.outro && <p className="mt-3 text-xs text-muted">{guide.outro}</p>}
</div>
</details>
)}
<label <label
className={`cursor-pointer btn border border-link px-4 py-2 text-sm text-link transition-colors hover:bg-tint ${ className={`cursor-pointer btn border border-link px-4 py-2 text-sm text-link transition-colors hover:bg-tint ${
busy ? "pointer-events-none opacity-60" : "" busy ? "pointer-events-none opacity-60" : ""

View file

@ -101,6 +101,12 @@ export const DATA_NAV = {
blurb: "Invite people to make a profile account, approve their claims to a People record, and link their Discord.", blurb: "Invite people to make a profile account, approve their claims to a People record, and link their Discord.",
minRole: "admin", minRole: "admin",
}, },
{
to: "/admin/pco",
label: "Planning Center",
blurb: "Bring a Planning Center People list into People: compare each person, then link, update or add them.",
minRole: "admin",
},
{ {
to: "/admin/blog_posts", to: "/admin/blog_posts",
label: "Blog posts", label: "Blog posts",
@ -120,49 +126,23 @@ export const PAGES_NAV = {
label: "Pages", label: "Pages",
blurb: "What a page shows and in what order.", blurb: "What a page shows and in what order.",
children: [ children: [
// The header's and footer's links, page titles and hidden pages. // The banner on the admin home: every page, new ones, the menus.
// Each page's own card follows it there (AdminHome.tsx).
{
to: "/admin/pages",
label: "Page management",
blurb: "Every page of the site: make new ones, change an address, title or intro, and hide or disable any of them. Then each page's sections.",
banner: true,
children: [
{ to: "/admin/pages/home", label: "Front page" },
{ to: "/admin/pages/new", label: "New page" },
{ to: "/admin/navigation", label: "Menus (Navigation)" },
],
},
{ {
to: "/admin/navigation", to: "/admin/navigation",
label: "Navigation", label: "Navigation",
blurb: "The header's pages and buttons, the footer's links, each page's title and intro, and which pages are hidden.", blurb: "The header's pages and buttons and the footer's links.",
},
// One record, not a list: the item opens it directly.
{
to: "/admin/front_page",
label: "Front page",
blurb: "The hero, its photos or livestream, and which bands the home page draws.",
},
// The site's own pages, in the header's order: each is its
// sections, built in the editor (sitePages.ts).
{
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",
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.",
},
{
to: "/admin/shop_page",
label: "Shop",
blurb: "The shop's intro page: its sections and the links out to the store.",
}, },
], ],
}; };

View file

@ -0,0 +1,74 @@
/* ═══════════════════════════════════════════════════════════════
BANDS
The section types that draw a whole band of their own, heading
included, in the front page's style (083: they were the front
page's, and go on any page now): the hero, the countdown, the
calendar, the numbers, featured cards, the pathfinder, and the
timeline's rail of featured moments (a timeline section opened as
'carousel'). SitePage.tsx draws them as they are on the front
page, and without its own heading on any other page.
Each takes the section (its anchor, title, blurb) and what its
type shows (`data`, server/src/sectionData.js). A band with
nothing to show draws nothing: the countdown with no upcoming
event, the numbers with no numbers, the pathfinder with no paths,
featured cards with no cards.
═══════════════════════════════════════════════════════════════ */
import type { ReactNode } from 'react'
import HeroStage from './home/HeroStage.tsx'
import NextEventCountdown from './home/NextEventCountdown.tsx'
import CalendarBand from './home/CalendarBand.tsx'
import StatsBand from './home/StatsBand.tsx'
import FeaturedBand from './home/FeaturedBand.tsx'
import FeaturedTimelineRail from './home/FeaturedTimelineRail.tsx'
import Pathfinder from './home/Pathfinder.tsx'
import type { SitePageSection } from '../../lib/useSitePages.ts'
import './home/home.css'
type BandContext = {
/** The section before it is a hero: a countdown overlaps its foot. */
afterHero: boolean
}
type Band = (section: SitePageSection, context: BandContext) => ReactNode
const BANDS: Record<string, Band> = {
hero: (section) => <HeroStage hero={section.data ?? null} />,
countdown: (section, { afterHero }) =>
section.data ? <NextEventCountdown event={section.data} overlap={afterHero} /> : null,
calendar: (section) => <CalendarBand id={section.anchor} title={section.title} blurb={section.blurb} />,
stats: (section) =>
section.data?.length ? (
<StatsBand id={section.anchor} title={section.title} blurb={section.blurb} stats={section.data} />
) : null,
featured_cards: (section) =>
section.data?.cards?.length ? (
<FeaturedBand
id={section.anchor}
title={section.title}
blurb={section.blurb}
cards={section.data.cards}
columns={section.data.columns}
/>
) : null,
connect: (section) =>
section.data?.length ? (
<Pathfinder id={section.anchor} title={section.title} blurb={section.blurb} paths={section.data} />
) : null,
}
/* The band a section draws, or undefined when its type isn't one
(it's its blocks and preset, in a plain section). */
export function bandFor(section: SitePageSection): Band | undefined {
if (section.preset === 'timeline' && section.view === 'carousel') {
return () => <FeaturedTimelineRail id={section.anchor} title={section.title} blurb={section.blurb} />
}
return section.preset ? BANDS[section.preset] : undefined
}
/* Section types the menus don't list: the hero and the countdown are
the top of a page, not places to jump to. */
export const UNLISTED_PRESETS = ['hero', 'countdown']

View file

@ -21,7 +21,7 @@ import PlatformIcon from '../../components/PlatformIcon.tsx'
import { blogHref } from '../../lib/hrefs.ts' import { blogHref } from '../../lib/hrefs.ts'
import { mediaUrl } from '../../lib/media.ts' import { mediaUrl } from '../../lib/media.ts'
import { preview } from '../../lib/text.ts' import { preview } from '../../lib/text.ts'
import { postDate, useCommunityBlog, type BlogPostSummary } from '../../lib/useBlog.ts' import { postDate, type BlogPostSummary, type CommunityBlog as CommunityBlogData } from '../../lib/useBlog.ts'
import HomeLink from './home/HomeLink.tsx' import HomeLink from './home/HomeLink.tsx'
import { accentText, BRAND } from '../../lib/color.ts' import { accentText, BRAND } from '../../lib/color.ts'
import { useSmallImage } from '../../lib/useSmallImage.ts' import { useSmallImage } from '../../lib/useSmallImage.ts'
@ -83,25 +83,10 @@ function Subheading({ children, accent }: { children: string; accent: string })
) )
} }
export default function CommunityBlog({ accent = BRAND }: { accent?: string }) { /* Its posts come with the page (the section's data), so there's no
const { data: blog, loading, error, reload } = useCommunityBlog() loading here: the page has it or the page says it couldn't load. */
export default function CommunityBlog({ blog, accent = BRAND }: { blog?: CommunityBlogData | null; accent?: string }) {
if (!blog) { if (!blog) return null
return (
<div className="mx-auto max-w-6xl px-6 text-muted">
{loading ? (
'Loading…'
) : (
<>
Couldn’t load the blog. {error}{' '}
<button type="button" onClick={reload} className="underline" style={{ color: accentText(accent) }}>
Try again
</button>
</>
)}
</div>
)
}
const { internal, external } = blog const { internal, external } = blog
const hasInternal = internal.posts.length > 0 const hasInternal = internal.posts.length > 0

View file

@ -186,7 +186,7 @@ export function TilePicker({
function LocationPicker({ page, section, onPageChange, onSectionChange }) { function LocationPicker({ page, section, onPageChange, onSectionChange }) {
const sectionsOf = useNavSections(); const sectionsOf = useNavSections();
const { pages } = useSiteNav(); const { pageLinks: pages } = useSiteNav();
const sections = page === SITE_WIDE ? [] : sectionsOf(page); const sections = page === SITE_WIDE ? [] : sectionsOf(page);
return ( return (
@ -253,7 +253,7 @@ function describeLocation(page, section, sectionsOf: (path: string) => NavSectio
export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) { export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) {
const sectionsOf = useNavSections(); const sectionsOf = useNavSections();
const { pages } = useSiteNav(); const { pageLinks: pages } = useSiteNav();
const request = fixedType === DATA_REQUEST.id; const request = fixedType === DATA_REQUEST.id;
const [type, setType] = useState<any>(fixedType ?? null); const [type, setType] = useState<any>(fixedType ?? null);
const [page, setPage] = useState(SITE_WIDE); const [page, setPage] = useState(SITE_WIDE);

View file

@ -0,0 +1,82 @@
/* ═══════════════════════════════════════════════════════════════
FORM AND EMBED SECTIONS
Section types (page_sections.preset, 081) for what used to be
whole pages, so any page can have them: SitePage.tsx draws them
under a section's blocks.
feedback_form the website feedback form
request_form the request form (reads ?type=)
data_request_form a request to see, correct or delete data
giving the Church Center giving button
qr_maker the QR code maker
═══════════════════════════════════════════════════════════════ */
import { useEffect } from 'react'
import FeedbackForm from './FeedbackForm.tsx'
import RequestForm from './RequestForm.tsx'
import QrCodeMaker from './QrCodeMaker.tsx'
import { DATA_REQUEST } from '../../data/feedbackTypes.ts'
import { BRAND } from '../../lib/color.ts'
/* A form reads best narrower than the page. */
const Narrow = ({ children }: { children: React.ReactNode }) => <div className="mx-auto max-w-3xl px-6">{children}</div>
export const FeedbackSection = () => (
<Narrow>
<FeedbackForm />
</Narrow>
)
export const RequestSection = () => (
<Narrow>
<RequestForm />
</Narrow>
)
export const DataRequestSection = () => (
<Narrow>
<FeedbackForm fixedType={DATA_REQUEST.id} />
</Narrow>
)
export const QrSection = () => (
<div className="mx-auto max-w-6xl px-6">
<QrCodeMaker />
</div>
)
/* Giving: Church Center's modal script, loaded with the section, and
the button that opens its form on the page. The words around it
are the section's blocks. */
const GIVING_URL = 'https://ngu.churchcenteronline.com/giving?open-in-church-center-modal=true'
const MODAL_SCRIPT_SRC = 'https://js.churchcenter.com/modal/v1'
function useChurchCenterModal() {
useEffect(() => {
if (document.querySelector(`script[src="${MODAL_SCRIPT_SRC}"]`)) return
const script = document.createElement('script')
script.src = MODAL_SCRIPT_SRC
script.async = true
document.head.appendChild(script)
// Deliberately not removed on unmount: the script registers a
// document-level click handler, and tearing it down on every
// route change would mean fetching it again on the way back.
}, [])
}
export function GivingSection() {
useChurchCenterModal()
return (
<div className="mx-auto max-w-2xl px-6 text-center">
<a
href={GIVING_URL}
className="inline-flex items-center justify-center btn px-10 py-4 text-base font-semibold tracking-wide text-white shadow-sm transition hover:brightness-110 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 motion-reduce:transition-none"
style={{ backgroundColor: BRAND, '--tw-ring-color': BRAND } as React.CSSProperties}
>
Give through Church Center
</a>
</div>
)
}

View file

@ -148,7 +148,7 @@ type Group = { label?: string; choices: Choice[] }
on the site rather than an anchor on one of them (Give, not on the site rather than an anchor on one of them (Give, not
Contact Us). */ Contact Us). */
function mainPages(nav: ReturnType<typeof useSiteNav>): Choice[] { function mainPages(nav: ReturnType<typeof useSiteNav>): Choice[] {
const pages = nav.pages.map((p) => ({ path: p.path, label: p.label })) const pages = nav.pageLinks.map((p) => ({ path: p.path, label: p.label }))
const known = new Set(pages.map((p) => p.path)) const known = new Set(pages.map((p) => p.path))
for (const action of nav.actions) { for (const action of nav.actions) {
if (!action.path.startsWith('/') || action.path.includes('#') || known.has(action.path)) continue if (!action.path.startsWith('/') || action.path.includes('#') || known.has(action.path)) continue

View file

@ -10,6 +10,7 @@
import EventCalendar from '../EventCalendar.tsx' import EventCalendar from '../EventCalendar.tsx'
import RequestLink from '../../../components/RequestLink.tsx' import RequestLink from '../../../components/RequestLink.tsx'
import { Words } from '../../../components/RotatingWords.tsx'
type CalendarBandProps = { id: string; title: string; blurb?: string | null } type CalendarBandProps = { id: string; title: string; blurb?: string | null }
@ -19,7 +20,7 @@ export default function CalendarBand({ id, title, blurb }: CalendarBandProps) {
<div className="mx-auto mb-10 flex max-w-6xl flex-wrap items-end justify-between gap-4 px-6"> <div className="mx-auto mb-10 flex max-w-6xl flex-wrap items-end justify-between gap-4 px-6">
<div> <div>
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl"> <h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
{title} <Words text={title} />
</h2> </h2>
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>} {blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
</div> </div>

View file

@ -8,7 +8,8 @@
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import FeaturedCards from '../../../components/FeaturedCards.tsx' import FeaturedCards from '../../../components/FeaturedCards.tsx'
import type { FeaturedCard, FeaturedColumns } from '../../../lib/useFrontPage.ts' import type { FeaturedCard, FeaturedColumns } from '../../../lib/sectionTypes.ts'
import { Words } from '../../../components/RotatingWords.tsx'
type FeaturedBandProps = { type FeaturedBandProps = {
id: string id: string
@ -22,7 +23,7 @@ export default function FeaturedBand({ id, title, blurb, cards, columns }: Featu
return ( return (
<section id={id} className="py-24"> <section id={id} className="py-24">
<div className="mx-auto max-w-6xl px-6"> <div className="mx-auto max-w-6xl px-6">
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">{title}</h2> <h2 className="font-display text-4xl font-bold text-ink md:text-5xl"><Words text={title} /></h2>
{blurb && <p className="mt-4 max-w-2xl text-lg text-muted">{blurb}</p>} {blurb && <p className="mt-4 max-w-2xl text-lg text-muted">{blurb}</p>}
<div className="mt-12"> <div className="mt-12">
<FeaturedCards cards={cards} columns={columns ?? undefined} /> <FeaturedCards cards={cards} columns={columns ?? undefined} />

View file

@ -33,6 +33,7 @@ import { MONTH_LABELS, type TimelineItem } from '../../../lib/timeline.ts'
import { accentText, BRAND } from '../../../lib/color.ts' import { accentText, BRAND } from '../../../lib/color.ts'
import { scrollBehavior } from '../../../lib/motion.ts'; import { scrollBehavior } from '../../../lib/motion.ts';
import { useReadingMode } from '../../../lib/readingMode.ts' import { useReadingMode } from '../../../lib/readingMode.ts'
import { Words } from '../../../components/RotatingWords.tsx'
const DRAG_SLOP = 6 const DRAG_SLOP = 6
@ -54,7 +55,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
if (reading) { if (reading) {
return ( return (
<section id={id}> <section id={id}>
<h2>{title}</h2> <h2><Words text={title} /></h2>
{blurb && <p>{blurb}</p>} {blurb && <p>{blurb}</p>}
{error ? ( {error ? (
<p>Couldn’t load the timeline. {error}</p> <p>Couldn’t load the timeline. {error}</p>
@ -104,7 +105,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
<div className="mx-auto flex max-w-6xl flex-wrap items-end gap-6 px-6"> <div className="mx-auto flex max-w-6xl flex-wrap items-end gap-6 px-6">
<div> <div>
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl"> <h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
{title} <Words text={title} />
</h2> </h2>
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>} {blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
</div> </div>

View file

@ -56,7 +56,9 @@ import { focusOnMount } from '../../../lib/focus.ts'
import { useReadingMode } from '../../../lib/readingMode.ts' import { useReadingMode } from '../../../lib/readingMode.ts'
import { eventHref } from '../../../lib/hrefs.ts' import { eventHref } from '../../../lib/hrefs.ts'
import { seriesLabel } from '../../../lib/eventSeries.ts' import { seriesLabel } from '../../../lib/eventSeries.ts'
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts' import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/sectionTypes.ts'
import { WordMotion, Words as RotatingText } from '../../../components/RotatingWords.tsx'
import { firstWords } from '../../../lib/words.ts'
const DEEP = '#001011' const DEEP = '#001011'
@ -187,7 +189,9 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
} [overflow-wrap:anywhere]`} } [overflow-wrap:anywhere]`}
style={{ animationDelay: '60ms' }} style={{ animationDelay: '60ms' }}
> >
{hero.headline} <WordMotion settings={hero.words}>
<RotatingText text={hero.headline} />
</WordMotion>
</h1> </h1>
{hero.subhead && ( {hero.subhead && (
@ -226,7 +230,7 @@ function ReadingHero({ hero, feature, slides, video }: ReadingHeroProps) {
return ( return (
<> <>
{feature === 'none' && hero.eyebrow && <p>{hero.eyebrow}</p>} {feature === 'none' && hero.eyebrow && <p>{hero.eyebrow}</p>}
<h1>{hero.headline}</h1> <h1>{firstWords(hero.headline)}</h1>
{hero.subhead && <p>{hero.subhead}</p>} {hero.subhead && <p>{hero.subhead}</p>}
{[hero.primary, hero.secondary].map( {[hero.primary, hero.secondary].map(
(button) => (button) =>
@ -556,10 +560,12 @@ function VideoFrame({
/* ── Featured event ──────────────────────────────────────────── */ /* ── Featured event ──────────────────────────────────────────── */
/* The event's own card for the hero: its background photo (or its /* The event's own card for the hero: its photo (or its color), then
color), then what, when and where, then its buttons and a way what, when and where, then its buttons and a way to its page. The
to its page. The first action link is the filled button, since first action link is the filled button, since it's usually
it's usually Register. */ Register. Stacked on a phone; from lg up the photo sits beside the
words, so the card stays about as tall as the hero's own text
instead of towering over it. The photo stays whole (16:9). */
function EventPanel({ event }: { event: HeroEvent }) { function EventPanel({ event }: { event: HeroEvent }) {
const color = event.color || 'var(--color-action)' const color = event.color || 'var(--color-action)'
const photo = mediaUrl(event.photo) const photo = mediaUrl(event.photo)
@ -568,7 +574,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
return ( return (
<div <div
className="overflow-hidden border border-white/15 bg-white/10 text-white shadow-2xl backdrop-blur" className="overflow-hidden border border-white/15 bg-white/10 text-white shadow-2xl backdrop-blur lg:grid lg:grid-cols-[minmax(0,1.1fr)_minmax(0,1fr)] lg:items-center"
style={{ boxShadow: '0 24px 48px -24px rgba(0, 16, 17, 0.6)' }} style={{ boxShadow: '0 24px 48px -24px rgba(0, 16, 17, 0.6)' }}
> >
{photo ? ( {photo ? (
@ -581,9 +587,9 @@ function EventPanel({ event }: { event: HeroEvent }) {
/> />
)} )}
<div className="space-y-4 p-8"> <div className="space-y-4 p-8 lg:space-y-3 lg:p-6">
<div> <div>
<h2 className="font-display text-3xl font-bold leading-tight md:text-4xl"> <h2 className="font-display text-3xl font-bold leading-tight md:text-4xl lg:text-2xl xl:text-3xl">
<Link to={eventHref(event.id)} className="hover:underline"> <Link to={eventHref(event.id)} className="hover:underline">
{event.title} {event.title}
</Link> </Link>
@ -592,16 +598,16 @@ function EventPanel({ event }: { event: HeroEvent }) {
</div> </div>
{(when || where) && ( {(when || where) && (
<p className="text-lg text-white/85">{[when, where].filter(Boolean).join(' · ')}</p> <p className="text-lg text-white/85 lg:text-base">{[when, where].filter(Boolean).join(' · ')}</p>
)} )}
{event.tagline && <p className="text-white/70">{event.tagline}</p>} {event.tagline && <p className="text-white/70 lg:line-clamp-3 lg:text-sm">{event.tagline}</p>}
<div className="flex flex-wrap gap-3 pt-2"> <div className="flex flex-wrap gap-3 pt-2 lg:gap-2 lg:pt-1">
{event.links.map((link, index) => ( {event.links.map((link, index) => (
<HomeLink <HomeLink
key={link.url} key={link.url}
url={link.url} url={link.url}
className={`inline-flex items-center gap-2 btn px-6 py-3 transition-transform hover:scale-105 ${ className={`inline-flex items-center gap-2 btn px-6 py-3 transition-transform hover:scale-105 lg:px-4 lg:py-2 lg:text-sm ${
index === 0 ? 'text-[#001011]' : 'border border-white/35 text-white hover:bg-white/10' index === 0 ? 'text-[#001011]' : 'border border-white/35 text-white hover:bg-white/10'
}`} }`}
style={index === 0 ? { background: 'var(--pal-amber-2)' } : undefined} style={index === 0 ? { background: 'var(--pal-amber-2)' } : undefined}
@ -612,7 +618,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
))} ))}
<Link <Link
to={eventHref(event.id)} to={eventHref(event.id)}
className="btn border border-white/35 px-6 py-3 text-white transition-colors hover:bg-white/10" className="btn border border-white/35 px-6 py-3 text-white transition-colors hover:bg-white/10 lg:px-4 lg:py-2 lg:text-sm"
> >
Event details <ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" /> Event details <ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />
</Link> </Link>

View file

@ -24,7 +24,7 @@ import { Link } from 'react-router-dom'
import { eventHref } from '../../../lib/hrefs.ts' import { eventHref } from '../../../lib/hrefs.ts'
import { upcomingOccurrences } from '../../../lib/eventSeries.ts' import { upcomingOccurrences } from '../../../lib/eventSeries.ts'
import type { CountdownEvent } from '../../../lib/useFrontPage.ts' import type { CountdownEvent } from '../../../lib/sectionTypes.ts'
import { withAlpha, accentText, BRAND } from '../../../lib/color.ts' import { withAlpha, accentText, BRAND } from '../../../lib/color.ts'
import { useReadingMode } from '../../../lib/readingMode.ts' import { useReadingMode } from '../../../lib/readingMode.ts'

View file

@ -3,7 +3,7 @@
The connect section as a question rather than a wall of forms: The connect section as a question rather than a wall of forms:
pick what you're here for, and that path's actions arrive. Paths pick what you're here for, and that path's actions arrive. Paths
and actions are the admin's (Front page → Find your way in); and actions are the admin's (a Connect nav section's paths, Pages → Page management);
a path with no actions never reaches this component. a path with no actions never reaches this component.
The choices are a real tablist: arrow keys move between them, The choices are a real tablist: arrow keys move between them,
@ -28,15 +28,17 @@ import { ArrowRight, ArrowUpRight, BookOpen, Dot, CalendarBlank, ChatCircle, Com
import { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react' import { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react'
import HomeLink, { isExternal } from './HomeLink.tsx' import HomeLink, { isExternal } from './HomeLink.tsx'
import type { FrontPagePath } from '../../../lib/useFrontPage.ts' import type { SectionPath } from '../../../lib/sectionTypes.ts'
import { ACCENTS, accentText, readableOn } from '../../../lib/color.ts' import { ACCENTS, accentText, readableOn } from '../../../lib/color.ts'
import { useReadingMode } from '../../../lib/readingMode.ts' import { useReadingMode } from '../../../lib/readingMode.ts'
import { Words } from '../../../components/RotatingWords.tsx'
import { firstWords } from '../../../lib/words.ts'
type PathfinderProps = { type PathfinderProps = {
id: string id: string
title: string title: string
blurb?: string | null blurb?: string | null
paths: FrontPagePath[] paths: SectionPath[]
} }
/* One accent per position, cycling. Paths are data; color is /* One accent per position, cycling. Paths are data; color is
@ -80,7 +82,7 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
if (reading) { if (reading) {
return ( return (
<section id={id}> <section id={id}>
<h2>{title}</h2> <h2><Words text={title} /></h2>
{blurb && <p>{blurb}</p>} {blurb && <p>{blurb}</p>}
{paths.map((option, index) => ( {paths.map((option, index) => (
<div key={`${option.label}-${index}`}> <div key={`${option.label}-${index}`}>
@ -131,14 +133,14 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
return ( return (
<section id={id} className="py-24"> <section id={id} className="py-24">
<div className="mx-auto max-w-6xl px-6"> <div className="mx-auto max-w-6xl px-6">
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">{title}</h2> <h2 className="font-display text-4xl font-bold text-ink md:text-5xl"><Words text={title} /></h2>
{blurb && <p className="mt-4 max-w-2xl text-lg text-muted">{blurb}</p>} {blurb && <p className="mt-4 max-w-2xl text-lg text-muted">{blurb}</p>}
<div className="mt-12 overflow-hidden shadow-md"> <div className="mt-12 overflow-hidden shadow-md">
<div className="-mr-[4px] -mb-[4px]"> <div className="-mr-[4px] -mb-[4px]">
<div <div
role="tablist" role="tablist"
aria-label={title} aria-label={firstWords(title)}
aria-orientation="horizontal" aria-orientation="horizontal"
className="grid sm:grid-cols-2 lg:grid-cols-[repeat(var(--paths),minmax(0,1fr))]" className="grid sm:grid-cols-2 lg:grid-cols-[repeat(var(--paths),minmax(0,1fr))]"
style={{ '--paths': Math.min(paths.length, 5) } as CSSProperties} style={{ '--paths': Math.min(paths.length, 5) } as CSSProperties}

View file

@ -1,41 +0,0 @@
/* ═══════════════════════════════════════════════════════════════
RETREATS BAND
The National Retreats carousel from the Retreats page, as-is:
same component, same filter, so an event edited in the admin
shows up identically in both places. This file only adds the
front page's heading and a way through to the full page.
═══════════════════════════════════════════════════════════════ */
import { ArrowRight } from '@phosphor-icons/react'
import { Link } from 'react-router-dom'
import EventListCards from '../EventList-Cards.tsx'
import { accentText, BRAND } from '../../../lib/color.ts'
type RetreatsBandProps = { id: string; title: string; blurb?: string | null }
export default function RetreatsBand({ id, title, blurb }: RetreatsBandProps) {
return (
<section id={id} className="overflow-hidden py-24">
<div className="mx-auto mb-12 flex max-w-6xl flex-wrap items-end gap-6 px-6">
<div>
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
{title}
</h2>
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
</div>
<Link
to="/retreats"
className="ml-auto btn border px-5 py-2 text-sm transition-colors hover:bg-surface"
style={{ borderColor: BRAND, color: accentText(BRAND) }}
>
All retreats <ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />
</Link>
</div>
<EventListCards scope="national" type="retreat" view="carousel" accent={BRAND} />
</section>
)
}

View file

@ -12,9 +12,10 @@
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import type { FrontPageStat } from '../../../lib/useFrontPage.ts' import type { SectionStat } from '../../../lib/sectionTypes.ts'
import { prefersLessMotion } from '../../../lib/motion.ts' import { prefersLessMotion } from '../../../lib/motion.ts'
import { useReadingMode } from '../../../lib/readingMode.ts' import { useReadingMode } from '../../../lib/readingMode.ts'
import { Words } from '../../../components/RotatingWords.tsx'
const COUNT_MS = 1400 const COUNT_MS = 1400
@ -22,7 +23,7 @@ type StatsBandProps = {
id: string id: string
title: string title: string
blurb?: string | null blurb?: string | null
stats: FrontPageStat[] stats: SectionStat[]
} }
export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) { export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
@ -50,7 +51,7 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
if (useReadingMode()) { if (useReadingMode()) {
return ( return (
<section id={id}> <section id={id}>
<h2>{title}</h2> <h2><Words text={title} /></h2>
{blurb && <p>{blurb}</p>} {blurb && <p>{blurb}</p>}
<ul> <ul>
{stats.map((stat, index) => ( {stats.map((stat, index) => (
@ -74,7 +75,7 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
> >
<div className="relative mx-auto max-w-6xl px-6"> <div className="relative mx-auto max-w-6xl px-6">
<h2 className="font-display text-3xl font-bold text-white md:text-4xl"> <h2 className="font-display text-3xl font-bold text-white md:text-4xl">
{title} <Words text={title} />
</h2> </h2>
{blurb && <p className="mt-3 max-w-2xl text-white/70">{blurb}</p>} {blurb && <p className="mt-3 max-w-2xl text-white/70">{blurb}</p>}