Compare commits

..

4 commits

Author SHA1 Message Date
Zaldimmar
0f2fb2ccb3 Version v1.9.15-groups
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 13:27:45 -05:00
Zaldimmar
2ad65cdc15 Write the site in US English
color, center, canceled, labeled, recognize and the rest, in UI
text, help text, comments, docs and names (ColorInput, QrCenter).
Migration 053 renames the two Site settings color CHECKs, whose
names are the messages the admin shows. Kept: events.status's
stored value 'cancelled' (shown as canceled), aria-labelledby,
schema.org's EventCancelled, and old migrations as they ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 13:24:11 -05:00
Zaldimmar
38aff34c97 Call local chapters groups, everywhere
The organization kind is 'group', its side table is groups, pages
live at /groups/<id> and the Community page's section is #groups.
Migration 052 converts existing databases: the kind and the tables
whose CHECKs name chapters are rebuilt, the front page count and
request category follow, and the site's own /chapters/ and
#chapters links in records are rewritten. Request files now go in
Requests/Groups on the shared drive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 13:19:51 -05:00
Zaldimmar
175a18976d Widen the admin home so its cards run three across
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 13:12:55 -05:00
86 changed files with 665 additions and 406 deletions

View file

@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
# NGU-Web # NGU-Web
Website for NGU (Next Generation of Unity), a Unity movement organization with regional chapters in the US and internationally. Full-stack app with a public site and a role-based admin panel. Website for NGU (Next Generation of Unity), a Unity movement organization with regional groups in the US and internationally. Full-stack app with a public site and a role-based admin panel.
## Stack ## Stack
- Frontend: React, TypeScript, Tailwind CSS, React Router, Vite (in `src/`) - Frontend: React, TypeScript, Tailwind CSS, React Router, Vite (in `src/`)
@ -22,7 +22,7 @@ Backend (`server/`, Node >= 22.13). The server reads `HOST` (default `127.0.0.1`
- `DB_PATH=./dev.db pnpm dev`: run with `node --watch` - `DB_PATH=./dev.db pnpm dev`: run with `node --watch`
- `DB_PATH=./dev.db pnpm migrate`: apply migrations without starting the server - `DB_PATH=./dev.db pnpm migrate`: apply migrations without starting the server
- `DB_PATH=./dev.db node src/admin-cli.js add|list|passwd|role|disable|enable ...`: the only way accounts are created - `DB_PATH=./dev.db node src/admin-cli.js add|list|passwd|role|disable|enable ...`: the only way accounts are created
- `DB_PATH=./dev.db node src/seed-showcase.js [--listed]`: writes fully filled test records (a region, chapter, team, award, person, three events and a blog post with every content block type), ids starting `showcase-`, for checking pages. Unlisted unless `--listed`. Refuses a database under /var/lib/ngu unless `--production` is also given. - `DB_PATH=./dev.db node src/seed-showcase.js [--listed]`: writes fully filled test records (a region, group, team, award, person, three events and a blog post with every content block type), ids starting `showcase-`, for checking pages. Unlisted unless `--listed`. Refuses a database under /var/lib/ngu unless `--production` is also given.
In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API must listen on that port. In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API must listen on that port.
@ -69,8 +69,8 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
- **Imports need explicit extensions** (`.ts`, `.tsx`, `.js`) everywhere. - **Imports need explicit extensions** (`.ts`, `.tsx`, `.js`) everywhere.
- **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names. - **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names.
- **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface. - **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface.
- **Colours are tokens, not hex.** Admins can override any token (Panel → Site settings → Colours). The defaults are `server/src/themeDefaults.js` plus the same values as CSS in `src/index.css`; the build fails if they differ (`themeDefaultsCheck` in `vite.config.ts`), and migration 041's CHECK lists the token names. Use the utilities from `src/index.css` (`text-ink`, `text-body`, `text-muted`, `text-link`, `bg-surface`, `bg-tint`, `bg-action`, `border-brand/20`...) so dark mode works; a literal only for something that must look the same in both modes (white on a dark band, a platform's colour). Data colours (accents, event and region colours) go through `withAlpha`, `accentText` and `readableOn` in `src/lib/color.ts`, never `${color}55`. - **Colors are tokens, not hex.** Admins can override any token (Panel → Site settings → Colors). The defaults are `server/src/themeDefaults.js` plus the same values as CSS in `src/index.css`; the build fails if they differ (`themeDefaultsCheck` in `vite.config.ts`), and migration 041's CHECK lists the token names. Use the utilities from `src/index.css` (`text-ink`, `text-body`, `text-muted`, `text-link`, `bg-surface`, `bg-tint`, `bg-action`, `border-brand/20`...) so dark mode works; a literal only for something that must look the same in both modes (white on a dark band, a platform's color). Data colors (accents, event and region colors) go through `withAlpha`, `accentText` and `readableOn` in `src/lib/color.ts`, never `${color}55`.
- **Icons are Phosphor** (`@phosphor-icons/react`), weight `bold` (or `fill` for play/star). No hand-drawn `<svg>` icons and no Unicode glyphs as icons (× › ▶ →). Brand marks are the exception: `DoveMark`, `PlatformIcon`, the Google logo, the chapter map. - **Icons are Phosphor** (`@phosphor-icons/react`), weight `bold` (or `fill` for play/star). No hand-drawn `<svg>` icons and no Unicode glyphs as icons (× › ▶ →). Brand marks are the exception: `DoveMark`, `PlatformIcon`, the Google logo, the group map.
- **Accents come from `src/lib/color.ts`:** `BRAND` (the teal, via the button token so the admin palette reaches it) and `ACCENTS` (deep, green, mint). Not a new hex in a page. - **Accents come from `src/lib/color.ts`:** `BRAND` (the teal, via the button token so the admin palette reaches it) and `ACCENTS` (deep, green, mint). Not a new hex in a page.
- **No em-dashes** (U+2014) anywhere: UI text, help text, comments, docs, commit messages. Use a colon, comma or parentheses. An empty table cell shows `-`. - **No em-dashes** (U+2014) anywhere: UI text, help text, comments, docs, commit messages. Use a colon, comma or parentheses. An empty table cell shows `-`.
- **Admin editor text:** blank select options read `Default: …` (what blank means), examples in help text start with `eg.`, and record ids are called "URL ID". Cut-off preview text uses `preview()` from `src/lib/text.ts`, which ends it with an ellipsis. See `docs/updating-data-in-code.md`. - **Admin editor text:** blank select options read `Default: …` (what blank means), examples in help text start with `eg.`, and record ids are called "URL ID". Cut-off preview text uses `preview()` from `src/lib/text.ts`, which ends it with an ellipsis. See `docs/updating-data-in-code.md`.
@ -79,7 +79,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.
- `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 colour 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.
- `admin-cli.js` imports `ROLES` and `destroyAllSessionsFor` from `auth.js`. Keep it that way to prevent drift. - `admin-cli.js` imports `ROLES` and `destroyAllSessionsFor` from `auth.js`. Keep it that way to prevent drift.

View file

@ -60,7 +60,7 @@ hand.
| Folder | Used by | Set in | | Folder | Used by | Set in |
| --- | --- | --- | | --- | --- | --- |
| `Requests/<type>` | Files sent with the Request form, a folder per type (`Requests/Chapters`, `Requests/Blog Posts`...) | `DRIVE_FOLDER` and `TYPE_FOLDERS` in `server/src/routes/requests.js` | | `Requests/<type>` | Files sent with the Request form, a folder per type (`Requests/Groups`, `Requests/Blog Posts`...) | `DRIVE_FOLDER` and `TYPE_FOLDERS` in `server/src/routes/requests.js` |
| `Media` and folders in it | Files for pages to link to (Tools → Media → Files), in folders you make there | `FOLDER` in `server/src/routes/files.js` | | `Media` and folders in it | Files for pages to link to (Tools → Media → Files), in folders you make there | `FOLDER` in `server/src/routes/files.js` |
A new use calls `driveUpload("<Folder>", name, mime, bytes)` from A new use calls `driveUpload("<Folder>", name, mime, bytes)` from

View file

@ -22,7 +22,7 @@ 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.
Not carried over: images and drawings (the note says how many; add them Not carried over: images and drawings (the note says how many; add them
as Image blocks), text boxes, footnotes, comments, colours and fonts. as Image blocks), text boxes, footnotes, comments, colors and fonts.
Numbered lists come over as bulleted lists. Numbered lists come over as bulleted lists.
The conversion is `server/src/docx.js`; the route is The conversion is `server/src/docx.js`; the route is

View file

@ -32,7 +32,7 @@ what a dropdown in the admin editor says.
| Blog posts, and the Community page's blog section (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community blog section | | Blog posts, and the Community page's blog section (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community blog section |
| 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, page section titles, colours, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) | | Navigation, page section titles, 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 static page's title and intro (also its search title and description), the site's name, description, preview image, icons, search indexing, privacy contact email | the database, over `site.json` | Admin → Panel → Site settings (superadmins). Blank uses `site.json`, which also holds the site's address and the pages' defaults. See `docs/seo.md` |
| Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` | | Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` |
@ -85,7 +85,7 @@ options: [["speaker", "Speaker"], ["leader", "Leader"]] // shows: Speaker, Lead
A bare string is shown exactly as stored. A `[value, label]` pair A bare string is shown exactly as stored. A `[value, label]` pair
stores the first and shows the second. That difference is what makes stores the first and shows the second. That difference is what makes
relabelling cheap. relabeling cheap.
### Renaming what a dropdown shows ### Renaming what a dropdown shows
@ -163,13 +163,13 @@ wrong rather than working around it.
**Fixed lists** (`options`: labels in `src/lib/adminSchema/`, values **Fixed lists** (`options`: labels in `src/lib/adminSchema/`, values
also in `server/src/admin-schema/` and a CHECK): also in `server/src/admin-schema/` and a CHECK):
| Entity → field | Stored values | Labelled? | Also used on the public site by | | Entity → field | Stored values | Labeled? | Also used on the public site by |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Organizations → Kind (+ list filter) | national, region, chapter, partner | no, shows values | `ORG_BASE` in `src/lib/hrefs.ts` (the route each kind uses) and `orgListHref` there (its back link) | | Organizations → Kind (+ list filter) | national, region, group, partner | no, shows values | `ORG_BASE` in `src/lib/hrefs.ts` (the route each kind uses) and `orgListHref` there (its back link) |
| Organizations → Region → Scope | domestic, international, virtual | no | the Community page groups regions by it | | Organizations → Region → Scope | domestic, international, virtual | no | the Community page groups regions by it |
| Organizations → Region areas → Edge | top, bottom | no | the chapter map (`OrgList-Map.tsx`) | | Organizations → Region areas → Edge | top, bottom | no | the group map (`OrgList-Map.tsx`) |
| Events → Type (+ list filter) | retreat, class, workshop, meeting, other | no | `EVENT_TYPES` in `src/lib/eventTypes.ts` (public labels and plurals) | | Events → Type (+ list filter) | retreat, class, workshop, meeting, other | no | `EVENT_TYPES` in `src/lib/eventTypes.ts` (public labels and plurals) |
| Events → Status (+ list filter) | upcoming, past, cancelled | no | `STATUS_LABEL` in `src/pages/EventDetail.tsx` | | Events → Status (+ list filter) | upcoming, past, cancelled (shown as canceled) | no | `STATUS_LABEL` in `src/pages/EventDetail.tsx` |
| Events → Series → Repeats | weekly, monthly_date, monthly_weekday | **yes** | `src/lib/eventSeries.ts` | | Events → Series → Repeats | weekly, monthly_date, monthly_weekday | **yes** | `src/lib/eventSeries.ts` |
| Events → People → Role | speaker, leader, facilitator, host, musician, volunteer, attendee | no | `ROLE_LABEL` in `src/pages/EventDetail.tsx` | | Events → People → Role | speaker, leader, facilitator, host, musician, volunteer, attendee | no | `ROLE_LABEL` in `src/pages/EventDetail.tsx` |
| People → Affiliations → Role; Teams → Members → Role | lead, board, staff, volunteer, member | no | `ROLE_LABEL` in `src/pages/PersonDetail.tsx` | | People → Affiliations → Role; Teams → Members → Role | lead, board, staff, volunteer, member | no | `ROLE_LABEL` in `src/pages/PersonDetail.tsx` |
@ -190,21 +190,21 @@ also in `server/src/admin-schema/` and a CHECK):
| Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a | | Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a |
"No, shows values" means the dropdown currently shows the raw value, "No, shows values" means the dropdown currently shows the raw value,
so relabelling it is just [adding labels](#renaming-what-a-dropdown-shows). so relabeling it is just [adding labels](#renaming-what-a-dropdown-shows).
**Lists filled from records** (`optionsFrom`: edit the records, not **Lists filled from records** (`optionsFrom`: edit the records, not
code): code):
| Dropdown | `optionsFrom` | Comes from | | Dropdown | `optionsFrom` | Comes from |
| --- | --- | --- | | --- | --- | --- |
| Chapter → Region | `regions` | organizations of kind region | | Group → Region | `regions` | organizations of kind region |
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) | | Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) |
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labelled by name | | Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labeled by name |
| Event hosts / event people / team members / timeline people → Person | `people` | people | | Event hosts / event people / team members / timeline people → Person | `people` | people |
| Community blog section → Pinned posts → Post | `blog_posts` | blog posts, newest first | | Community blog section → Pinned posts → Post | `blog_posts` | blog posts, newest first |
| Timeline → Record; Featured cards → Record | `record_refs` | every event, organization, award, person and team, narrowed by the type picked beside it | | Timeline → Record; Featured cards → Record | `record_refs` | every event, organization, award, person and team, narrowed by the type picked beside it |
| Affiliations → Team | `teams` | teams, filtered to the chosen organization | | Affiliations → Team | `teams` | teams, filtered to the chosen organization |
| Person awards → Award | `awards` | awards, labelled "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; Front page → Count down to; Front page → Featured event | `events` | events |
--- ---
@ -268,19 +268,19 @@ The numbers band's "Number Source" dropdown works the same way:
| What | File | Notes | | What | File | Notes |
| --- | --- | --- | | --- | --- | --- |
| Header and footer navigation, page subnav links | `src/navConfig.ts` | `PAGE_LINKS`, `PAGE_SECTIONS`, `NAV_ACTIONS`. A new page also needs a route in `src/App.tsx`. | | Header and footer navigation, page subnav links | `src/navConfig.ts` | `PAGE_LINKS`, `PAGE_SECTIONS`, `NAV_ACTIONS`. A new page also needs a route in `src/App.tsx`. |
| Section titles, blurbs and colours on Retreats, Community, Leadership, Resources, Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. A section's `id` must match its subnav `hash`. | | Section titles, blurbs and colors on Retreats, Community, Leadership, Resources, Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. A section's `id` must match its subnav `hash`. |
| 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. |
| Chapter 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 colours, light and dark | the database over `src/index.css` | Admin → Panel → Site settings → Colours (superadmins): pick a colour, 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 colour that arrives as data (a page accent, an event's or region's colour) 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 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. |
| A page section's accent colour | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a colour 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. |
| 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 | `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. |
| 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", "Chapter") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin); `orgListHref` in `src/lib/hrefs.ts` (the public back link, "All regions") | | | Organization kind labels ("Region", "Group") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin); `orgListHref` in `src/lib/hrefs.ts` (the public back link, "All regions") | |
| Admin account roles | `src/lib/roles.ts` (labels, notes) and `ROLES` in `server/src/auth.js` | Adding a role is also a CHECK change on `admin_users.role`. | | Admin account roles | `src/lib/roles.ts` (labels, notes) and `ROLES` in `server/src/auth.js` | Adding a role is also a CHECK change on `admin_users.role`. |
| Admin navigation | `src/pages/admin/adminNav.ts` | | | Admin navigation | `src/pages/admin/adminNav.ts` | |
| The live site's address (used by QR codes) | `SITE_ORIGIN` in `src/lib/site.ts` | | | The live site's address (used by QR codes) | `SITE_ORIGIN` in `src/lib/site.ts` | |

View file

@ -15,13 +15,13 @@
columns writable columns of the parent row columns writable columns of the parent row
extensions 1:1 side tables, optionally gated on a column extensions 1:1 side tables, optionally gated on a column
value (organizations.kind decides whether a value (organizations.kind decides whether a
regions or chapters row should exist) regions or groups row should exist)
children ordered collections, replaced wholesale on save children ordered collections, replaced wholesale on save
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 front_page)
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' colours) HttpError to refuse it (site settings' colors)
Replacing children wholesale is only safe because nothing has a Replacing children wholesale is only safe because nothing has a
foreign key INTO these tables. That is the dividing line, and foreign key INTO these tables. That is the dividing line, and
@ -86,7 +86,7 @@ export const OPTION_QUERIES = {
// dropdowns of which four are always wrong. The timeline and the // dropdowns of which four are always wrong. The timeline and the
// featured cards both pick from it. `kind` is the discriminator // featured cards both pick from it. `kind` is the discriminator
// the client's filterBy matches on; org_kind disambiguates the label, // the client's filterBy matches on; org_kind disambiguates the label,
// since a region and a chapter can share a name. // since a region and a group can share a name.
record_refs: ` record_refs: `
SELECT 'event' AS kind, id, title AS label FROM events SELECT 'event' AS kind, id, title AS label FROM events
UNION ALL UNION ALL

View file

@ -109,7 +109,7 @@ export const featuredCardsChild = (ownerKind) => ({
], ],
}); });
/* The two polymorphic collections, parameterised by owner_kind. */ /* The two polymorphic collections, parameterized by owner_kind. */
export const linksChild = (ownerKind) => ({ export const linksChild = (ownerKind) => ({
key: "links", key: "links",
table: "links", table: "links",
@ -189,12 +189,12 @@ export const blocksChild = (ownerKind) => ({
one with both selects filled, and that comes back keyed to the one with both selects filled, and that comes back keyed to the
row like any other field error. row like any other field error.
Not parameterised the way links and blocks are: this table is Not parameterized the way links and blocks are: this table is
events-only, and the owner column says so. events-only, and the owner column says so.
sort_order isn't declared. The engine writes it from the row's sort_order isn't declared. The engine writes it from the row's
position because `order` is "sort_order", which is what makes position because `order` is "sort_order", which is what makes
the first row the one v_events takes the logo and colour from. */ the first row the one v_events takes the logo and color from. */
export const hostsChild = { export const hostsChild = {
key: "event_hosts", key: "event_hosts",
table: "event_hosts", table: "event_hosts",

View file

@ -89,7 +89,7 @@ export const frontPage = {
"manual", "manual",
"years_since", "years_since",
"regions", "regions",
"chapters", "groups",
"partners", "partners",
"events_held", "events_held",
"retreats_held", "retreats_held",

View file

@ -28,7 +28,7 @@ export const organizations = {
}, },
columns: [ columns: [
enumeration("kind", ["national", "region", "chapter", "partner"], { enumeration("kind", ["national", "region", "group", "partner"], {
required: true, required: true,
}), }),
text("name", { required: true }), text("name", { required: true }),
@ -58,10 +58,10 @@ export const organizations = {
], ],
}, },
{ {
key: "chapter", key: "group",
table: "chapters", table: "groups",
idColumn: "id", idColumn: "id",
when: { column: "kind", value: "chapter" }, when: { column: "kind", value: "group" },
columns: [text("region_id"), text("meets"), text("started")], columns: [text("region_id"), text("meets"), text("started")],
}, },
], ],

View file

@ -386,7 +386,7 @@ async function cut(db, job) {
const { width, height } = await probe(input); const { width, height } = await probe(input);
if (width && height) { if (width && height) {
// Crop the source to the shape. The focus is where along the // Crop the source to the shape. The focus is where along the
// cropped direction the frame is centred (0 left/top, 1 // cropped direction the frame is centered (0 left/top, 1
// right/bottom); even sizes, as the H.264 encoder needs. // right/bottom); even sizes, as the H.264 encoder needs.
let w = width; let w = width;
let h = height; let h = height;

View file

@ -129,7 +129,7 @@ export function migrate(db, { log = console.log } = {}) {
throw new Error(`${file} leaves ${orphans.length} foreign key violation(s): ${where}`); throw new Error(`${file} leaves ${orphans.length} foreign key violation(s): ${where}`);
} }
// Not parameterisable, but version is a validated integer. // Not parameterizable, but version is a validated integer.
db.exec(`PRAGMA user_version = ${version}`); db.exec(`PRAGMA user_version = ${version}`);
}); });

View file

@ -148,7 +148,7 @@ async function findOrMakeFolder(path) {
const walked = []; const walked = [];
for (const name of path.split("/").filter(Boolean)) { for (const name of path.split("/").filter(Boolean)) {
// Each level on the way is known too: "Requests" once // Each level on the way is known too: "Requests" once
// "Requests/Chapters" has been found. // "Requests/Groups" has been found.
if (walked.length && !folders.has(walked.join("/"))) folders.set(walked.join("/"), Promise.resolve(parent)); if (walked.length && !folders.has(walked.join("/"))) folders.set(walked.join("/"), Promise.resolve(parent));
walked.push(name); walked.push(name);
const quoted = name.replace(/\\/g, "\\\\").replace(/'/g, "\\'"); const quoted = name.replace(/\\/g, "\\\\").replace(/'/g, "\\'");

View file

@ -24,7 +24,7 @@
which also drops its metadata, camera location included. which also drops its metadata, camera location included.
`keepOriginal` stores the bytes exactly as uploaded instead, `keepOriginal` stores the bytes exactly as uploaded instead,
under the tighter KEEP_MAX_BYTES. An SVG is always kept as it under the tighter KEEP_MAX_BYTES. An SVG is always kept as it
is: it's already small, and rasterising it would lose the point is: it's already small, and rasterizing it would lose the point
of it. of it.
Names are random, so two uploads of "logo.png" can't collide Names are random, so two uploads of "logo.png" can't collide

View file

@ -0,0 +1,219 @@
-- ═══════════════════════════════════════════════════════════════
-- 052 CHAPTERS BECOME GROUPS
--
-- Local chapters are called groups now, everywhere: the kind value,
-- the side table, the front page count, the Request form's type, the
-- pages (/groups/<id>, the Community page's #groups section).
--
-- organizations.kind 'chapter' → 'group' (CHECK changes, so
-- the table is rebuilt as 045 did, then
-- its indexes and triggers again)
-- chapters renamed groups, its index with it
-- front_page_stats.source 'chapters' → 'groups' (rebuilt), and
-- the seeded "Chapters" label
-- feedback.category 'chapter' → 'group' (a column CHECK
-- only, so a new column replaces it)
-- links in records the site's own /chapters/ and
-- #chapters links, in link columns and
-- [text](url) formatting
--
-- Names and prose written in the admin (an organization called
-- "Lynnwood Chapter", a post's paragraph) are left as written.
-- ═══════════════════════════════════════════════════════════════
-- ── organizations.kind ─────────────────────────────────────────
CREATE TABLE organizations_new (
id TEXT PRIMARY KEY, -- slug: 'northwest', 'lynnwood'
kind TEXT NOT NULL
CHECK (kind IN ('national', 'region', 'group', 'partner')),
name TEXT NOT NULL,
short_name TEXT,
tagline TEXT, -- one line, for the card
color TEXT,
logo TEXT, -- an upload's filename
venue TEXT,
address TEXT,
locality TEXT,
state_code TEXT, -- US only
country TEXT NOT NULL DEFAULT 'US',
location_label TEXT,
latitude REAL,
longitude REAL,
is_online INTEGER NOT NULL DEFAULT 0 CHECK (is_online IN (0, 1)),
is_published INTEGER NOT NULL DEFAULT 1 CHECK (is_published IN (0, 1)),
sort_order INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL DEFAULT (datetime('now')),
updated_at TEXT NOT NULL DEFAULT (datetime('now')),
in_timeline INTEGER NOT NULL DEFAULT 0 CHECK (in_timeline IN (0, 1)),
is_listed INTEGER NOT NULL DEFAULT 1 CHECK (is_listed IN (0, 1))
) STRICT;
INSERT INTO organizations_new
(id, kind, name, short_name, tagline, color, logo,
venue, address, locality, state_code, country, location_label,
latitude, longitude, is_online,
is_published, sort_order, created_at, updated_at, in_timeline, is_listed)
SELECT id, CASE kind WHEN 'chapter' THEN 'group' ELSE kind END,
name, short_name, tagline, color, logo,
venue, address, locality, state_code, country, location_label,
latitude, longitude, is_online,
is_published, sort_order, created_at, updated_at, in_timeline, is_listed
FROM organizations;
PRAGMA legacy_alter_table = ON;
DROP TABLE organizations;
ALTER TABLE organizations_new RENAME TO organizations;
PRAGMA legacy_alter_table = OFF;
CREATE INDEX organizations_kind_idx ON organizations (kind, is_published, sort_order);
CREATE INDEX organizations_state_idx ON organizations (state_code);
-- ── chapters → groups ──────────────────────────────────────────
ALTER TABLE chapters RENAME TO groups;
DROP INDEX chapters_region_idx;
CREATE INDEX groups_region_idx ON groups (region_id);
-- ── front_page_stats.source ────────────────────────────────────
CREATE TABLE front_page_stats_new (
id INTEGER PRIMARY KEY AUTOINCREMENT,
page_id TEXT NOT NULL REFERENCES front_page (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, -- '+', 'k', ' states'
note TEXT
) STRICT;
INSERT INTO front_page_stats_new
(id, page_id, sort_order, label, source, value, suffix, note)
SELECT id, page_id, sort_order,
CASE label WHEN 'Chapters' THEN 'Groups' ELSE label END,
CASE source WHEN 'chapters' THEN 'groups' ELSE source END,
value, suffix, note
FROM front_page_stats;
PRAGMA legacy_alter_table = ON;
DROP TABLE front_page_stats;
ALTER TABLE front_page_stats_new RENAME TO front_page_stats;
PRAGMA legacy_alter_table = OFF;
-- ── feedback.category ──────────────────────────────────────────
ALTER TABLE feedback ADD COLUMN category_new TEXT
CHECK (category_new IN ('blog', 'event', 'group', 'region', 'partner', 'team', 'award', 'person'));
UPDATE feedback SET category_new = CASE category WHEN 'chapter' THEN 'group' ELSE category END;
ALTER TABLE feedback DROP COLUMN category;
ALTER TABLE feedback RENAME COLUMN category_new TO category;
UPDATE feedback SET section_id = 'groups' WHERE section_id = 'chapters';
UPDATE feedback SET page_path = '/groups/' || substr(page_path, 11)
WHERE page_path LIKE '/chapters/%';
-- ── Seeded text ────────────────────────────────────────────────
UPDATE front_page_path_actions SET description = 'Groups and regions across the country.'
WHERE description = 'Chapters and regions across the country.';
UPDATE affiliations SET title = replace(replace(title, 'Chapter', 'Group'), 'chapter', 'group')
WHERE title LIKE '%chapter%';
-- ── The site's own links ───────────────────────────────────────
-- A link to one of our group pages or the Community page's section:
-- '/chapters/<id>', '/community#chapters', or either on our domain.
-- Someone else's site with a /chapters/ path is left alone.
UPDATE links SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
OR url LIKE '%/community#chapters' OR url = '#chapters';
UPDATE content_block_items SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
OR url LIKE '%/community#chapters' OR url = '#chapters';
UPDATE content_blocks SET href = replace(replace(href, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE href LIKE '/chapters/%' OR href LIKE '%nextgenerationofunity.org/chapters/%'
OR href LIKE '%/community#chapters' OR href = '#chapters';
UPDATE featured_cards SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
OR url LIKE '%/community#chapters' OR url = '#chapters';
UPDATE timeline_entries SET link_url = replace(replace(link_url, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE link_url LIKE '/chapters/%' OR link_url LIKE '%nextgenerationofunity.org/chapters/%'
OR link_url LIKE '%/community#chapters' OR link_url = '#chapters';
UPDATE front_page_slides SET link_url = replace(replace(link_url, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE link_url LIKE '/chapters/%' OR link_url LIKE '%nextgenerationofunity.org/chapters/%'
OR link_url LIKE '%/community#chapters' OR link_url = '#chapters';
UPDATE front_page_path_actions SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
OR url LIKE '%/community#chapters' OR url = '#chapters';
UPDATE front_page SET primary_url = replace(replace(primary_url, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE primary_url LIKE '/chapters/%' OR primary_url LIKE '%nextgenerationofunity.org/chapters/%'
OR primary_url LIKE '%/community#chapters' OR primary_url = '#chapters';
UPDATE front_page SET secondary_url = replace(replace(secondary_url, '/chapters/', '/groups/'), '#chapters', '#groups')
WHERE secondary_url LIKE '/chapters/%' OR secondary_url LIKE '%nextgenerationofunity.org/chapters/%'
OR secondary_url LIKE '%/community#chapters' OR secondary_url = '#chapters';
-- [text](url) formatting in block and item text.
UPDATE content_blocks
SET text = replace(replace(replace(text, '](/chapters/', '](/groups/'),
'](/community#chapters)', '](/community#groups)'),
'nextgenerationofunity.org/chapters/', 'nextgenerationofunity.org/groups/')
WHERE text LIKE '%](/chapters/%' OR text LIKE '%](/community#chapters)%'
OR text LIKE '%nextgenerationofunity.org/chapters/%';
UPDATE content_block_items
SET text = replace(replace(replace(text, '](/chapters/', '](/groups/'),
'](/community#chapters)', '](/community#groups)'),
'nextgenerationofunity.org/chapters/', 'nextgenerationofunity.org/groups/')
WHERE text LIKE '%](/chapters/%' OR text LIKE '%](/community#chapters)%'
OR text LIKE '%nextgenerationofunity.org/chapters/%';
-- ── Triggers last (see CLAUDE.md, Migrations) ──
-- Dropping organizations took its own triggers with it.
CREATE TRIGGER organizations_cleanup
AFTER DELETE ON organizations
BEGIN
DELETE FROM content_blocks WHERE owner_kind = 'organization' AND owner_id = old.id;
DELETE FROM links WHERE owner_kind = 'organization' AND owner_id = old.id;
END;
CREATE TRIGGER timeline_organizations_cleanup
AFTER DELETE ON organizations
BEGIN
DELETE FROM timeline_entries WHERE ref_kind = 'organization' AND ref_id = old.id;
END;
CREATE TRIGGER organizations_featured_cleanup
AFTER DELETE ON organizations
BEGIN
DELETE FROM featured_cards WHERE ref_kind = 'organization' AND ref_id = old.id;
END;
CREATE TRIGGER organizations_touch
AFTER UPDATE ON organizations
FOR EACH ROW WHEN new.updated_at = old.updated_at
BEGIN
UPDATE organizations SET updated_at = datetime('now') WHERE id = new.id;
END;

View file

@ -0,0 +1,34 @@
-- ═══════════════════════════════════════════════════════════════
-- 053 US SPELLING IN MESSAGES
--
-- The site is written in US English now. Two of 041's CHECKs are
-- named with the sentence the admin shows when a save breaks them
-- (admin-crud.js), and those said "colour"; the table is rebuilt to
-- rename them, the same columns and rows as before.
--
-- events.status keeps the value 'cancelled': it's stored data, and
-- the admin and the pages show it as "canceled".
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE site_setting_colors_new (
id INTEGER PRIMARY KEY AUTOINCREMENT,
settings_id TEXT NOT NULL REFERENCES site_settings (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
token TEXT NOT NULL CHECK (token IN (
'ink', 'body', 'muted', 'link', 'brand', 'action', 'action-hover',
'surface', 'tint', 'tint-soft', 'danger', 'danger-tint')),
light TEXT CONSTRAINT "A color must be written #rrggbb, eg. #0f7183."
CHECK (light IS NULL OR (length(light) = 7 AND light GLOB '#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]')),
dark TEXT CONSTRAINT "A dark color must be written #rrggbb, eg. #5ccbdc."
CHECK (dark IS NULL OR (length(dark) = 7 AND dark GLOB '#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]')),
UNIQUE (settings_id, token)
) STRICT;
INSERT INTO site_setting_colors_new (id, settings_id, sort_order, token, light, dark)
SELECT id, settings_id, sort_order, token, light, dark
FROM site_setting_colors;
PRAGMA legacy_alter_table = ON;
DROP TABLE site_setting_colors;
ALTER TABLE site_setting_colors_new RENAME TO site_setting_colors;
PRAGMA legacy_alter_table = OFF;

View file

@ -105,7 +105,7 @@ export function siteFor(db) {
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 || "", privacyEmail: row.privacy_email || base.privacyEmail || "",
// The admin's colours (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),
pages, pages,
@ -169,7 +169,7 @@ function firstParagraph(db, ownerKind, id, slot) {
/* ── One page ──────────────────────────────────────────────── */ /* ── One page ──────────────────────────────────────────────── */
const ORG_ROUTES = { region: "/regions", chapter: "/chapters", partner: "/partners", national: "/organizations" }; const ORG_ROUTES = { region: "/regions", group: "/groups", partner: "/partners", national: "/organizations" };
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 = db.prepare(`SELECT headline, subhead FROM front_page WHERE id = 'home'`).get();
@ -388,7 +388,7 @@ export function metaFor(db, rawPath) {
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 };
} }
const match = pathname.match(/^\/(events|regions|chapters|partners|organizations|teams|awards|people|blog)\/([^/]+)$/); const match = pathname.match(/^\/(events|regions|groups|partners|organizations|teams|awards|people|blog)\/([^/]+)$/);
if (!match) return notFound(meta); if (!match) return notFound(meta);
const [, base, rawId] = match; const [, base, rawId] = match;
@ -404,8 +404,8 @@ export function metaFor(db, rawPath) {
return eventMeta(site, db, id, meta); return eventMeta(site, db, id, meta);
case "regions": case "regions":
return organizationMeta(site, db, id, "region", meta); return organizationMeta(site, db, id, "region", meta);
case "chapters": case "groups":
return organizationMeta(site, db, id, "chapter", meta); return organizationMeta(site, db, id, "group", meta);
case "partners": case "partners":
return organizationMeta(site, db, id, "partner", meta); return organizationMeta(site, db, id, "partner", meta);
case "organizations": case "organizations":

View file

@ -192,7 +192,7 @@ auth.get("/google/callback", async (c) => {
deleteCookie(c, OAUTH_COOKIE, OAUTH_COOKIE_OPTIONS); deleteCookie(c, OAUTH_COOKIE, OAUTH_COOKIE_OPTIONS);
// Pressing Cancel on Google's screen comes back as ?error=. // Pressing Cancel on Google's screen comes back as ?error=.
if (c.req.query("error")) return backToLogin(c, "cancelled"); if (c.req.query("error")) return backToLogin(c, "canceled");
const code = c.req.query("code"); const code = c.req.query("code");
if (!saved?.state || !code || c.req.query("state") !== saved.state) { if (!saved?.state || !code || c.req.query("state") !== saved.state) {

View file

@ -206,7 +206,7 @@ clips.get("/clips/:id/download", async (c) => {
return streamFile(c, file, { return streamFile(c, file, {
type: audio ? "audio/mpeg" : "video/mp4", type: audio ? "audio/mpeg" : "video/mp4",
attachment: `${stem}-${job.id}.${audio ? "mp3" : "mp4"}`, attachment: `${stem}-${job.id}.${audio ? "mp3" : "mp4"}`,
// Only once the whole file has been read out: a cancelled // Only once the whole file has been read out: a canceled
// download keeps it for another try. // download keeps it for another try.
onComplete: () => onComplete: () =>
forgetDownloaded(db, job).catch((err) => console.warn(`clips: couldn't delete ${job.file}: ${err.message}`)), forgetDownloaded(db, job).catch((err) => console.warn(`clips: couldn't delete ${job.file}: ${err.message}`)),

View file

@ -3,7 +3,7 @@
GET /events list + the event scopes GET /events list + the event scopes
GET /events/:id one event, full body, people GET /events/:id one event, full body, people
GET /organizations list, ?kind=region|chapter|… GET /organizations list, ?kind=region|group|…
GET /organizations/:id one organization's page GET /organizations/:id one organization's page
GET /teams list, ?org=slug GET /teams list, ?org=slug
GET /teams/:id one team's page GET /teams/:id one team's page
@ -11,13 +11,13 @@
GET /awards/:id one award and its recipients GET /awards/:id one award and its recipients
Organizations are one table, so they're one endpoint. A region Organizations are one table, so they're one endpoint. A region
and a chapter differ by a handful of fields, which arrive under and a group differ by a handful of fields, which arrive under
`details` rather than as separate routes, that's what lets a `details` rather than as separate routes, that's what lets a
list component be written once and pointed at any kind. list component be written once and pointed at any kind.
The lists leave out unlisted records (is_listed = 0); the The lists leave out unlisted records (is_listed = 0); the
detail routes don't, since reaching one by its link is the detail routes don't, since reaching one by its link is the
point. A region's chapters and an organization's events, teams point. A region's groups and an organization's events, teams
and awards are lists too. See 027_listed.sql. and awards are lists too. See 027_listed.sql.
Responses carry their fallbacks already resolved: an event's Responses carry their fallbacks already resolved: an event's
@ -34,7 +34,7 @@
An event's hosts are a list, in billing order, and each one is An event's hosts are a list, in billing order, and each one is
either an organization or a person, `kind` says which, and either an organization or a person, `kind` says which, and
`org_kind` is there for the three organization routes. The `org_kind` is there for the three organization routes. The
first is the one the colour and logo fell back to, which is why first is the one the color and logo fell back to, which is why
order is data and not a display choice. order is data and not a display choice.
Two things the team and award routes deliberately don't do: Two things the team and award routes deliberately don't do:
@ -70,7 +70,7 @@ const content = new Hono();
// anything. stale-while-revalidate keeps the page instant while the // anything. stale-while-revalidate keeps the page instant while the
// refresh happens behind it. // refresh happens behind it.
const ORG_KINDS = ["national", "region", "chapter", "partner"]; const ORG_KINDS = ["national", "region", "group", "partner"];
/* ── Loaders ───────────────────────────────────────────────── */ /* ── Loaders ───────────────────────────────────────────────── */
@ -112,7 +112,7 @@ function shapeHost(row) {
kind: row.host_kind, // 'organization' | 'person' kind: row.host_kind, // 'organization' | 'person'
id: row.host_id, id: row.host_id,
name: row.host_name, name: row.host_name,
// Which of /regions, /chapters, /partners the slug belongs to. // Which of /regions, /groups, /partners the slug belongs to.
// Null for a person, whose route needs no disambiguating. // Null for a person, whose route needs no disambiguating.
org_kind: row.host_org_kind, org_kind: row.host_org_kind,
}; };
@ -264,11 +264,11 @@ function attachRegionDetails(db, orgs) {
) )
.all(...ids); .all(...ids);
// A region's chapters, enough of each for a list entry. // A region's groups, enough of each for a list entry.
const children = db const children = db
.prepare( .prepare(
`SELECT c.region_id, o.id, o.name, o.location_label, o.logo `SELECT c.region_id, o.id, o.name, o.location_label, o.logo
FROM chapters c FROM groups c
JOIN organizations o ON o.id = c.id AND o.is_published = 1 AND o.is_listed = 1 JOIN organizations o ON o.id = c.id AND o.is_published = 1 AND o.is_listed = 1
WHERE c.region_id IN (${marks(ids.length)}) WHERE c.region_id IN (${marks(ids.length)})
ORDER BY o.sort_order, o.name`, ORDER BY o.sort_order, o.name`,
@ -309,20 +309,20 @@ function attachRegionDetails(db, orgs) {
scope: byId[org.id]?.scope ?? null, scope: byId[org.id]?.scope ?? null,
map_note: byId[org.id]?.map_note ?? null, map_note: byId[org.id]?.map_note ?? null,
areas: areasBy.get(org.id) ?? [], areas: areasBy.get(org.id) ?? [],
chapters: childrenBy.get(org.id) ?? [], groups: childrenBy.get(org.id) ?? [],
}; };
} }
} }
function attachChapterDetails(db, orgs) { function attachGroupDetails(db, orgs) {
const ids = orgs.filter((o) => o.kind === "chapter").map((o) => o.id); const ids = orgs.filter((o) => o.kind === "group").map((o) => o.id);
if (ids.length === 0) return; if (ids.length === 0) return;
const rows = db const rows = db
.prepare( .prepare(
`SELECT c.id, c.region_id, c.meets, c.started, `SELECT c.id, c.region_id, c.meets, c.started,
r.name AS region_name, r.color AS region_color r.name AS region_name, r.color AS region_color
FROM chapters c FROM groups c
LEFT JOIN organizations r ON r.id = c.region_id LEFT JOIN organizations r ON r.id = c.region_id
WHERE c.id IN (${marks(ids.length)})`, WHERE c.id IN (${marks(ids.length)})`,
) )
@ -331,7 +331,7 @@ function attachChapterDetails(db, orgs) {
const byId = Object.fromEntries(rows.map((r) => [r.id, r])); const byId = Object.fromEntries(rows.map((r) => [r.id, r]));
for (const org of orgs) { for (const org of orgs) {
if (org.kind !== "chapter") continue; if (org.kind !== "group") continue;
const row = byId[org.id] ?? {}; const row = byId[org.id] ?? {};
org.details = { org.details = {
region_id: row.region_id ?? null, region_id: row.region_id ?? null,
@ -439,7 +439,7 @@ function attachAwards(db, orgs) {
/* ── Events ──────────────────────────────────────────────────── /* ── Events ────────────────────────────────────────────────────
Flat, with the event scopes alongside. Retreats.tsx owns the Flat, with the event scopes alongside. Retreats.tsx owns the
band titles and colours and filters this list by scope_id. band titles and colors and filters this list by scope_id.
Oldest first, undated last. The carousel shows the list as it Oldest first, undated last. The carousel shows the list as it
comes and opens on the first upcoming event, so past events comes and opens on the first upcoming event, so past events
@ -539,7 +539,7 @@ content.get("/events/:id", (c) => {
/* ── Organizations ───────────────────────────────────────────── /* ── Organizations ─────────────────────────────────────────────
GET /organizations every published, listed org GET /organizations every published, listed org
GET /organizations?kind=region one kind GET /organizations?kind=region one kind
GET /organizations?kind=region,chapter GET /organizations?kind=region,group
Whatever the kind, the common card fields are in the same Whatever the kind, the common card fields are in the same
places, so a list component reads `name`, `color`, `logo` and places, so a list component reads `name`, `color`, `logo` and
@ -584,13 +584,13 @@ content.get("/organizations", (c) => {
); );
attachRegionDetails(db, organizations); attachRegionDetails(db, organizations);
attachChapterDetails(db, organizations); attachGroupDetails(db, organizations);
attachLeadership(db, organizations); attachLeadership(db, organizations);
return json(c, { organizations }); return json(c, { organizations });
}); });
/* One organization's page: region, chapter, partner or NGU. */ /* One organization's page: region, group, partner or NGU. */
content.get("/organizations/:id", (c) => { content.get("/organizations/:id", (c) => {
const db = c.get("db"); const db = c.get("db");
const id = c.req.param("id"); const id = c.req.param("id");
@ -607,7 +607,7 @@ content.get("/organizations/:id", (c) => {
const one = [organization]; const one = [organization];
attachRegionDetails(db, one); attachRegionDetails(db, one);
attachChapterDetails(db, one); attachGroupDetails(db, one);
attachLeadership(db, one); attachLeadership(db, one);
attachTeams(db, one); attachTeams(db, one);
attachAwards(db, one); attachAwards(db, one);
@ -637,8 +637,8 @@ content.get("/organizations/:id", (c) => {
GET /teams/:id one team's page GET /teams/:id one team's page
An unpublished organization hides its teams too, in both An unpublished organization hides its teams too, in both
routes. Without that join a retired chapter's board stays routes. Without that join a retired group's board stays
reachable by URL after the chapter itself has gone. reachable by URL after the group itself has gone.
───────────────────────────────────────────────────────────── */ ───────────────────────────────────────────────────────────── */
content.get("/teams", (c) => { content.get("/teams", (c) => {

View file

@ -5,7 +5,7 @@
One flat list per kind, each row just enough to name a record One flat list per kind, each row just enough to name a record
and build its URL: id and name, plus the organization's kind, and build its URL: id and name, plus the organization's kind,
which decides whether its page is /regions, /chapters or which decides whether its page is /regions, /groups or
/partners. The QR code page reads it to offer "any page on the /partners. The QR code page reads it to offer "any page on the
site" without five list requests carrying descriptions, links site" without five list requests carrying descriptions, links
and blocks it would throw away. and blocks it would throw away.

View file

@ -2,7 +2,7 @@
FEEDBACK ROUTE: the only public write on the site FEEDBACK ROUTE: the only public write on the site
Everything hostile that will ever reach this service arrives Everything hostile that will ever reach this service arrives
here, so the defences live here rather than being sprinkled here, so the defenses live here rather than being sprinkled
around: around:
rate limit applied where this router is mounted (5/min) rate limit applied where this router is mounted (5/min)
@ -69,7 +69,7 @@ feedback.post("/", async (c) => {
const email = clean(body.email, LIMITS.email); const email = clean(body.email, LIMITS.email);
const message = clean(body.message, LIMITS.message); const message = clean(body.message, LIMITS.message);
const pagePath = clean(body.pagePath, LIMITS.pagePath); const pagePath = clean(body.pagePath, LIMITS.pagePath);
// The picker holds nav hashes ('#chapters'); the column holds ids. // The picker holds nav hashes ('#groups'); the column holds ids.
const sectionId = clean(body.sectionId, LIMITS.sectionId).replace(/^#/, ""); const sectionId = clean(body.sectionId, LIMITS.sectionId).replace(/^#/, "");
const feedbackType = TYPES.includes(body.feedbackType) const feedbackType = TYPES.includes(body.feedbackType)
? body.feedbackType ? body.feedbackType

View file

@ -6,7 +6,7 @@
v_timeline has already done the resolution: an entry with no title v_timeline has already done the resolution: an entry with no title
of its own carries the referenced record's name, an entry with no of its own carries the referenced record's name, an entry with no
date carries the event's starts_on, and org_kind rides along date carries the event's starts_on, and org_kind rides along
because /regions, /chapters and /partners are three routes and only because /regions, /groups and /partners are three routes and only
the database knows which a slug is. the database knows which a slug is.
What's left here is shaping, and three things the view can't do: What's left here is shaping, and three things the view can't do:

View file

@ -19,12 +19,12 @@
rows, and for awards only public citations to published people rows, and for awards only public citations to published people
(an award's page names its recipients whether they're listed or (an award's page names its recipients whether they're listed or
not, so the count does too). A count not, so the count does too). A count
that disagreed with the page it summarises would be worse than that disagreed with the page it summarizes would be worse than
none. 'manual' and 'years_since' read the row's own value. none. 'manual' and 'years_since' read the row's own value.
── Countdown ── ── Countdown ──
The pinned event if it is still published and not over, listed The pinned event if it is still published and not over, listed
or not; otherwise the next published, listed, non-cancelled or not; otherwise the next published, listed, non-canceled
event that hasn't ended. "Hasn't ended" is COALESCE(ends_on, starts_on) >= today, 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. 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`. The client works out the next meeting of a series from `series`.
@ -56,7 +56,7 @@ const PAGE_ID = "home";
const STAT_QUERIES = { const STAT_QUERIES = {
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`, regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`,
chapters: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'chapter' 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`, 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 events_held: `SELECT COUNT(*) AS n FROM v_events
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`, WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`,

View file

@ -2,11 +2,11 @@
REQUEST ROUTE: POST /api/requests REQUEST ROUTE: POST /api/requests
The Request form (/request): a blog post, an event, or a new or The Request form (/request): a blog post, an event, or a new or
updated chapter, region, partner, team, award or person, with up updated group, region, partner, team, award or person, with up
to MAX_FILES attachments. Stored as a feedback row of type to MAX_FILES attachments. Stored as a feedback row of type
'content' (046_content_requests.sql), files in Google Drive. 'content' (046_content_requests.sql), files in Google Drive.
The same defences as the feedback route (honeypot, length caps, The same defenses as the feedback route (honeypot, length caps,
a rate limit where it's mounted), plus: files are judged by their a rate limit where it's mounted), plus: files are judged by their
first bytes, not the name or type the browser claims, and nothing first bytes, not the name or type the browser claims, and nothing
goes to Drive until everything else has passed. goes to Drive until everything else has passed.
@ -30,7 +30,7 @@ const requests = new Hono();
const CATEGORIES = { const CATEGORIES = {
blog: ["new"], blog: ["new"],
event: ["new", "update"], event: ["new", "update"],
chapter: ["new", "update"], group: ["new", "update"],
region: ["update"], region: ["update"],
partner: ["new", "update"], partner: ["new", "update"],
team: ["new", "update"], team: ["new", "update"],
@ -64,12 +64,12 @@ export function cleanDetails(raw) {
} }
const MIN_MESSAGE = 10; const MIN_MESSAGE = 10;
// Where in the shared drive the files go (googleService.js): a // Where in the shared drive the files go (googleService.js): a
// folder per type under Requests, eg. Requests/Chapters. // folder per type under Requests, eg. Requests/Groups.
export const DRIVE_FOLDER = "Requests"; export const DRIVE_FOLDER = "Requests";
export const TYPE_FOLDERS = { export const TYPE_FOLDERS = {
blog: "Blog Posts", blog: "Blog Posts",
event: "Events", event: "Events",
chapter: "Chapters", group: "Groups",
region: "Regions", region: "Regions",
partner: "Partners", partner: "Partners",
team: "Teams", team: "Teams",

View file

@ -10,7 +10,7 @@
exercises all of it: exercises all of it:
/regions/showcase-region region: areas, map note, links, blocks /regions/showcase-region region: areas, map note, links, blocks
/chapters/showcase-chapter chapter: meets, started, region /groups/showcase-group group: meets, started, region
/teams/showcase-team team: a lead and members /teams/showcase-team team: a lead and members
/awards/showcase-award award: recipients, one at an event /awards/showcase-award award: recipients, one at an event
/people/showcase-person person: bio, links, roles past and /people/showcase-person person: bio, links, roles past and
@ -30,7 +30,7 @@
Published but unlisted by default: every page above works, and Published but unlisted by default: every page above works, and
none of it shows in the site's lists, counts, map or QR page. none of it shows in the site's lists, counts, map or QR page.
One consequence: a region's page lists only listed chapters, One consequence: a region's page lists only listed groups,
teams, awards and events, so the showcase region's are empty. teams, awards and events, so the showcase region's are empty.
--listed lists everything instead, and --listed lists everything instead, and
adds timeline entries, so the Community map, Retreats bands, adds timeline entries, so the Community map, Retreats bands,
@ -71,7 +71,7 @@ const IMAGE = "/uploads/showcase.jpg";
const POST_ID = "content-block-showcase"; const POST_ID = "content-block-showcase";
const REGION = "showcase-region"; const REGION = "showcase-region";
const CHAPTER = "showcase-chapter"; const GROUP = "showcase-group";
const TEAM = "showcase-team"; const TEAM = "showcase-team";
const AWARD = "showcase-award"; const AWARD = "showcase-award";
const PERSON = "showcase-person"; const PERSON = "showcase-person";
@ -147,7 +147,7 @@ const ALL_BLOCKS = [
]; ];
/* A record page's body: a handful of types, so it reads like a /* A record page's body: a handful of types, so it reads like a
real page rather than a catalogue. */ real page rather than a catalog. */
const pageBody = (what) => [ const pageBody = (what) => [
["heading", { text: `About this ${what}` }], ["heading", { text: `About this ${what}` }],
["paragraph", { text: `This is **showcase data** for a ${what} page. Every field on the record is filled in, so anything left blank on the page is something the page doesn't draw.\n\nSee the [content block showcase](/blog/${POST_ID}) for every block type.` }], ["paragraph", { text: `This is **showcase data** for a ${what} page. Every field on the record is filled in, so anything left blank on the page is something the page doesn't draw.\n\nSee the [content block showcase](/blog/${POST_ID}) for every block type.` }],
@ -229,7 +229,7 @@ tx(db, () => {
db.prepare(`DELETE FROM affiliations WHERE person_id LIKE 'showcase-%' OR org_id LIKE 'showcase-%'`).run(); db.prepare(`DELETE FROM affiliations WHERE person_id LIKE 'showcase-%' OR org_id LIKE 'showcase-%'`).run();
db.prepare(`DELETE FROM teams WHERE id LIKE 'showcase-%'`).run(); db.prepare(`DELETE FROM teams WHERE id LIKE 'showcase-%'`).run();
db.prepare(`DELETE FROM people WHERE id LIKE 'showcase-%'`).run(); db.prepare(`DELETE FROM people WHERE id LIKE 'showcase-%'`).run();
db.prepare(`DELETE FROM organizations WHERE id = ?`).run(CHAPTER); db.prepare(`DELETE FROM organizations WHERE id = ?`).run(GROUP);
db.prepare(`DELETE FROM organizations WHERE id LIKE 'showcase-%'`).run(); db.prepare(`DELETE FROM organizations WHERE id LIKE 'showcase-%'`).run();
/* ── Organizations ── */ /* ── Organizations ── */
@ -256,11 +256,11 @@ tx(db, () => {
blocks("organization", REGION, "body", pageBody("region")); blocks("organization", REGION, "body", pageBody("region"));
insert("organizations", { insert("organizations", {
id: CHAPTER, id: GROUP,
kind: "chapter", kind: "group",
name: "Showcase Chapter", name: "Showcase Group",
short_name: "Showcase Ch.", short_name: "Showcase Ch.",
tagline: "A chapter with every field filled in", tagline: "A group with every field filled in",
color: "#138ba0", color: "#138ba0",
logo: IMAGE, logo: IMAGE,
...place, ...place,
@ -270,10 +270,10 @@ tx(db, () => {
is_listed: LISTED, is_listed: LISTED,
sort_order: 99, sort_order: 99,
}); });
insert("chapters", { id: CHAPTER, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" }); insert("groups", { id: GROUP, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" });
links("organization", CHAPTER, standardLinks("Showcase Chapter")); links("organization", GROUP, standardLinks("Showcase Group"));
blocks("organization", CHAPTER, "card", cardText("chapter")); blocks("organization", GROUP, "card", cardText("group"));
blocks("organization", CHAPTER, "body", pageBody("chapter")); blocks("organization", GROUP, "body", pageBody("group"));
/* ── People ── */ /* ── People ── */
insert("people", { insert("people", {
@ -290,7 +290,7 @@ tx(db, () => {
country: "US", country: "US",
location_label: "Exampletown, PA", location_label: "Exampletown, PA",
bio: "Showcase Person is test data. This bio has two paragraphs so the page's spacing can be checked.\n\nThe second paragraph. Everything about this person is made up by seed-showcase.js.", bio: "Showcase Person is test data. This bio has two paragraphs so the page's spacing can be checked.\n\nThe second paragraph. Everything about this person is made up by seed-showcase.js.",
primary_org_id: CHAPTER, primary_org_id: GROUP,
is_published: 1, is_published: 1,
is_listed: LISTED, is_listed: LISTED,
}); });
@ -343,7 +343,7 @@ tx(db, () => {
blocks("team", TEAM, "body", pageBody("team")); blocks("team", TEAM, "body", pageBody("team"));
insert("affiliations", { person_id: PERSON, org_id: REGION, team_id: TEAM, title: "Showcase Team Lead", role: "lead", is_owner: 1, started_on: "2023-01-01", is_public: 1, sort_order: 0 }); insert("affiliations", { person_id: PERSON, org_id: REGION, team_id: TEAM, title: "Showcase Team Lead", role: "lead", is_owner: 1, started_on: "2023-01-01", is_public: 1, sort_order: 0 });
insert("affiliations", { person_id: PERSON, org_id: CHAPTER, title: "Former Chapter Coordinator", role: "volunteer", started_on: "2021-01-01", ended_on: "2022-12-31", is_public: 1, sort_order: 1 }); insert("affiliations", { person_id: PERSON, org_id: GROUP, title: "Former Group Coordinator", role: "volunteer", started_on: "2021-01-01", ended_on: "2022-12-31", is_public: 1, sort_order: 1 });
MEMBERS.forEach((id, i) => MEMBERS.forEach((id, i) =>
insert("affiliations", { person_id: id, org_id: REGION, team_id: TEAM, title: ["Treasurer", "Secretary", null][i], role: i === 2 ? "member" : "board", is_public: 1, sort_order: i + 1 }), insert("affiliations", { person_id: id, org_id: REGION, team_id: TEAM, title: ["Treasurer", "Secretary", null][i], role: i === 2 ? "member" : "board", is_public: 1, sort_order: i + 1 }),
); );
@ -409,7 +409,7 @@ tx(db, () => {
is_published: 1, is_published: 1,
is_listed: LISTED, is_listed: LISTED,
}); });
insert("event_hosts", { event_id: SERIES, org_id: CHAPTER, sort_order: 0 }); insert("event_hosts", { event_id: SERIES, org_id: GROUP, sort_order: 0 });
links("event", SERIES, [{ kind: "action", label: "Join on Zoom", url: "https://example.org/zoom" }]); links("event", SERIES, [{ kind: "action", label: "Join on Zoom", url: "https://example.org/zoom" }]);
blocks("event", SERIES, "card", cardText("series")); blocks("event", SERIES, "card", cardText("series"));
@ -489,7 +489,7 @@ db.close();
console.log(`✓ Showcase written (${LISTED ? "listed" : "unlisted: pages only"}):`); console.log(`✓ Showcase written (${LISTED ? "listed" : "unlisted: pages only"}):`);
for (const path of [ for (const path of [
`/regions/${REGION}`, `/regions/${REGION}`,
`/chapters/${CHAPTER}`, `/groups/${GROUP}`,
`/teams/${TEAM}`, `/teams/${TEAM}`,
`/awards/${AWARD}`, `/awards/${AWARD}`,
`/people/${PERSON}`, `/people/${PERSON}`,

View file

@ -1,8 +1,8 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
THEME THEME
The admin's palette (Panel → Site settings → Colours, table The admin's palette (Panel → Site settings → Colors, table
site_setting_colors) over the site's own colour tokens. site_setting_colors) over the site's own color tokens.
The defaults are THEME_DEFAULTS (themeDefaults.js), which the The defaults are THEME_DEFAULTS (themeDefaults.js), which the
build checks against src/index.css. A blank override keeps the build checks against src/index.css. A blank override keeps the
@ -117,6 +117,6 @@ export function checkTheme(db) {
} }
} }
if (problems.length) { if (problems.length) {
throw new HttpError(422, `These colours would be hard to read: ${problems.join("; ")}.`); throw new HttpError(422, `These colors would be hard to read: ${problems.join("; ")}.`);
} }
} }

View file

@ -1,15 +1,15 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
THEME DEFAULTS THEME DEFAULTS
The site's own colour tokens, light and dark: the one list both The site's own color tokens, light and dark: the one list both
the server (theme.js: contrast check, overrides) and the admin the server (theme.js: contrast check, overrides) and the admin
(Site settings → Colours: defaults shown) read. No imports, so the (Site settings → Colors: defaults shown) read. No imports, so the
browser bundle can take it too. browser bundle can take it too.
src/index.css holds the same values as CSS (@theme and its dark src/index.css holds the same values as CSS (@theme and its dark
block), since CSS can't import this. The build checks the two block), since CSS can't import this. The build checks the two
agree and stops if they don't (themeDefaultsCheck in agree and stops if they don't (themeDefaultsCheck in
vite.config.ts). Change a colour here and there together. vite.config.ts). Change a color here and there together.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
// light dark // light dark

View file

@ -20,7 +20,7 @@
}, },
"/community": { "/community": {
"title": "Community", "title": "Community",
"description": "Chapters, regions and the people who make up Next Generation of Unity." "description": "Groups, regions and the people who make up Next Generation of Unity."
}, },
"/leadership": { "/leadership": {
"title": "Leadership", "title": "Leadership",
@ -28,7 +28,7 @@
}, },
"/resources": { "/resources": {
"title": "Resources", "title": "Resources",
"description": "Teachings, brand assets, and material for chapters and partners." "description": "Teachings, brand assets, and material for groups and partners."
}, },
"/history": { "/history": {
"title": "History", "title": "History",
@ -40,11 +40,11 @@
}, },
"/request": { "/request": {
"title": "Request", "title": "Request",
"description": "Ask for a blog post, an event, or a new or updated chapter, region, partner, team, award or person on the site." "description": "Ask for a blog post, an event, or a new or updated group, region, partner, team, award or person on the site."
}, },
"/qr": { "/qr": {
"title": "QR Codes", "title": "QR Codes",
"description": "Codes for flyers, slides and signs, pointing at any page on the site or any link, in your choice of colours." "description": "Codes for flyers, slides and signs, pointing at any page on the site or any link, in your choice of colors."
}, },
"/give": { "/give": {
"title": "Giving", "title": "Giving",

View file

@ -17,7 +17,7 @@ import RequireRole from "./pages/admin/RequireRole.tsx"
// Home is the landing page, so it ships in the main bundle. Every // Home is the landing page, so it ships in the main bundle. Every
// other page, and all of the admin, is fetched when first visited: // other page, and all of the admin, is fetched when first visited:
// a visitor to the front page never downloads the admin, the QR // a visitor to the front page never downloads the admin, the QR
// encoder, the calendar or the chapter map. Layout and AdminLayout // encoder, the calendar or the group map. Layout and AdminLayout
// wrap their <Outlet /> in <Suspense>, so the header stays put while // wrap their <Outlet /> in <Suspense>, so the header stays put while
// a page loads. // a page loads.
import Home from "./pages/Home.tsx" import Home from "./pages/Home.tsx"
@ -94,7 +94,7 @@ export default function App() {
<Route path="/events/:id" element={<EventDetail />} /> <Route path="/events/:id" element={<EventDetail />} />
<Route path="community" element={<Community />} /> <Route path="community" element={<Community />} />
<Route path="/regions/:id" element={<OrganizationDetail />} /> <Route path="/regions/:id" element={<OrganizationDetail />} />
<Route path="/chapters/:id" element={<OrganizationDetail />} /> <Route path="/groups/:id" element={<OrganizationDetail />} />
<Route path="/partners/:id" element={<OrganizationDetail />} /> <Route path="/partners/:id" element={<OrganizationDetail />} />
<Route path="/organizations/:id" element={<OrganizationDetail />} /> <Route path="/organizations/:id" element={<OrganizationDetail />} />
<Route path="/teams/:id" element={<TeamDetail />} /> <Route path="/teams/:id" element={<TeamDetail />} />

View file

@ -3,7 +3,7 @@
NGU's dove, lifted from the original home page. The path and its NGU's dove, lifted from the original home page. The path and its
two transforms are the drawing as exported, untouched; only the two transforms are the drawing as exported, untouched; only the
wrapper changed, sized by the caller, coloured by currentColor, wrapper changed, sized by the caller, colored by currentColor,
and hidden from screen readers since it's decoration wherever and hidden from screen readers since it's decoration wherever
it appears. it appears.

View file

@ -2,7 +2,7 @@
LOGO LOGO
An <img> for a logo or mark that may not exist: no src, or a file An <img> for a logo or mark that may not exist: no src, or a file
that 404s, and it draws `fallback` instead (initials, a colour dot, that 404s, and it draws `fallback` instead (initials, a color dot,
or nothing). `src` is already resolved (mediaUrl in media.ts). An or nothing). `src` is already resolved (mediaUrl in media.ts). An
upload loads its 640px copy first (useSmallImage). Decorative by upload loads its 640px copy first (useSmallImage). Decorative by
default (alt ""), since a logo sits next to the name it stands for. default (alt ""), since a logo sits next to the name it stands for.

View file

@ -1,10 +1,10 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
ORG LOGO ORG LOGO
An organization's logo, or its initials in a square in its colour An organization's logo, or its initials in a square in its color
when there's no file or it fails to load. Decorative: the name is when there's no file or it fails to load. Decorative: the name is
always right beside it. Used by the organization lists and the always right beside it. Used by the organization lists and the
chapter map. group map.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import Logo from './Logo.tsx' import Logo from './Logo.tsx'

View file

@ -18,7 +18,7 @@
{ {
id: "local", // matches the nav hash, #local id: "local", // matches the nav hash, #local
title: "Local Chapters", title: "Local Groups",
blurb: "Optional line under the section heading.", blurb: "Optional line under the section heading.",
accent: BRAND, // heading, banner, rule accent: BRAND, // heading, banner, rule
background: "var(--color-tint)", background: "var(--color-tint)",

View file

@ -3,7 +3,7 @@
The three ways a detail page can fail to be a detail page. All The three ways a detail page can fail to be a detail page. All
four of them need the same thing, and it should be the same thing: four of them need the same thing, and it should be the same thing:
a visitor who hits a dead retreat link and a dead chapter link a visitor who hits a dead retreat link and a dead group link
shouldn't get two different pages. shouldn't get two different pages.
Rendered inside PageShell so the chrome doesn't flicker in and Rendered inside PageShell so the chrome doesn't flicker in and
@ -33,7 +33,7 @@ export default function PageState({
error: string | null error: string | null
notFound: boolean notFound: boolean
onRetry: () => void onRetry: () => void
/** Lowercase, as it appears mid-sentence: "retreat", "chapter". */ /** Lowercase, as it appears mid-sentence: "retreat", "group". */
noun: string noun: string
backTo: string backTo: string
backLabel: string backLabel: string

View file

@ -345,7 +345,7 @@ function buildTeamGroups(
return [ return [
{ {
id: data.team.id, id: data.team.id,
// One unlabelled team needs no heading; several always do. // One unlabeled team needs no heading; several always do.
label: teamCount > 1 || spec.label ? name : undefined, label: teamCount > 1 || spec.label ? name : undefined,
accent, accent,
people: data.people, people: data.people,

View file

@ -6,7 +6,7 @@ import type { Platform } from '../lib/platforms.ts'
PLATFORM ICON PLATFORM ICON
The brand mark for a link's platform (links.platform), drawn in The brand mark for a link's platform (links.platform), drawn in
currentColor so it takes the colour of the button it sits in. currentColor so it takes the color of the button it sits in.
Anything that isn't one of PLATFORMS in lib/platforms.ts, blank Anything that isn't one of PLATFORMS in lib/platforms.ts, blank
included, draws nothing, so a caller can always pass the field included, draws nothing, so a caller can always pass the field
straight through. straight through.

View file

@ -3,7 +3,7 @@
A QR code as an <svg>, sized by its container. A QR code as an <svg>, sized by its container.
`centre` puts something on a badge over the middle: the NGU dove, `center` puts something on a badge over the middle: the NGU dove,
or an image (an SVG from src/assets/qr, passed as a data: URL). or an image (an SVG from src/assets/qr, passed as a data: URL).
With anything there, the code switches to high error correction With anything there, the code switches to high error correction
so the modules under the badge are recovered when it's scanned so the modules under the badge are recovered when it's scanned
@ -17,7 +17,7 @@
doesn't, this just draws what it's given. doesn't, this just draws what it's given.
Everything is drawn in the SVG itself (no CSS, and an image is Everything is drawn in the SVG itself (no CSS, and an image is
embedded rather than linked), so the element serialises to a embedded rather than linked), so the element serializes to a
file that looks the same outside the page. `ref` reaches the file that looks the same outside the page. `ref` reaches the
<svg> for exactly that. <svg> for exactly that.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
@ -42,11 +42,11 @@ const BADGE = 0.24
/* DoveMark's own viewBox is 72.87 × 48.57. */ /* DoveMark's own viewBox is 72.87 × 48.57. */
const DOVE_ASPECT = 72.867699 / 48.568241 const DOVE_ASPECT = 72.867699 / 48.568241
export type QrCentre = { kind: 'dove'; color?: string } | { kind: 'image'; src: string } | null export type QrCenter = { kind: 'dove'; color?: string } | { kind: 'image'; src: string } | null
export default function QrCode({ export default function QrCode({
value, value,
centre = null, center = null,
ink = QR_INK, ink = QR_INK,
paper = QR_PAPER, paper = QR_PAPER,
label, label,
@ -54,7 +54,7 @@ export default function QrCode({
className, className,
}: { }: {
value: string value: string
centre?: QrCentre center?: QrCenter
ink?: string ink?: string
paper?: string paper?: string
/** Accessible name for the image, e.g. "QR code for /retreats". */ /** Accessible name for the image, e.g. "QR code for /retreats". */
@ -62,7 +62,7 @@ export default function QrCode({
ref?: Ref<SVGSVGElement> ref?: Ref<SVGSVGElement>
className?: string className?: string
}) { }) {
const level = centre ? 'H' : 'M' const level = center ? 'H' : 'M'
const matrix = useMemo(() => qrMatrix(value, level), [value, level]) const matrix = useMemo(() => qrMatrix(value, level), [value, level])
const path = useMemo(() => qrPath(matrix, MARGIN), [matrix]) const path = useMemo(() => qrPath(matrix, MARGIN), [matrix])
@ -86,7 +86,7 @@ export default function QrCode({
<rect width={total} height={total} fill={paper} /> <rect width={total} height={total} fill={paper} />
<path d={path} fill={ink} /> <path d={path} fill={ink} />
{centre && ( {center && (
<g shapeRendering="auto"> <g shapeRendering="auto">
<rect <rect
x={badgeAt} x={badgeAt}
@ -98,17 +98,17 @@ export default function QrCode({
stroke={ink} stroke={ink}
strokeWidth={0.35} strokeWidth={0.35}
/> />
{centre.kind === 'dove' ? ( {center.kind === 'dove' ? (
<DoveMark <DoveMark
x={(total - doveWidth) / 2} x={(total - doveWidth) / 2}
y={(total - doveHeight) / 2} y={(total - doveHeight) / 2}
width={doveWidth} width={doveWidth}
height={doveHeight} height={doveHeight}
style={{ color: centre.color ?? QR_DOVE }} style={{ color: center.color ?? QR_DOVE }}
/> />
) : ( ) : (
<image <image
href={centre.src} href={center.src}
x={(total - imageSize) / 2} x={(total - imageSize) / 2}
y={(total - imageSize) / 2} y={(total - imageSize) / 2}
width={imageSize} width={imageSize}

View file

@ -6,7 +6,7 @@
choice, else the system setting) so a dark visitor never sees a choice, else the system setting) so a dark visitor never sees a
white flash. Pressing this makes an explicit choice and remembers white flash. Pressing this makes an explicit choice and remembers
it; until then the site follows the system, including a change it; until then the site follows the system, including a change
made while the page is open. Colours come from the tokens in made while the page is open. Colors come from the tokens in
index.css. index.css.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */

View file

@ -140,7 +140,7 @@ const inputLocked =
/* ── Dotted paths ────────────────────────────────────────────── */ /* ── Dotted paths ────────────────────────────────────────────── */
/* What an empty colour field shows in its swatch and placeholder: /* What an empty color field shows in its swatch and placeholder:
the field's own default (a value, or one worked out from the row), the field's own default (a value, or one worked out from the row),
else the brand teal. */ else the brand teal. */
function colorPlaceholder(field, row): string { function colorPlaceholder(field, row): string {

View file

@ -10,7 +10,7 @@
sends it (FeedbackForm's fixedType), with an email required. sends it (FeedbackForm's fixedType), with an email required.
'general' isn't offered anywhere; it's the server's fallback for 'general' isn't offered anywhere; it's the server's fallback for
a type it doesn't recognise, so old rows still read sensibly. a type it doesn't recognize, so old rows still read sensibly.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
export const FEEDBACK_TYPES = [ export const FEEDBACK_TYPES = [

View file

@ -2,7 +2,7 @@
MAP GRID MAP GRID
Pure layout. Where each tile sits, what it's called, and how to Pure layout. Where each tile sits, what it's called, and how to
work out which tile a chapter belongs to. None of this is in the work out which tile a group belongs to. None of this is in the
database because none of it changes, Rhode Island will not be database because none of it changes, Rhode Island will not be
moving, and no admin form should offer to move it. moving, and no admin form should offer to move it.
@ -83,27 +83,27 @@ export const AREAS = Object.freeze([
export const AREA_BY_CODE = Object.fromEntries(AREAS.map((a) => [a.code, a])); export const AREA_BY_CODE = Object.fromEntries(AREAS.map((a) => [a.code, a]));
/* ── Which tile a chapter sits on ────────────────────────────── /* ── Which tile a group sits on ──────────────────────────────
The database stores a real address, state_code for US, and a The database stores a real address, state_code for US, and a
country code otherwise, rather than a tile name. This is the country code otherwise, rather than a tile name. This is the
one place that translates between the two, so adding a Mexico one place that translates between the two, so adding a Mexico
band later means a line here and nothing in SQL. band later means a line here and nothing in SQL.
Returns null for anything with no tile, which covers virtual Returns null for anything with no tile, which covers virtual
chapters and any country not drawn. groups and any country not drawn.
───────────────────────────────────────────────────────────── */ ───────────────────────────────────────────────────────────── */
const COUNTRY_AREA = { const COUNTRY_AREA = {
CA: "CANADA", // ISO country code, not California CA: "CANADA", // ISO country code, not California
}; };
export function areaForChapter(chapter) { export function areaForGroup(group) {
if (!chapter) return null; if (!group) return null;
if (chapter.is_online) return null; if (group.is_online) return null;
if (chapter.country === "US") { if (group.country === "US") {
return AREA_BY_CODE[chapter.state_code] ? chapter.state_code : null; return AREA_BY_CODE[group.state_code] ? group.state_code : null;
} }
return COUNTRY_AREA[chapter.country] ?? null; return COUNTRY_AREA[group.country] ?? null;
} }
/* ── Slices per tile ─────────────────────────────────────────── /* ── Slices per tile ───────────────────────────────────────────
@ -146,13 +146,13 @@ export function buildAreaSlices(regionAreas: any[] = [], regions: any[] = []) {
return byArea; return byArea;
} }
/* ── Chapter counts per tile ─────────────────────────────────── /* ── Group counts per tile ───────────────────────────────────
{ WA: 2, MO: 1, CANADA: 1 } { WA: 2, MO: 1, CANADA: 1 }
───────────────────────────────────────────────────────────── */ ───────────────────────────────────────────────────────────── */
export function countChaptersByArea(chapters: any[] = []) { export function countGroupsByArea(groups: any[] = []) {
const counts = {}; const counts = {};
for (const chapter of chapters) { for (const group of groups) {
const code = areaForChapter(chapter); const code = areaForGroup(group);
if (code) counts[code] = (counts[code] ?? 0) + 1; if (code) counts[code] = (counts[code] ?? 0) + 1;
} }
return counts; return counts;

View file

@ -6,8 +6,8 @@
CATEGORIES in server/src/routes/requests.js (and the CHECK in CATEGORIES in server/src/routes/requests.js (and the CHECK in
046_content_requests.sql); keep them in step. 046_content_requests.sql); keep them in step.
A link can open the form on one: requestLink("chapter") is A link can open the form on one: requestLink("group") is
/request?type=chapter. People, teams and awards have no buttons on /request?type=group. People, teams and awards have no buttons on
the site, but are here to pick. the site, but are here to pick.
`fields` are the details the form asks for on top of the name and `fields` are the details the form asks for on top of the name and
@ -24,7 +24,7 @@
name, which the admin picks by hand name, which the admin picks by hand
`entity` is the admin record it becomes, `preset` the values a new `entity` is the admin record it becomes, `preset` the values a new
one starts with (a chapter is an organization of kind chapter), and one starts with (a group is an organization of kind group), and
`heading` the editor field the request's name fills. `heading` the editor field the request's name fills.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
@ -91,20 +91,20 @@ export const REQUEST_TYPES: RequestType[] = [
], ],
}, },
{ {
id: "chapter", id: "group",
label: "Chapter", label: "Group",
hint: "A local NGU chapter", hint: "A local NGU group",
actions: ["new", "update"], actions: ["new", "update"],
subject: "The chapter's name", subject: "The group's name",
entity: "organizations", entity: "organizations",
heading: "name", heading: "name",
preset: { kind: "chapter" }, preset: { kind: "group" },
fields: [ fields: [
{ key: "region", label: "Region it's in", placeholder: "eg. Great Lakes" }, { key: "region", label: "Region it's in", placeholder: "eg. Great Lakes" },
CITY, CITY,
STATE, STATE,
COUNTRY, COUNTRY,
{ key: "meets", label: "When it meets", placeholder: "eg. 2nd Sundays, 6:00pm", to: { path: "chapter.meets" } }, { key: "meets", label: "When it meets", placeholder: "eg. 2nd Sundays, 6:00pm", to: { path: "group.meets" } },
WEBSITE, WEBSITE,
EMAIL, EMAIL,
DESCRIPTION, DESCRIPTION,

View file

@ -12,16 +12,16 @@
--font-display: 'Poppins', sans-serif; --font-display: 'Poppins', sans-serif;
--font-body: 'Montserrat', sans-serif; --font-body: 'Montserrat', sans-serif;
/* ── Colour tokens ───────────────────────────────────────────── /* ── Color tokens ─────────────────────────────────────────────
Named for what they do, not what they look like, because dark Named for what they do, not what they look like, because dark
mode (below) swaps the values. Use them as utilities mode (below) swaps the values. Use them as utilities
(text-muted, bg-surface, border-brand/20) or, in a style prop, (text-muted, bg-surface, border-brand/20) or, in a style prop,
as var(--color-muted). Every text colour passes WCAG AA (4.5:1) as var(--color-muted). Every text color passes WCAG AA (4.5:1)
on surface, tint and tint-soft in both modes. on surface, tint and tint-soft in both modes.
A colour that must stay the same in both modes (white text on A color that must stay the same in both modes (white text on
a dark band, a platform's own colour) stays a literal. Colours a dark band, a platform's own color) stays a literal. Colors
that arrive as data (page accents, event and region colours) go that arrive as data (page accents, event and region colors) go
through withAlpha() and accentText() in src/lib/color.ts. */ through withAlpha() and accentText() in src/lib/color.ts. */
--color-ink: #073d4a; /* headings */ --color-ink: #073d4a; /* headings */
--color-body: #26454c; /* body text */ --color-body: #26454c; /* body text */
@ -47,7 +47,7 @@
--shadow-2xl: 0 25px 50px -12px rgb(4 38 46 / 0.3); --shadow-2xl: 0 25px 50px -12px rgb(4 38 46 / 0.3);
} }
/* How much of an accent colour its text keeps (src/lib/color.ts, /* How much of an accent color its text keeps (src/lib/color.ts,
accentText): all of it on light, half (the rest white) on dark. */ accentText): all of it on light, half (the rest white) on dark. */
:root { :root {
--accent-text-mix: 100%; --accent-text-mix: 100%;

View file

@ -83,7 +83,7 @@ export const events = {
label: "Type", label: "Type",
options: ["retreat", "class", "workshop", "meeting", "other"], options: ["retreat", "class", "workshop", "meeting", "other"],
}, },
{ key: "status", label: "Status", options: ["upcoming", "past", "cancelled"] }, { key: "status", label: "Status", options: ["upcoming", "past", ["cancelled", "canceled"]] },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] }, { key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] }, { key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
], ],
@ -128,7 +128,7 @@ export const events = {
path: "status", path: "status",
label: "Status", label: "Status",
widget: "select", widget: "select",
options: ["upcoming", "past", "cancelled"], options: ["upcoming", "past", ["cancelled", "canceled"]],
blankLabel: "Default: derive from end date", blankLabel: "Default: derive from end date",
}, },
{ {
@ -146,7 +146,7 @@ export const events = {
fields: [ fields: [
{ path: "event_logo", label: "Event logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true }, { path: "event_logo", label: "Event logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true },
{ path: "org_logo", label: "Org logo override", widget: "image", folder: "logos", resolve: mediaUrl, full: true }, { path: "org_logo", label: "Org logo override", widget: "image", folder: "logos", resolve: mediaUrl, full: true },
{ path: "color", label: "Colour", widget: "color" }, { path: "color", label: "Color", widget: "color" },
{ {
path: "card_image", path: "card_image",
label: "Card background", label: "Card background",

View file

@ -28,7 +28,7 @@ const STAT_SOURCES = [
["manual", "Print Value Field"], ["manual", "Print Value Field"],
["years_since", "Years Since Value"], ["years_since", "Years Since Value"],
["regions", "Count: regions"], ["regions", "Count: regions"],
["chapters", "Count: chapters"], ["groups", "Count: groups"],
["partners", "Count: partners"], ["partners", "Count: partners"],
["events_held", "Count: past events"], ["events_held", "Count: past events"],
["retreats_held", "Count: past retreats"], ["retreats_held", "Count: past retreats"],
@ -55,7 +55,7 @@ export const frontPage = {
label: "Background", label: "Background",
widget: "select", widget: "select",
options: [ options: [
["brand", "Brand: animated colour and the dove"], ["brand", "Brand: animated color and the dove"],
["photos", "Photos: cycles through the photos below"], ["photos", "Photos: cycles through the photos below"],
], ],
blankLabel: "Default: brand", blankLabel: "Default: brand",

View file

@ -20,7 +20,7 @@ export const organizations = {
{ key: "is_listed", label: "Listed", widget: "bool" }, { key: "is_listed", label: "Listed", widget: "bool" },
], ],
filters: [ filters: [
{ key: "kind", label: "Kind", options: ["national", "region", "chapter", "partner"] }, { key: "kind", label: "Kind", options: ["national", "region", "group", "partner"] },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] }, { key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] }, { key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
], ],
@ -34,14 +34,14 @@ export const organizations = {
path: "kind", path: "kind",
label: "Kind", label: "Kind",
widget: "select", widget: "select",
options: ["national", "region", "chapter", "partner"], options: ["national", "region", "group", "partner"],
required: true, required: true,
help: "Changing this swaps which extra fields apply", help: "Changing this swaps which extra fields apply",
}, },
{ path: "name", label: "Name", required: true }, { path: "name", label: "Name", required: true },
{ path: "short_name", label: "Short name" }, { path: "short_name", label: "Short name" },
{ path: "tagline", label: "Tagline", full: true }, { path: "tagline", label: "Tagline", full: true },
{ path: "color", label: "Colour", widget: "color" }, { path: "color", label: "Color", widget: "color" },
{ path: "logo", label: "Logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true }, { path: "logo", label: "Logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true },
], ],
}, },
@ -60,18 +60,18 @@ export const organizations = {
], ],
}, },
{ {
legend: "Chapter", legend: "Group",
when: { path: "kind", value: "chapter" }, when: { path: "kind", value: "group" },
fields: [ fields: [
{ {
path: "chapter.region_id", path: "group.region_id",
label: "Region", label: "Region",
widget: "select", widget: "select",
optionsFrom: "regions", optionsFrom: "regions",
blankLabel: "Default: none", blankLabel: "Default: none",
}, },
{ path: "chapter.meets", label: "Meets", help: "2nd Sundays, 6:00pm" }, { path: "group.meets", label: "Meets", help: "2nd Sundays, 6:00pm" },
{ path: "chapter.started", label: "Started", help: "Since 2021" }, { path: "group.started", label: "Started", help: "Since 2021" },
], ],
}, },
{ legend: "Place", fields: PLACE_FIELDS }, { legend: "Place", fields: PLACE_FIELDS },

View file

@ -228,10 +228,10 @@ export const linksChild = {
organization or a person, never both, which the CHECK on organization or a person, never both, which the CHECK on
event_hosts enforces and this form can only ask nicely about. event_hosts enforces and this form can only ask nicely about.
The first row supplies the logo and colour when the event sets The first row supplies the logo and color when the event sets
neither, so the order here is data rather than a display choice. neither, so the order here is data rather than a display choice.
A person supplies neither: there is no colour on a person and a A person supplies neither: there is no color on a person and a
headshot is not a logo, so a person-hosted event with no colour headshot is not a logo, so a person-hosted event with no color
of its own falls through to the section default. */ of its own falls through to the section default. */
export const hostsChild = { export const hostsChild = {
key: "event_hosts", key: "event_hosts",

View file

@ -12,7 +12,7 @@ const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).m
/* The palette an admin can change, in the order the dropdown lists /* The palette an admin can change, in the order the dropdown lists
it: token and label. The defaults come from the server's list it: token and label. The defaults come from the server's list
(server/src/themeDefaults.js), which the build checks against (server/src/themeDefaults.js), which the build checks against
src/index.css, so there's one copy of each colour to change. */ src/index.css, so there's one copy of each color to change. */
const THEME_LABELS: [string, string][] = [ const THEME_LABELS: [string, string][] = [
["ink", "Headings"], ["ink", "Headings"],
["body", "Body text"], ["body", "Body text"],
@ -162,15 +162,15 @@ export const siteSettings = {
children: [ children: [
{ {
key: "colors", key: "colors",
label: "Colours", label: "Colors",
note: "Change any of the site's colours, for light mode, dark mode or both; a blank keeps the default. Saving refuses a palette that would make text hard to read (under 4.5:1). Changes show on the next page load.", note: "Change any of the site's colors, for light mode, dark mode or both; a blank keeps the default. Saving refuses a palette that would make text hard to read (under 4.5:1). Changes show on the next page load.",
addLabel: "Change a colour", addLabel: "Change a color",
title: (row) => THEME_COLORS.find(([token]) => token === row.token)?.[1] ?? "New colour", title: (row) => THEME_COLORS.find(([token]) => token === row.token)?.[1] ?? "New color",
blank: { token: "", light: "", dark: "" }, blank: { token: "", light: "", dark: "" },
fields: [ fields: [
{ {
path: "token", path: "token",
label: "Colour", label: "Color",
widget: "select", widget: "select",
options: THEME_COLORS.map(([token, label]) => [token, label]), options: THEME_COLORS.map(([token, label]) => [token, label]),
required: true, required: true,

View file

@ -46,7 +46,7 @@ export const teams = {
}, },
{ path: "name", label: "Name", required: true, help: "Board, Leadership Team" }, { path: "name", label: "Name", required: true, help: "Board, Leadership Team" },
{ path: "tagline", label: "Tagline", full: true }, { path: "tagline", label: "Tagline", full: true },
{ path: "color", label: "Colour", widget: "color" }, { path: "color", label: "Color", widget: "color" },
{ path: "logo", label: "Logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true }, { path: "logo", label: "Logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true },
], ],
}, },

View file

@ -1,8 +1,9 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
ADMIN PAGE WIDTH ADMIN PAGE WIDTH
The admin column is max-w-5xl. The record editor wants more: its The admin column is max-w-5xl. The record editor wants more (its
section nav sits to the left of a form that keeps that width. section nav sits to the left of a form that keeps that width), and
so does the admin home (three cards across).
Like the title (adminTitle.tsx), the page asks and the layout Like the title (adminTitle.tsx), the page asks and the layout
decides, so AdminLayout stays the one place that sets <main>'s decides, so AdminLayout stays the one place that sets <main>'s
width. width.

View file

@ -1,14 +1,14 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
COLOR COLOR
Two helpers for colours that arrive as data (a page's accent, an Two helpers for colors that arrive as data (a page's accent, an
event's or region's colour), so they work with the theme tokens event's or region's color), so they work with the theme tokens
in index.css as well as with hex. in index.css as well as with hex.
withAlpha(color, 20) is that colour at 20% opacity, for tints and withAlpha(color, 20) is that color at 20% opacity, for tints and
borders. It replaces `${color}33`, which only works on hex. borders. It replaces `${color}33`, which only works on hex.
accentText(color) is that colour as text: itself in light mode, accentText(color) is that color as text: itself in light mode,
mixed halfway to white in dark mode (--accent-text-mix), so an mixed halfway to white in dark mode (--accent-text-mix), so an
accent picked for a white page still reads on a dark one. accent picked for a white page still reads on a dark one.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
@ -19,8 +19,8 @@ export const withAlpha = (color: string, percent: number): string =>
export const accentText = (color: string): string => export const accentText = (color: string): string =>
`color-mix(in srgb, ${color} var(--accent-text-mix), #ffffff)` `color-mix(in srgb, ${color} var(--accent-text-mix), #ffffff)`
/* Text for on top of a colour that arrives as data: white or deep /* Text for on top of a color that arrives as data: white or deep
ink, whichever has more contrast (WCAG), so a pale colour an admin ink, whichever has more contrast (WCAG), so a pale color an admin
picks still gets readable text. Anything that isn't #rrggbb (a picks still gets readable text. Anything that isn't #rrggbb (a
CSS variable, say) gets white, which suits the site's own dark CSS variable, say) gets white, which suits the site's own dark
accents. */ accents. */
@ -40,8 +40,8 @@ export function readableOn(color: string): string {
/* ── The site's accents ────────────────────────────────────────── /* ── The site's accents ──────────────────────────────────────────
BRAND is the teal every page uses as its accent; it's the button BRAND is the teal every page uses as its accent; it's the button
token, so the admin's palette (Site settings → Colours) reaches it. token, so the admin's palette (Site settings → Colors) reaches it.
ACCENTS are the other section colours a page may give a band, all ACCENTS are the other section colors a page may give a band, all
from the same family and all readable as text on white and on the from the same family and all readable as text on white and on the
tints (5:1 or better). Use these rather than a new hex. */ tints (5:1 or better). Use these rather than a new hex. */
export const BRAND = 'var(--color-action)' export const BRAND = 'var(--color-action)'

View file

@ -4,7 +4,7 @@
Turns the link an admin pastes into the URL an <iframe> can Turns the link an admin pastes into the URL an <iframe> can
load. People paste the page they're looking at (a YouTube watch load. People paste the page they're looking at (a YouTube watch
or live link, a Facebook video, a Vimeo page), not the embed or live link, a Facebook video, a Vimeo page), not the embed
form, so those are recognised and rewritten. Anything else that form, so those are recognized and rewritten. Anything else that
is https is assumed to already be an embed URL and passed is https is assumed to already be an embed URL and passed
through; anything that isn't https is refused, so the hero never through; anything that isn't https is refused, so the hero never
frames a plain-http or javascript: URL. frames a plain-http or javascript: URL.

View file

@ -7,7 +7,7 @@
What this is not: event_scopes. A scope owns presentation: What this is not: event_scopes. A scope owns presentation:
Retreats.tsx keys its title, accent and background on the id, so Retreats.tsx keys its title, accent and background on the id, so
an unrecognised scope_id makes an event vanish with no error, an unrecognized scope_id makes an event vanish with no error,
which is why that one is a real table with a real foreign key. A which is why that one is a real table with a real foreign key. A
type carries no presentation of its own and an unknown value type carries no presentation of its own and an unknown value
renders as its own name, so a CHECK is enough. renders as its own name, so a CHECK is enough.

View file

@ -5,7 +5,7 @@
never sends paths, it sends `{ kind, id }` and, for an never sends paths, it sends `{ kind, id }` and, for an
organization, the `org_kind` that decides which of the three organization, the `org_kind` that decides which of the three
routes a slug belongs to. Deciding that in each component is how routes a slug belongs to. Deciding that in each component is how
/regions/x and /chapters/x end up both existing for the same /regions/x and /groups/x end up both existing for the same
record, and how the history timeline ended up emitting /event/:id record, and how the history timeline ended up emitting /event/:id
while the router only knew /retreats/:id. while the router only knew /retreats/:id.
@ -18,7 +18,7 @@
── On missing ids ── ── On missing ids ──
Every builder takes an id the caller believed it had. When it Every builder takes an id the caller believed it had. When it
doesn't, the old behaviour was to interpolate the string doesn't, the old behavior was to interpolate the string
"undefined" into a path, render a link to it, mount a page and "undefined" into a path, render a link to it, mount a page and
fetch /api/organizations/undefined, four steps between the fetch /api/organizations/undefined, four steps between the
mistake and any sign of it, none of which name the component mistake and any sign of it, none of which name the component
@ -30,16 +30,16 @@
detailPath() returns null for it, so useRecord never fetches it. detailPath() returns null for it, so useRecord never fetches it.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
export type OrgKind = 'national' | 'region' | 'chapter' | 'partner' export type OrgKind = 'national' | 'region' | 'group' | 'partner'
export type RefKind = 'event' | 'organization' | 'team' | 'award' | 'person' export type RefKind = 'event' | 'organization' | 'team' | 'award' | 'person'
/* A region, a chapter and a partner read as different things to a /* A region, a group and a partner read as different things to a
visitor even though they are one table, so they get one route visitor even though they are one table, so they get one route
each. 'national' is NGU itself, one record, no listing to sit each. 'national' is NGU itself, one record, no listing to sit
under, so it falls through to the generic path. */ under, so it falls through to the generic path. */
const ORG_BASE: Record<string, string> = { const ORG_BASE: Record<string, string> = {
region: '/regions', region: '/regions',
chapter: '/chapters', group: '/groups',
partner: '/partners', partner: '/partners',
national: '/organizations', national: '/organizations',
} }
@ -152,14 +152,14 @@ export function refHref(
} }
} }
/* Where "back" goes from a record page. A chapter belongs to /* Where "back" goes from a record page. A group belongs to
/community, a retreat to /retreats. */ /community, a retreat to /retreats. */
export function orgListHref(kind?: string | null): { to: string; label: string } { export function orgListHref(kind?: string | null): { to: string; label: string } {
switch (kind) { switch (kind) {
case 'region': case 'region':
return { to: '/community#regions', label: 'All regions' } return { to: '/community#regions', label: 'All regions' }
case 'chapter': case 'group':
return { to: '/community#chapters', label: 'All chapters' } return { to: '/community#groups', label: 'All groups' }
case 'partner': case 'partner':
return { to: '/community#partners', label: 'All partner organizations' } return { to: '/community#partners', label: 'All partner organizations' }
default: default:

View file

@ -1,7 +1,7 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
ORGANIZATIONS ORGANIZATIONS
Regions, chapters, partners and NGU itself are one table and one Regions, groups, partners and NGU itself are one table and one
endpoint. Anything that lists organizations reads them the same endpoint. Anything that lists organizations reads them the same
way and filters by kind: way and filters by kind:
@ -9,13 +9,13 @@
const { organizations } = useOrganizations("partner"); const { organizations } = useOrganizations("partner");
const { organizations } = useOrganizations(); // all const { organizations } = useOrganizations(); // all
Every organization has the same card surface, name, colour, Every organization has the same card surface, name, color,
logo, description, links. What differs by kind sits under logo, description, links. What differs by kind sits under
`details`, so a list component can render the common parts `details`, so a list component can render the common parts
without knowing what it's holding: without knowing what it's holding:
region { scope, map_note, areas[], chapters[] } region { scope, map_note, areas[], groups[] }
chapter { region_id, region_name, region_color, meets, started } group { region_id, region_name, region_color, meets, started }
partner {} partner {}
Each kind is a separate request path, so the cache in api.ts Each kind is a separate request path, so the cache in api.ts
@ -47,7 +47,7 @@ export function useOrganizations(kind) {
one for the rest (NGU itself) or a bad id. one for the rest (NGU itself) or a bad id.
───────────────────────────────────────────────────────────── */ ───────────────────────────────────────────────────────────── */
const WITH_PAGE = new Set(["region", "chapter", "partner"]); const WITH_PAGE = new Set(["region", "group", "partner"]);
export function orgPath(org) { export function orgPath(org) {
return WITH_PAGE.has(org?.kind) && !isBadId(org.id) ? orgHref(org.id, org.kind) : null; return WITH_PAGE.has(org?.kind) && !isBadId(org.id) ? orgHref(org.id, org.kind) : null;

View file

@ -27,7 +27,7 @@ export function qrMatrix(text: string, level: QrLevel): QrMatrix {
return { size: modules.size, dark: (row, col) => modules.get(row, col) === 1 } return { size: modules.size, dark: (row, col) => modules.get(row, col) === 1 }
} }
/* The dark modules as one SVG path, a run of horizontal neighbours /* The dark modules as one SVG path, a run of horizontal neighbors
per subpath, offset by the quiet zone. One element instead of a per subpath, offset by the quiet zone. One element instead of a
rect per module keeps the markup (and the SVG download) small. */ rect per module keeps the markup (and the SVG download) small. */
export function qrPath(matrix: QrMatrix, margin: number): string { export function qrPath(matrix: QrMatrix, margin: number): string {

View file

@ -7,7 +7,7 @@ import RequestLink from "../components/RequestLink.tsx";
A page is a list of sections, and a section is a view over data A page is a list of sections, and a section is a view over data
the database already holds, narrowed by a filter. The map of the database already holds, narrowed by a filter. The map of
chapters and the vertical list of regions are the same rows seen groups and the vertical list of regions are the same rows seen
two ways; the three bands of retreats are one view seen three two ways; the three bands of retreats are one view seen three
times with a different filter each. times with a different filter each.
@ -24,8 +24,8 @@ import RequestLink from "../components/RequestLink.tsx";
Toggle: EventCardsToggle, Toggle: EventCardsToggle,
}, },
request: { // optional button request: { // optional button
type: "chapter", // to the Request form type: "group", // to the Request form
label: "Add or update a chapter", label: "Add or update a group",
}, },
} }

View file

@ -1,10 +1,10 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
useCommunity useCommunity
The chapter map's view of the organization list (OrgList-Map). The group map's view of the organization list (OrgList-Map).
Regions and chapters are the same table and the same endpoint; Regions and groups are the same table and the same endpoint;
this hook reshapes them into what a map needs, slices per tile, this hook reshapes them into what a map needs, slices per tile,
counts per tile, chapters grouped by region. counts per tile, groups grouped by region.
Two things live elsewhere: Two things live elsewhere:
@ -24,17 +24,17 @@ import {
useOrganizations, useOrganizations,
} from "./organizations.ts"; } from "./organizations.ts";
import { import {
areaForChapter, areaForGroup,
buildAreaSlices, buildAreaSlices,
countChaptersByArea, countGroupsByArea,
} from "../data/mapGrid.ts"; } from "../data/mapGrid.ts";
export function useCommunity() { export function useCommunity() {
const regionsQuery = useOrganizations("region"); const regionsQuery = useOrganizations("region");
const chaptersQuery = useOrganizations("chapter"); const groupsQuery = useOrganizations("group");
const rawRegions = regionsQuery.organizations; const rawRegions = regionsQuery.organizations;
const rawChapters = chaptersQuery.organizations; const rawGroups = groupsQuery.organizations;
return useMemo(() => { return useMemo(() => {
/* ── Regions ─────────────────────────────────────────────── /* ── Regions ───────────────────────────────────────────────
@ -52,18 +52,18 @@ export function useCommunity() {
region.areas.map((area) => ({ ...area, region_id: region.id })), region.areas.map((area) => ({ ...area, region_id: region.id })),
); );
/* ── Chapters, each tagged with the tile it lights up ────── /* ── Groups, each tagged with the tile it lights up ──────
The database stores a real address; which square that maps The database stores a real address; which square that maps
to is a rendering question, answered here once rather than to is a rendering question, answered here once rather than
at every call site. */ at every call site. */
const chapters = rawChapters.map((org) => ({ const groups = rawGroups.map((org) => ({
...org, ...org,
region_id: org.details?.region_id ?? null, region_id: org.details?.region_id ?? null,
region_name: org.details?.region_name ?? null, region_name: org.details?.region_name ?? null,
region_color: org.details?.region_color ?? null, region_color: org.details?.region_color ?? null,
meets: org.details?.meets ?? null, meets: org.details?.meets ?? null,
started: org.details?.started ?? null, started: org.details?.started ?? null,
area_code: areaForChapter(org), area_code: areaForGroup(org),
})); }));
const regionById = Object.fromEntries(regions.map((r) => [r.id, r])); const regionById = Object.fromEntries(regions.map((r) => [r.id, r]));
@ -73,17 +73,17 @@ export function useCommunity() {
primary and a remainder, so the SVG never does arithmetic. */ primary and a remainder, so the SVG never does arithmetic. */
const slices = buildAreaSlices(regionAreas, regions); const slices = buildAreaSlices(regionAreas, regions);
const chapterCounts = countChaptersByArea(chapters); const groupCounts = countGroupsByArea(groups);
const chaptersByRegion = new Map(); const groupsByRegion = new Map();
for (const chapter of chapters) { for (const group of groups) {
if (!chapter.region_id) continue; if (!group.region_id) continue;
const list = chaptersByRegion.get(chapter.region_id); const list = groupsByRegion.get(group.region_id);
if (list) list.push(chapter); if (list) list.push(group);
else chaptersByRegion.set(chapter.region_id, [chapter]); else groupsByRegion.set(group.region_id, [group]);
} }
const chaptersIn = (regionId) => chaptersByRegion.get(regionId) ?? []; const groupsIn = (regionId) => groupsByRegion.get(regionId) ?? [];
/* Sorted by name to match how the page has always shown them, /* Sorted by name to match how the page has always shown them,
rather than by the sort_order the API returns. */ rather than by the sort_order the API returns. */
@ -108,8 +108,8 @@ export function useCommunity() {
.filter(Boolean); .filter(Boolean);
return { return {
loading: regionsQuery.loading || chaptersQuery.loading, loading: regionsQuery.loading || groupsQuery.loading,
error: regionsQuery.error ?? chaptersQuery.error, error: regionsQuery.error ?? groupsQuery.error,
regions, regions,
regionAreas, regionAreas,
@ -118,11 +118,11 @@ export function useCommunity() {
international, international,
virtual, virtual,
chapters, groups,
chaptersIn, groupsIn,
slices, slices,
chapterCounts, groupCounts,
regionsForArea, regionsForArea,
areasLabelFor, areasLabelFor,
@ -130,10 +130,10 @@ export function useCommunity() {
}; };
}, [ }, [
rawRegions, rawRegions,
rawChapters, rawGroups,
regionsQuery.loading, regionsQuery.loading,
regionsQuery.error, regionsQuery.error,
chaptersQuery.loading, groupsQuery.loading,
chaptersQuery.error, groupsQuery.error,
]); ]);
} }

View file

@ -76,7 +76,7 @@ export type Link = {
export type OrgRef = { id: string; name: string; kind?: string | null } export type OrgRef = { id: string; name: string; kind?: string | null }
/* One host of an event. `kind` says which table the id is in; /* One host of an event. `kind` says which table the id is in;
`org_kind` is the region/chapter/partner split that decides an `org_kind` is the region/group/partner split that decides an
organization's route, and is null for a person. The triple is organization's route, and is null for a person. The triple is
exactly what refHref() in hrefs.ts takes. */ exactly what refHref() in hrefs.ts takes. */
export type EventHost = { export type EventHost = {
@ -207,7 +207,7 @@ export type RegionArea = {
export type OrganizationRecord = { export type OrganizationRecord = {
id: string id: string
kind: 'national' | 'region' | 'chapter' | 'partner' kind: 'national' | 'region' | 'group' | 'partner'
name: string name: string
short_name?: string | null short_name?: string | null
tagline?: string | null tagline?: string | null
@ -234,7 +234,7 @@ export type OrganizationRecord = {
scope?: RegionScope | null scope?: RegionScope | null
map_note?: string | null map_note?: string | null
areas?: RegionArea[] areas?: RegionArea[]
chapters?: Array<{ id: string; name: string; location_label?: string | null; logo?: string | null }> groups?: Array<{ id: string; name: string; location_label?: string | null; logo?: string | null }>
region_id?: string | null region_id?: string | null
region_name?: string | null region_name?: string | null
region_color?: string | null region_color?: string | null

View file

@ -6,7 +6,7 @@
const { data, error, loading } = useResource("/events"); const { data, error, loading } = useResource("/events");
Note the `ignore` flag rather than an AbortController: the Note the `ignore` flag rather than an AbortController: the
request is shared and cached, so cancelling it would throw away request is shared and cached, so canceling it would throw away
work another component may still want. We just stop writing work another component may still want. We just stop writing
state after unmount. state after unmount.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */

View file

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

View file

@ -27,7 +27,7 @@ export const PAGE_SECTIONS = {
], ],
"/community": [ "/community": [
{ label: "Community Blog", hash: "#blog" }, { label: "Community Blog", hash: "#blog" },
{ label: "Local Chapters", hash: "#chapters" }, { label: "Local Groups", hash: "#groups" },
{ label: "Unity Regions", hash: "#regions" }, { label: "Unity Regions", hash: "#regions" },
{ label: "Partner Organizations", hash: "#partners" }, { label: "Partner Organizations", hash: "#partners" },
], ],

View file

@ -170,7 +170,7 @@ function RecipientRow({ recipient, accent }: { recipient: Recipient; accent: str
/* awarded_on may be a partial date, so this takes the leading year /* awarded_on may be a partial date, so this takes the leading year
rather than parsing. A full date would be false precision on a rather than parsing. A full date would be false precision on a
row backfilled from a programme booklet. */ row backfilled from a program booklet. */
function year(date?: string | null): string | null { function year(date?: string | null): string | null {
if (!date) return null if (!date) return null
const match = /^(\d{4})/.exec(date) const match = /^(\d{4})/.exec(date)

View file

@ -15,7 +15,7 @@ const PAGE = sitePage("/community");
COMMUNITY PAGE COMMUNITY PAGE
The blog first, then two views of the organizations table. The The blog first, then two views of the organizations table. The
map is filtered to chapters; the vertical list is filtered to map is filtered to groups; the vertical list is filtered to
regions. Same rows, same endpoint, different shape on the page. regions. Same rows, same endpoint, different shape on the page.
The blog's heading and blurb are the admin's (Pages → Community blog The blog's heading and blurb are the admin's (Pages → Community blog
@ -27,21 +27,21 @@ const BLOG_DEFAULT_TITLE = "Community Blog";
const SECTIONS = [ const SECTIONS = [
{ {
id: "chapters", id: "groups",
title: "Local Chapters", title: "Local Groups",
blurb: blurb:
"Young adult groups meeting in person and online across the movement.", "Young adult groups meeting in person and online across the movement.",
accent: BRAND, accent: BRAND,
background: "var(--color-tint)", background: "var(--color-tint)",
Component: OrgListMap, Component: OrgListMap,
request: { type: "chapter", label: "Add or update a chapter" }, request: { type: "group", label: "Add or update a group" },
views: { options: ["map", "grid"], default: "map", Toggle: OrgMapToggle }, views: { options: ["map", "grid"], default: "map", Toggle: OrgMapToggle },
}, },
{ {
id: "regions", id: "regions",
title: "Unity Regions", title: "Unity Regions",
blurb: blurb:
"The regional organizations that support chapters and host their own gatherings.", "The regional organizations that support groups and host their own gatherings.",
accent: "#4a6b72", accent: "#4a6b72",
background: "var(--color-surface)", background: "var(--color-surface)",
Component: OrgListVertical, Component: OrgListVertical,

View file

@ -64,7 +64,7 @@ const ROLE_LABEL: Record<string, string> = {
const STATUS_LABEL: Record<string, string> = { const STATUS_LABEL: Record<string, string> = {
upcoming: 'Upcoming', upcoming: 'Upcoming',
past: 'Past', past: 'Past',
cancelled: 'Cancelled', cancelled: 'Canceled',
} }
export default function EventDetail() { export default function EventDetail() {
@ -131,7 +131,7 @@ export default function EventDetail() {
}, },
] ]
// A cancelled series has no next meeting, whatever its dates say. // A canceled series has no next meeting, whatever its dates say.
const upcoming = const upcoming =
event.status === 'cancelled' event.status === 'cancelled'
? [] ? []

View file

@ -1,12 +1,12 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
ORGANIZATION DETAIL ORGANIZATION DETAIL
/regions/:id /chapters/:id /partners/:id /organizations/:id /regions/:id /groups/:id /partners/:id /organizations/:id
One component behind four routes, because organizations are one One component behind four routes, because organizations are one
table. The kind decides which extras render, not which file runs. table. The kind decides which extras render, not which file runs.
The URL kind is decoration, the slug is what identifies the The URL kind is decoration, the slug is what identifies the
record, so a request for /chapters/great-lakes when that slug is record, so a request for /groups/great-lakes when that slug is
a region redirects to the canonical path rather than rendering a a region redirects to the canonical path rather than rendering a
correct page at a wrong address. correct page at a wrong address.
@ -56,7 +56,7 @@ export default function OrganizationDetail() {
) )
} }
// /chapters/x when x is a region: same record, wrong address. // /groups/x when x is a region: same record, wrong address.
// //
// useLocation, not window.location: the latter is outside the // useLocation, not window.location: the latter is outside the
// router's awareness, always "/" under HashRouter, and free to // router's awareness, always "/" under HashRouter, and free to
@ -64,7 +64,7 @@ export default function OrganizationDetail() {
// redirect loop rather than a one-shot correction. // redirect loop rather than a one-shot correction.
// //
// Guarded on org.id because a record with no id would redirect to // Guarded on org.id because a record with no id would redirect to
// /chapters/undefined, which is a worse page than the one we're // /groups/undefined, which is a worse page than the one we're
// already on. All four organization routes must be registered or // already on. All four organization routes must be registered or
// this redirects somewhere nothing matches. // this redirects somewhere nothing matches.
const canonical = org.id ? orgHref(org.id, org.kind) : null const canonical = org.id ? orgHref(org.id, org.kind) : null
@ -164,30 +164,30 @@ export default function OrganizationDetail() {
}) })
} }
if (org.kind === 'region' && (org.details.chapters?.length ?? 0) > 0) { if (org.kind === 'region' && (org.details.groups?.length ?? 0) > 0) {
sections.push({ sections.push({
id: 'chapters', id: 'groups',
title: 'Chapters', title: 'Groups',
blurb: org.details.map_note ?? undefined, blurb: org.details.map_note ?? undefined,
accent, accent,
background: 'var(--color-surface)', background: 'var(--color-surface)',
content: ( content: (
<div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3"> <div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
{(org.details.chapters ?? []).map((chapter) => ( {(org.details.groups ?? []).map((group) => (
<Link <Link
key={chapter.id} key={group.id}
to={orgHref(chapter.id, 'chapter')} to={orgHref(group.id, 'group')}
className="flex items-center gap-4 rounded-lg border p-4 transition-colors hover:bg-tint" className="flex items-center gap-4 rounded-lg border p-4 transition-colors hover:bg-tint"
style={{ borderColor: `${withAlpha(accent, 25)}` }} style={{ borderColor: `${withAlpha(accent, 25)}` }}
> >
<ChapterMark file={chapter.logo} name={chapter.name} accent={accent} /> <GroupMark file={group.logo} name={group.name} accent={accent} />
<span> <span>
<span className="block font-semibold" style={{ color: accentText(accent) }}> <span className="block font-semibold" style={{ color: accentText(accent) }}>
{chapter.name} {group.name}
</span> </span>
{chapter.location_label && ( {group.location_label && (
<span className="block text-sm" style={{ color: BODY }}> <span className="block text-sm" style={{ color: BODY }}>
{chapter.location_label} {group.location_label}
</span> </span>
)} )}
</span> </span>
@ -285,7 +285,7 @@ function Facts({
<span style={{ color: BODY }}>{org.details.scope}</span> <span style={{ color: BODY }}>{org.details.scope}</span>
)} )}
{org.kind === 'chapter' && org.details.region_id && ( {org.kind === 'group' && org.details.region_id && (
<span style={{ color: BODY }}> <span style={{ color: BODY }}>
Part of{' '} Part of{' '}
<Link <Link
@ -298,10 +298,10 @@ function Facts({
</span> </span>
)} )}
{org.kind === 'chapter' && org.details.meets && ( {org.kind === 'group' && org.details.meets && (
<span style={{ color: BODY }}>Meets {org.details.meets}</span> <span style={{ color: BODY }}>Meets {org.details.meets}</span>
)} )}
{org.kind === 'chapter' && org.details.started && ( {org.kind === 'group' && org.details.started && (
<span style={{ color: BODY }}>Since {org.details.started}</span> <span style={{ color: BODY }}>Since {org.details.started}</span>
)} )}
{org.is_online && <span style={{ color: BODY }}>Online</span>} {org.is_online && <span style={{ color: BODY }}>Online</span>}
@ -360,7 +360,7 @@ function Contact({ org, accent }: { org: OrganizationRecord; accent: string }) {
) )
} }
function ChapterMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) { function GroupMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) {
return ( return (
<Logo <Logo
src={mediaUrl(file)} src={mediaUrl(file)}

View file

@ -87,7 +87,7 @@ const PARTS: LegalPart[] = [
id: "how-we-use", id: "how-we-use",
heading: "How we use it", heading: "How we use it",
body: [ body: [
"To answer you, to run our retreats, chapters 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.", "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.",
], ],
}, },
{ {

View file

@ -20,7 +20,7 @@ const SECTIONS = [
id: 'make', id: 'make',
title: 'Make a QR code', title: 'Make a QR code',
blurb: 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 centre and the colours; a warning shows if the code might not scan.', '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, accent: BRAND,
background: 'var(--color-tint)', background: 'var(--color-tint)',
content: ( content: (

View file

@ -82,7 +82,7 @@ const SECTIONS = [
{ {
id: "local", id: "local",
title: "Local Events", title: "Local Events",
blurb: "Hosted by individual chapters.", blurb: "Hosted by individual groups.",
accent: ACCENTS.green, accent: ACCENTS.green,
background: "var(--color-surface)", background: "var(--color-surface)",
Component: EventListCards, Component: EventListCards,

View file

@ -159,7 +159,7 @@ function RequestFiles({ row, canWrite, canRemove }) {
); );
} }
/* A content request's details (049), labelled from requestTypes.ts; /* A content request's details (049), labeled from requestTypes.ts;
keys it no longer knows are shown as they are. */ keys it no longer knows are shown as they are. */
function RequestDetails({ row }) { function RequestDetails({ row }) {
const entries = Object.entries(row.details ?? {}); const entries = Object.entries(row.details ?? {});

View file

@ -10,6 +10,9 @@
One block per header group, in the same order: Data, Pages, One block per header group, in the same order: Data, Pages,
Forms, Tools, and Panel, which only exists for superadmins. Forms, Tools, and Panel, which only exists for superadmins.
It asks for the wide admin column (adminWidth.tsx), like the
editor, so the cards run three across on a wide screen.
The right-hand panel is deliberately inert. Nothing here The right-hand panel is deliberately inert. Nothing here
fetches, so the landing page can't be slow or half-broken on fetches, so the landing page can't be slow or half-broken on
arrival; anything live (open feedback count, last-edited arrival; anything live (open feedback count, last-edited
@ -19,6 +22,7 @@
import { ArrowRight, ArrowUpRight } from "@phosphor-icons/react"; import { ArrowRight, ArrowUpRight } from "@phosphor-icons/react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { useAuth } from "../../lib/auth.tsx"; import { useAuth } from "../../lib/auth.tsx";
import { useWideAdminPage } from "../../lib/adminWidth.tsx";
import { SITE_VERSION } from "../../lib/version.ts"; import { SITE_VERSION } from "../../lib/version.ts";
import { ROLE_LABELS, isSuper } from "../../lib/roles.ts"; import { ROLE_LABELS, isSuper } from "../../lib/roles.ts";
import { DATA_NAV, FORMS_NAV, PAGES_NAV, PANEL_NAV, TOOLS_NAV, target, visibleItems } from "./adminNav.ts"; import { DATA_NAV, FORMS_NAV, PAGES_NAV, PANEL_NAV, TOOLS_NAV, target, visibleItems } from "./adminNav.ts";
@ -81,7 +85,7 @@ function CardBlock({ title, blurb, children }) {
<h2 className="text-lg font-semibold text-link">{title}</h2> <h2 className="text-lg font-semibold text-link">{title}</h2>
{blurb && <p className="text-sm text-muted">{blurb}</p>} {blurb && <p className="text-sm text-muted">{blurb}</p>}
</div> </div>
<div className="mt-4 grid gap-4 sm:grid-cols-2">{children}</div> <div className="mt-4 grid gap-4 sm:grid-cols-2 xl:grid-cols-3">{children}</div>
</div> </div>
); );
} }
@ -111,6 +115,7 @@ const QUICK_ADD = [
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();
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">

View file

@ -181,7 +181,7 @@ export default function AdminLayout() {
</div> </div>
{/* Subnav. Only drawn where there is something to draw, so {/* Subnav. Only drawn where there is something to draw, so
Events and People don't get an empty grey strip. */} Events and People don't get an empty gray strip. */}
{subnav.length > 0 && ( {subnav.length > 0 && (
<div className="border-t border-brand/10 bg-tint-soft"> <div className="border-t border-brand/10 bg-tint-soft">
<div className="mx-auto flex max-w-5xl flex-wrap gap-6 px-6 py-2.5 text-sm"> <div className="mx-auto flex max-w-5xl flex-wrap gap-6 px-6 py-2.5 text-sm">

View file

@ -22,7 +22,7 @@ import { ApiError, get } from "../../lib/api.ts";
/* What a ?error= from the Google callback means, in the words the /* What a ?error= from the Google callback means, in the words the
person at the login page needs. */ person at the login page needs. */
const GOOGLE_ERRORS: Record<string, string> = { const GOOGLE_ERRORS: Record<string, string> = {
cancelled: "Google sign-in was cancelled.", canceled: "Google sign-in was canceled.",
expired: "That sign-in took too long or was already used. Try again.", expired: "That sign-in took too long or was already used. Try again.",
no_account: no_account:
"There's no admin account for that Google account. Ask a superadmin to add your email.", "There's no admin account for that Google account. Ask a superadmin to add your email.",

View file

@ -131,7 +131,7 @@ export default function EntityEdit() {
return `${slugify(parts.join(" "))}-`; return `${slugify(parts.join(" "))}-`;
}; };
// What to show greyed out before then: org_id becomes "org-". // What to show grayed out before then: org_id becomes "org-".
const prefixHint = qualifierPaths.length const prefixHint = qualifierPaths.length
? `${qualifierPaths.map((path) => path.replace(/_id$/, "")).join("-")}-` ? `${qualifierPaths.map((path) => path.replace(/_id$/, "")).join("-")}-`
: ""; : "";

View file

@ -3,7 +3,7 @@
One component for organizations, events and people. The :entity One component for organizations, events and people. The :entity
route param picks the manifest; nothing here knows what a route param picks the manifest; nothing here knows what a
chapter or a retreat is. group or a retreat is.
The "New X" link follows the same rule as EntityEdit's save The "New X" link follows the same rule as EntityEdit's save
button: atLeast(user, "editor"), matching requireRole("editor") button: atLeast(user, "editor"), matching requireRole("editor")

View file

@ -58,7 +58,7 @@ export const DATA_NAV = {
{ {
to: "/admin/organizations", to: "/admin/organizations",
label: "Organizations", label: "Organizations",
blurb: "The national organization, regions, chapters and partners.", blurb: "The national organization, regions, groups and partners.",
}, },
{ {
to: "/admin/teams", to: "/admin/teams",
@ -151,7 +151,7 @@ export const TOOLS_NAV = {
{ {
to: "/qr", to: "/qr",
label: "QR code generator", label: "QR code generator",
blurb: "Codes for flyers, slides and signs: any page or link, in your choice of colours.", blurb: "Codes for flyers, slides and signs: any page or link, in your choice of colors.",
}, },
], ],
}; };

View file

@ -576,7 +576,7 @@ function MonthGrid({ weeks, month, today, occurrences, selected, onSelect, accen
function Bar({ seg, accent }: { seg: Segment; accent: string }) { function Bar({ seg, accent }: { seg: Segment; accent: string }) {
const color = seg.event.color || accent const color = seg.event.color || accent
const cancelled = seg.event.status === 'cancelled' const canceled = seg.event.status === 'cancelled'
return ( return (
<Link <Link
@ -585,7 +585,7 @@ function Bar({ seg, accent }: { seg: Segment; accent: string }) {
className={`pointer-events-auto flex items-center gap-1 truncate px-2 text-xs font-semibold text-white transition-[filter] hover:brightness-110 ${ className={`pointer-events-auto flex items-center gap-1 truncate px-2 text-xs font-semibold text-white transition-[filter] hover:brightness-110 ${
seg.continuesBefore ? 'ml-0 rounded-l-none' : 'ml-1 rounded-l-md' seg.continuesBefore ? 'ml-0 rounded-l-none' : 'ml-1 rounded-l-md'
} ${seg.continuesAfter ? 'mr-0 rounded-r-none' : 'mr-1 rounded-r-md'} ${ } ${seg.continuesAfter ? 'mr-0 rounded-r-none' : 'mr-1 rounded-r-md'} ${
cancelled ? 'line-through opacity-60' : '' canceled ? 'line-through opacity-60' : ''
}`} }`}
style={{ style={{
gridColumn: `${seg.col + 1} / span ${seg.span}`, gridColumn: `${seg.col + 1} / span ${seg.span}`,
@ -711,7 +711,7 @@ function EventLine({ item, accent }: { item: Occurrence; accent: string }) {
const { event } = item const { event } = item
const color = event.color || accent const color = event.color || accent
const where = event.location_label || (event.is_online ? 'Online' : null) const where = event.location_label || (event.is_online ? 'Online' : null)
const cancelled = event.status === 'cancelled' const canceled = event.status === 'cancelled'
return ( return (
<Link <Link
@ -720,9 +720,9 @@ function EventLine({ item, accent }: { item: Occurrence; accent: string }) {
> >
<span className="mt-1.5 h-3 w-3 shrink-0 rounded-full" style={{ background: color }} aria-hidden="true" /> <span className="mt-1.5 h-3 w-3 shrink-0 rounded-full" style={{ background: color }} aria-hidden="true" />
<span className="min-w-0"> <span className="min-w-0">
<span className={`block font-semibold group-hover:underline ${cancelled ? 'line-through' : ''}`}> <span className={`block font-semibold group-hover:underline ${canceled ? 'line-through' : ''}`}>
{event.title} {event.title}
{cancelled && <span className="ml-2 text-xs font-bold uppercase text-danger no-underline">Cancelled</span>} {canceled && <span className="ml-2 text-xs font-bold uppercase text-danger no-underline">Canceled</span>}
</span> </span>
<span className="block text-sm" style={{ color: BODY }}> <span className="block text-sm" style={{ color: BODY }}>
{[ {[

View file

@ -36,7 +36,7 @@ import { accentText, withAlpha, readableOn, BRAND } from '../../lib/color.ts'
fires only for an event with no host at all. */ fires only for an event with no host at all. */
const DEFAULT_ORG_LOGO = null; const DEFAULT_ORG_LOGO = null;
const INK = "var(--color-ink)"; // button text: the card colour is only a border const INK = "var(--color-ink)"; // button text: the card color is only a border
const CARD_BG = "var(--color-surface)"; // sits under every card, photo or not const CARD_BG = "var(--color-surface)"; // sits under every card, photo or not
/* Laid over a card's background image so black text reads on any /* Laid over a card's background image so black text reads on any
@ -186,7 +186,7 @@ export function Card({
filter: past ? "saturate(0.75)" : "none", filter: past ? "saturate(0.75)" : "none",
pointerEvents: interactive ? "auto" : "none", pointerEvents: interactive ? "auto" : "none",
}} }}
// A card shown but not in play (a carousel neighbour, a collapsed // A card shown but not in play (a carousel neighbor, a collapsed
// past event) keeps its links out of the tab order too. // past event) keeps its links out of the tab order too.
inert={!interactive} inert={!interactive}
> >
@ -277,7 +277,7 @@ export function Card({
compact ? "gap-2" : "gap-3" compact ? "gap-2" : "gap-3"
} ${links.length === 0 ? "mt-4" : ""}`} } ${links.length === 0 ? "mt-4" : ""}`}
> >
{/* Button text takes the card's colour (the event's own, {/* Button text takes the card's color (the event's own,
or the band's default, teal unless the page sets one), or the band's default, teal unless the page sets one),
the same as the border, rather than the card's black. */} the same as the border, rather than the card's black. */}
{links.map(item => ( {links.map(item => (
@ -464,7 +464,7 @@ export default function EventListCards({
); );
/* Open on the first upcoming event. The list is empty on the /* Open on the first upcoming event. The list is empty on the
first render, so this can't be a useState initialiser, it has first render, so this can't be a useState initializer, it has
to wait for the data and then run once. Clearing the guard when to wait for the data and then run once. Clearing the guard when
the list empties means a refetch re-seeds. */ the list empties means a refetch re-seeds. */
const seeded = useRef(false); const seeded = useRef(false);

View file

@ -380,7 +380,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
</label> </label>
<p className="mt-1 text-sm" style={{ color: MUTED }}> <p className="mt-1 text-sm" style={{ color: MUTED }}>
{request {request
? "Say what you'd like: to see the information we hold about you, to correct it, or to have it deleted. Tell us how you've been in touch with NGU (a retreat, a chapter, this site) so we can find it." ? "Say what you'd like: to see the information we hold about you, to correct it, or to have it deleted. Tell us how you've been in touch with NGU (a retreat, a group, this site) so we can find it."
: "What you expected to happen, and what happened instead, is the most useful thing you can give us."} : "What you expected to happen, and what happened instead, is the most useful thing you can give us."}
</p> </p>
<textarea <textarea

View file

@ -15,9 +15,9 @@ import { scrollBehavior } from "../../lib/motion.ts";
Organizations placed on a tile grid: the map on the left, the Organizations placed on a tile grid: the map on the left, the
list on the right, selecting on either side filtering both. list on the right, selecting on either side filtering both.
Filtered to chapters, and unlike the other sections that isn't Filtered to groups, and unlike the other sections that isn't
a prop. A map only makes sense for organizations that sit a prop. A map only makes sense for organizations that sit
somewhere, and it reads regions off the same data to colour the somewhere, and it reads regions off the same data to color the
tiles, so "plot partners instead" isn't a filter change, it's a tiles, so "plot partners instead" isn't a filter change, it's a
different component. Named for the view rather than the filter different component. Named for the view rather than the filter
so that stays visible. so that stays visible.
@ -49,14 +49,14 @@ const INK = "var(--color-body)";
const FALLBACK_COLOR = "#4a6b72"; const FALLBACK_COLOR = "#4a6b72";
/* organizations.color is nullable; an SVG fill left undefined paints /* organizations.color is nullable; an SVG fill left undefined paints
black, so an uncoloured region takes the same fallback as a card. */ black, so an uncolored region takes the same fallback as a card. */
const colorOf = (item) => item.color || FALLBACK_COLOR; const colorOf = (item) => item.color || FALLBACK_COLOR;
const US_TITLE = "US Unity Regions"; const US_TITLE = "US Unity Regions";
const INTL_TITLE = "International Unity Regions"; const INTL_TITLE = "International Unity Regions";
/* ── Body content ────────────────────────────────────────────── /* ── Body content ──────────────────────────────────────────────
A chapter's description is ordered blocks rather than one A group's description is ordered blocks rather than one
string, so a heading or a list added later renders instead of string, so a heading or a list added later renders instead of
vanishing. When organization and person pages arrive this should vanishing. When organization and person pages arrive this should
move to a shared component; small enough to live here until then. move to a shared component; small enough to live here until then.
@ -184,7 +184,7 @@ function Tile({
> >
<title> <title>
{AREA_NAMES[code] || code}: {slices.map(s => s.name).join(" / ")} {AREA_NAMES[code] || code}: {slices.map(s => s.name).join(" / ")}
{count ? ` · ${count} chapter${count > 1 ? "s" : ""}` : ""} {count ? ` · ${count} group${count > 1 ? "s" : ""}` : ""}
</title> </title>
<clipPath id={clipId}> <clipPath id={clipId}>
@ -250,7 +250,7 @@ function Tile({
); );
} }
function RegionMap({ slices, chapterCounts, ...props }: any) { function RegionMap({ slices, groupCounts, ...props }: any) {
const size = TILE - PAD * 2; const size = TILE - PAD * 2;
return ( return (
@ -258,7 +258,7 @@ function RegionMap({ slices, chapterCounts, ...props }: any) {
viewBox={`0 0 ${COLS * TILE} ${ROWS * TILE}`} viewBox={`0 0 ${COLS * TILE} ${ROWS * TILE}`}
className="w-full h-auto" className="w-full h-auto"
role="group" role="group"
aria-label="Chapters by Unity region" aria-label="Groups by Unity region"
> >
{/* States and bands are the same shape, a tile with a span, {/* States and bands are the same shape, a tile with a span,
so this is one loop rather than two. */} so this is one loop rather than two. */}
@ -273,7 +273,7 @@ function RegionMap({ slices, chapterCounts, ...props }: any) {
width={area.span * TILE - PAD * 2} width={area.span * TILE - PAD * 2}
fontSize={area.isState ? 34 : 38} fontSize={area.isState ? 34 : 38}
slices={slices[area.code] ?? []} slices={slices[area.code] ?? []}
count={chapterCounts[area.code] ?? 0} count={groupCounts[area.code] ?? 0}
{...props} {...props}
/> />
))} ))}
@ -355,14 +355,14 @@ function Legend({ domestic, international, onMapIds, ...props }: any) {
function RegionBlock({ function RegionBlock({
region, region,
chapters, groups,
subtext, subtext,
selected, selected,
setSelected, setSelected,
setHovered, setHovered,
indent, indent,
regionRefs, regionRefs,
chapterRefs, groupRefs,
}) { }) {
const on = selected === region.id; const on = selected === region.id;
@ -388,7 +388,7 @@ function RegionBlock({
/> />
{region.name} {region.name}
<span className="text-sm font-normal ml-auto" style={{ color: MUTED }}> <span className="text-sm font-normal ml-auto" style={{ color: MUTED }}>
{chapters.length || "-"} {groups.length || "-"}
</span> </span>
</button> </button>
</h4> </h4>
@ -399,16 +399,16 @@ function RegionBlock({
</p> </p>
)} )}
{chapters.length === 0 ? ( {groups.length === 0 ? (
<p className="text-sm ml-5 mb-4" style={{ color: MUTED }}> <p className="text-sm ml-5 mb-4" style={{ color: MUTED }}>
No chapters yet. Interested in starting one? No groups yet. Interested in starting one?
</p> </p>
) : ( ) : (
<ul className="ml-5 mb-4 flex flex-col gap-3"> <ul className="ml-5 mb-4 flex flex-col gap-3">
{chapters.map(c => ( {groups.map(c => (
<li <li
key={c.id} key={c.id}
ref={el => chapterRefs && (chapterRefs.current[c.id] = el)} ref={el => groupRefs && (groupRefs.current[c.id] = el)}
className="pl-3 flex items-start gap-3" className="pl-3 flex items-start gap-3"
style={{ borderLeft: `2px solid ${colorOf(region)}` }} style={{ borderLeft: `2px solid ${colorOf(region)}` }}
> >
@ -447,7 +447,7 @@ function RegionBlock({
{orgPath(c) && ( {orgPath(c) && (
<ArrowLink <ArrowLink
to={orgPath(c)} to={orgPath(c)}
label={`${c.name}: chapter page`} label={`${c.name}: group page`}
color={colorOf(region)} color={colorOf(region)}
size="h-8 w-8" size="h-8 w-8"
/> />
@ -467,7 +467,7 @@ function RegionBlock({
color. Selecting another card swaps the panel's contents. color. Selecting another card swaps the panel's contents.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
function ChapterCard({ chapter, color, open, onOpen }) { function GroupCard({ group, color, open, onOpen }) {
return ( return (
<div <div
className="rounded-2xl p-4 flex items-start gap-4 transition-all duration-200" className="rounded-2xl p-4 flex items-start gap-4 transition-all duration-200"
@ -476,29 +476,29 @@ function ChapterCard({ chapter, color, open, onOpen }) {
background: open ? `${withAlpha(color, 8)}` : "transparent", background: open ? `${withAlpha(color, 8)}` : "transparent",
}} }}
> >
<OrgLogo org={chapter} color={color} /> <OrgLogo org={group} color={color} />
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
<p className="font-bold leading-tight">{chapter.name}</p> <p className="font-bold leading-tight">{group.name}</p>
<p className="text-sm" style={{ color: FALLBACK_COLOR }}> <p className="text-sm" style={{ color: FALLBACK_COLOR }}>
{chapter.location_label} {group.location_label}
</p> </p>
{chapter.meets && ( {group.meets && (
<p className="text-sm" style={{ color: MUTED }}> <p className="text-sm" style={{ color: MUTED }}>
{chapter.meets} {group.meets}
</p> </p>
)} )}
</div> </div>
{/* Two controls, two destinations: the chevron opens the {/* Two controls, two destinations: the chevron opens the
detail panel in place, the arrow leaves for the chapter's detail panel in place, the arrow leaves for the group's
own page. Keeping them distinct beats one control that own page. Keeping them distinct beats one control that
does different things depending on where you click. */} does different things depending on where you click. */}
<div className="shrink-0 flex items-center gap-2"> <div className="shrink-0 flex items-center gap-2">
<button <button
onClick={onOpen} onClick={onOpen}
aria-expanded={open} aria-expanded={open}
aria-label={`${open ? "Hide" : "View"} details for ${chapter.name}`} aria-label={`${open ? "Hide" : "View"} details for ${group.name}`}
className="h-9 w-9 rounded-full flex items-center justify-center transition-transform duration-200 hover:scale-110" className="h-9 w-9 rounded-full flex items-center justify-center transition-transform duration-200 hover:scale-110"
style={{ style={{
border: `1px solid ${color}`, border: `1px solid ${color}`,
@ -509,10 +509,10 @@ function ChapterCard({ chapter, color, open, onOpen }) {
<CaretRight className="h-4 w-4" weight="bold" aria-hidden="true" /> <CaretRight className="h-4 w-4" weight="bold" aria-hidden="true" />
</button> </button>
{orgPath(chapter) && ( {orgPath(group) && (
<ArrowLink <ArrowLink
to={orgPath(chapter)} to={orgPath(group)}
label={`${chapter.name}: chapter page`} label={`${group.name}: group page`}
color={color} color={color}
/> />
)} )}
@ -521,10 +521,10 @@ function ChapterCard({ chapter, color, open, onOpen }) {
); );
} }
function ChapterDetail({ chapter, region, onClose }) { function GroupDetail({ group, region, onClose }) {
/* "Led by" comes from affiliations rather than a text field, so /* "Led by" comes from affiliations rather than a text field, so
it lists real people and stays empty until they exist. */ it lists real people and stays empty until they exist. */
const leads = (chapter.leadership ?? []) const leads = (group.leadership ?? [])
.map(person => .map(person =>
person.title ? `${person.display_name} (${person.title})` : person.display_name person.title ? `${person.display_name} (${person.title})` : person.display_name
) )
@ -532,10 +532,10 @@ function ChapterDetail({ chapter, region, onClose }) {
const rows = [ const rows = [
["Region", region.name], ["Region", region.name],
["Where", chapter.venue], ["Where", group.venue],
["Meets", chapter.meets], ["Meets", group.meets],
["Led by", leads], ["Led by", leads],
["Since", chapter.started], ["Since", group.started],
].filter(([, v]) => v); ].filter(([, v]) => v);
return ( return (
@ -544,11 +544,11 @@ function ChapterDetail({ chapter, region, onClose }) {
style={{ border: `2px solid ${colorOf(region)}`, background: `${withAlpha(colorOf(region), 6)}` }} style={{ border: `2px solid ${colorOf(region)}`, background: `${withAlpha(colorOf(region), 6)}` }}
> >
<div className="flex items-start gap-4"> <div className="flex items-start gap-4">
<OrgLogo org={chapter} color={colorOf(region)} size="h-20 w-20" /> <OrgLogo org={group} color={colorOf(region)} size="h-20 w-20" />
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
<p className="text-2xl font-extrabold leading-tight">{chapter.name}</p> <p className="text-2xl font-extrabold leading-tight">{group.name}</p>
<p style={{ color: FALLBACK_COLOR }}>{chapter.location_label}</p> <p style={{ color: FALLBACK_COLOR }}>{group.location_label}</p>
</div> </div>
<button <button
@ -561,7 +561,7 @@ function ChapterDetail({ chapter, region, onClose }) {
</button> </button>
</div> </div>
<Blocks blocks={chapter.blocks} color={colorOf(region)} /> <Blocks blocks={group.blocks} color={colorOf(region)} />
{rows.length > 0 && ( {rows.length > 0 && (
<dl className="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1 text-sm"> <dl className="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1 text-sm">
@ -579,18 +579,18 @@ function ChapterDetail({ chapter, region, onClose }) {
)} )}
<div className="mt-5 flex flex-wrap gap-3"> <div className="mt-5 flex flex-wrap gap-3">
{orgPath(chapter) && ( {orgPath(group) && (
<Link <Link
to={orgPath(chapter)!} to={orgPath(group)!}
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105" className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
style={{ background: colorOf(region), color: readableOn(colorOf(region)) }} style={{ background: colorOf(region), color: readableOn(colorOf(region)) }}
> >
Chapter page Group page
</Link> </Link>
)} )}
{chapter.website && ( {group.website && (
<a <a
href={chapter.website} href={group.website}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105" className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
@ -600,9 +600,9 @@ function ChapterDetail({ chapter, region, onClose }) {
</a> </a>
)} )}
{chapter.email && ( {group.email && (
<a <a
href={`mailto:${chapter.email}`} href={`mailto:${group.email}`}
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105" className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
style={{ border: `1px solid ${colorOf(region)}`, color: colorOf(region) }} style={{ border: `1px solid ${colorOf(region)}`, color: colorOf(region) }}
> >
@ -614,13 +614,13 @@ function ChapterDetail({ chapter, region, onClose }) {
); );
} }
function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpenId }) { function GroupGrid({ regions, groups, groupsIn, subtextFor, openId, setOpenId }) {
// Only regions that actually have chapters get a grid. // Only regions that actually have groups get a grid.
const populated = regions const populated = regions
.map(region => ({ region, list: chaptersIn(region.id) })) .map(region => ({ region, list: groupsIn(region.id) }))
.filter(({ list }) => list.length > 0); .filter(({ list }) => list.length > 0);
const empty = regions.filter(region => chaptersIn(region.id).length === 0); const empty = regions.filter(region => groupsIn(region.id).length === 0);
const openChapter = chapters.find(c => c.id === openId) || null; const openGroup = groups.find(c => c.id === openId) || null;
return ( return (
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: CONTENT_MAX }}> <div className="mx-auto px-8 md:px-12" style={{ maxWidth: CONTENT_MAX }}>
@ -647,10 +647,10 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
)} )}
{/* Detail panel sits above this region's grid, and only {/* Detail panel sits above this region's grid, and only
when the open chapter belongs to this region. */} when the open group belongs to this region. */}
{openChapter && openChapter.region_id === region.id && ( {openGroup && openGroup.region_id === region.id && (
<ChapterDetail <GroupDetail
chapter={openChapter} group={openGroup}
region={region} region={region}
onClose={() => setOpenId(null)} onClose={() => setOpenId(null)}
/> />
@ -663,9 +663,9 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
}} }}
> >
{list.map(c => ( {list.map(c => (
<ChapterCard <GroupCard
key={c.id} key={c.id}
chapter={c} group={c}
color={colorOf(region)} color={colorOf(region)}
open={openId === c.id} open={openId === c.id}
onOpen={() => setOpenId(openId === c.id ? null : c.id)} onOpen={() => setOpenId(openId === c.id ? null : c.id)}
@ -678,7 +678,7 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
{empty.length > 0 && ( {empty.length > 0 && (
<p className="text-sm" style={{ color: MUTED }}> <p className="text-sm" style={{ color: MUTED }}>
No chapters yet in {empty.map(r => r.name).join(", ")}. Interested in No groups yet in {empty.map(r => r.name).join(", ")}. Interested in
starting one? starting one?
</p> </p>
)} )}
@ -698,7 +698,7 @@ export function OrgMapToggle({ view, setView, accent }) {
className="inline-flex rounded-xl overflow-hidden shrink-0" className="inline-flex rounded-xl overflow-hidden shrink-0"
style={{ border: `1px solid ${accent}` }} style={{ border: `1px solid ${accent}` }}
role="group" role="group"
aria-label="Change how chapters are displayed" aria-label="Change how groups are displayed"
> >
{[ {[
["map", "Map"], ["map", "Map"],
@ -727,10 +727,10 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
domestic, domestic,
international, international,
virtual, virtual,
chapters, groups,
chaptersIn, groupsIn,
slices, slices,
chapterCounts, groupCounts,
regionsForArea, regionsForArea,
subtextFor, subtextFor,
} = useCommunity(); } = useCommunity();
@ -742,7 +742,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
// The list scrolls itself to whatever the map or legend points at. // The list scrolls itself to whatever the map or legend points at.
const listRef = useRef<any>(null); const listRef = useRef<any>(null);
const regionRefs = useRef<any>({}); const regionRefs = useRef<any>({});
const chapterRefs = useRef<any>({}); const groupRefs = useRef<any>({});
// Where the latest hover came from. The list follows the map and // Where the latest hover came from. The list follows the map and
// the legend, but hovering the list itself must not move it: the // the legend, but hovering the list itself must not move it: the
@ -776,12 +776,12 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
if (id) scrollListTo(regionRefs.current[id]); if (id) scrollListTo(regionRefs.current[id]);
}, [hovered, selected]); }, [hovered, selected]);
// Clicking a tile jumps to its first chapter when it has one, // Clicking a tile jumps to its first group when it has one,
// otherwise to the region it belongs to. // otherwise to the region it belongs to.
const pickArea = code => { const pickArea = code => {
const chapter = chapters.find(c => c.area_code === code); const group = groups.find(c => c.area_code === code);
if (chapter && chapterRefs.current[chapter.id]) { if (group && groupRefs.current[group.id]) {
return scrollListTo(chapterRefs.current[chapter.id]); return scrollListTo(groupRefs.current[group.id]);
} }
const region = regionsForArea(code)[0]; const region = regionsForArea(code)[0];
if (region) scrollListTo(regionRefs.current[region.id]); if (region) scrollListTo(regionRefs.current[region.id]);
@ -795,24 +795,24 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
if (loading && regions.length === 0) { if (loading && regions.length === 0) {
return shell( return shell(
<div className="skeleton" role="status" aria-label="Loading chapters" /> <div className="skeleton" role="status" aria-label="Loading groups" />
); );
} }
if (error && regions.length === 0) { if (error && regions.length === 0) {
return shell( return shell(
<p className="font-semibold" style={{ color: accentText(accent) }}> <p className="font-semibold" style={{ color: accentText(accent) }}>
· Chapters couldn't be loaded just now, please try again shortly · · Groups couldn't be loaded just now, please try again shortly ·
</p> </p>
); );
} }
if (view === "grid") { if (view === "grid") {
return ( return (
<ChapterGrid <GroupGrid
regions={regions} regions={regions}
chapters={chapters} groups={groups}
chaptersIn={chaptersIn} groupsIn={groupsIn}
subtextFor={subtextFor} subtextFor={subtextFor}
openId={openId} openId={openId}
setOpenId={setOpenId} setOpenId={setOpenId}
@ -827,11 +827,11 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
<RegionBlock <RegionBlock
key={region.id} key={region.id}
region={region} region={region}
chapters={chaptersIn(region.id)} groups={groupsIn(region.id)}
subtext={subtextFor(region)} subtext={subtextFor(region)}
indent={indent} indent={indent}
regionRefs={regionRefs} regionRefs={regionRefs}
chapterRefs={chapterRefs} groupRefs={groupRefs}
{...shared} {...shared}
setHovered={hoverInList} setHovered={hoverInList}
/> />
@ -847,7 +847,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
<div> <div>
<RegionMap <RegionMap
slices={slices} slices={slices}
chapterCounts={chapterCounts} groupCounts={groupCounts}
onPick={pickArea} onPick={pickArea}
{...shared} {...shared}
/> />
@ -858,7 +858,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
{...shared} {...shared}
/> />
<p className="text-sm mt-4" style={{ color: MUTED }}> <p className="text-sm mt-4" style={{ color: MUTED }}>
A filled tile means a chapter meets there; a two-tone tile is a A filled tile means a group meets there; a two-tone tile is a
state shared by two Unity regions. Select a region to filter the state shared by two Unity regions. Select a region to filter the
list. list.
</p> </p>

View file

@ -19,10 +19,10 @@ import { accentText } from '../../lib/color.ts'
A stack of organizations, each collapsed to a line and A stack of organizations, each collapsed to a line and
expandable for the rest. Every row carries two ways out: an expandable for the rest. Every row carries two ways out: an
arrow through to that organization's page on this site, and a arrow through to that organization's page on this site, and a
labelled button out to its own site when it has one. labeled button out to its own site when it has one.
Nothing here is region-specific. It asks for a kind and renders Nothing here is region-specific. It asks for a kind and renders
what comes back, so the same section lists partners or chapters what comes back, so the same section lists partners or groups
by changing one prop: by changing one prop:
<OrgListVertical kind="partner" title="Our Partners" /> <OrgListVertical kind="partner" title="Our Partners" />
@ -36,7 +36,7 @@ import { accentText } from '../../lib/color.ts'
groupBy={org => org.details?.scope} groupBy={org => org.details?.scope}
/> />
Kind-specific extras (the areas a region covers, the chapters Kind-specific extras (the areas a region covers, the groups
inside it) come from `details` and render only when present, so inside it) come from `details` and render only when present, so
a partner row simply doesn't have them. a partner row simply doesn't have them.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
@ -88,7 +88,7 @@ function OrgRow({ org, pageLabel, siteLabel }) {
// Region extras. Absent for every other kind, and the JSX below // Region extras. Absent for every other kind, and the JSX below
// skips them rather than rendering empty headings. // skips them rather than rendering empty headings.
const areas = areasSentence(org.details?.areas ?? []); const areas = areasSentence(org.details?.areas ?? []);
const chapterCount = (org.details?.chapters ?? []).length; const groupCount = (org.details?.groups ?? []).length;
const note = org.details?.map_note; const note = org.details?.map_note;
/* Collapsed, a row says who it is and nothing else, the areas /* Collapsed, a row says who it is and nothing else, the areas
@ -124,13 +124,13 @@ function OrgRow({ org, pageLabel, siteLabel }) {
)} )}
</span> </span>
{chapterCount > 0 && ( {groupCount > 0 && (
<span <span
className="ml-auto text-sm shrink-0" className="ml-auto text-sm shrink-0"
style={{ color: MUTED }} style={{ color: MUTED }}
title={`${chapterCount} chapter${chapterCount > 1 ? "s" : ""}`} title={`${groupCount} group${groupCount > 1 ? "s" : ""}`}
> >
{chapterCount} {groupCount}
</span> </span>
)} )}
</button> </button>

View file

@ -8,10 +8,10 @@
Which the page or record itself Which the page or record itself
Section for a main page with a subnav, optionally one of Section for a main page with a subnav, optionally one of
its #sections its #sections
Centre nothing, the NGU dove, or any SVG in Center nothing, the NGU dove, or any SVG in
src/assets/qr (drop a file there and it's offered; src/assets/qr (drop a file there and it's offered;
it's embedded in the code, so downloads carry it) it's embedded in the code, so downloads carry it)
Colours the code, its background, and the dove. A warning Colors the code, its background, and the dove. A warning
appears when the pair is unlikely to scan: too appears when the pair is unlikely to scan: too
little contrast, or a light code on a dark ground little contrast, or a light code on a dark ground
@ -27,13 +27,13 @@
Codes point at SITE_ORIGIN, never at wherever this page is open, Codes point at SITE_ORIGIN, never at wherever this page is open,
so one made on localhost still works on a poster. so one made on localhost still works on a poster.
Downloads are the on-screen <svg> itself: serialised for the SVG, Downloads are the on-screen <svg> itself: serialized for the SVG,
drawn onto a canvas for the PNG. Neither needs a server. drawn onto a canvas for the PNG. Neither needs a server.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react' import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import QrCode, { QR_DOVE, QR_INK, QR_PAPER, type QrCentre } from '../../components/QrCode.tsx' import QrCode, { QR_DOVE, QR_INK, QR_PAPER, type QrCenter } from '../../components/QrCode.tsx'
import { NAV_ACTIONS, PAGE_LINKS, PAGE_SECTIONS } from '../../navConfig.ts' import { NAV_ACTIONS, PAGE_LINKS, PAGE_SECTIONS } from '../../navConfig.ts'
import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts' import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts'
import { siteUrl } from '../../lib/site.ts' import { siteUrl } from '../../lib/site.ts'
@ -59,31 +59,31 @@ const KINDS: Array<[Kind, string]> = [
['custom', 'A link I type'], ['custom', 'A link I type'],
] ]
/* The centres on offer: the dove, then every SVG in src/assets/qr, /* The centers on offer: the dove, then every SVG in src/assets/qr,
named after its file ("ngu-circle.svg" → "Ngu circle"). Read as named after its file ("ngu-circle.svg" → "Ngu circle"). Read as
text and turned into data: URLs so they sit inside the code's own text and turned into data: URLs so they sit inside the code's own
SVG. */ SVG. */
const CENTRE_FILES = import.meta.glob<string>('../../assets/qr/*.svg', { const CENTER_FILES = import.meta.glob<string>('../../assets/qr/*.svg', {
eager: true, eager: true,
query: '?raw', query: '?raw',
import: 'default', import: 'default',
}) })
type CentreOption = { id: string; label: string; centre: (dove: string) => QrCentre } type CenterOption = { id: string; label: string; center: (dove: string) => QrCenter }
const toDataUrl = (svg: string) => const toDataUrl = (svg: string) =>
`data:image/svg+xml;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(svg)))}` `data:image/svg+xml;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(svg)))}`
const CENTRES: CentreOption[] = [ const CENTERS: CenterOption[] = [
{ id: 'none', label: 'Nothing', centre: () => null }, { id: 'none', label: 'Nothing', center: () => null },
{ id: 'dove', label: 'NGU dove', centre: (color) => ({ kind: 'dove', color }) }, { id: 'dove', label: 'NGU dove', center: (color) => ({ kind: 'dove', color }) },
...Object.entries(CENTRE_FILES) ...Object.entries(CENTER_FILES)
.sort(([a], [b]) => a.localeCompare(b)) .sort(([a], [b]) => a.localeCompare(b))
.map(([path, svg]) => { .map(([path, svg]) => {
const name = path.split('/').pop()!.replace(/\.svg$/i, '') const name = path.split('/').pop()!.replace(/\.svg$/i, '')
const label = name.replace(/[-_]+/g, ' ').replace(/^./, (c) => c.toUpperCase()) const label = name.replace(/[-_]+/g, ' ').replace(/^./, (c) => c.toUpperCase())
const src = toDataUrl(svg) const src = toDataUrl(svg)
return { id: `file:${name}`, label, centre: () => ({ kind: 'image', src }) as QrCentre } return { id: `file:${name}`, label, center: () => ({ kind: 'image', src }) as QrCenter }
}), }),
] ]
@ -135,7 +135,7 @@ function typedUrl(raw: string): string | null {
const ORG_GROUPS: Array<[string, string]> = [ const ORG_GROUPS: Array<[string, string]> = [
['national', 'NGU'], ['national', 'NGU'],
['region', 'Regions'], ['region', 'Regions'],
['chapter', 'Chapters'], ['group', 'Groups'],
['partner', 'Partner organizations'], ['partner', 'Partner organizations'],
] ]
@ -258,7 +258,7 @@ export default function QrCodeMaker() {
const [path, setPath] = useState('/') const [path, setPath] = useState('/')
const [section, setSection] = useState('') const [section, setSection] = useState('')
const [custom, setCustom] = useState('') const [custom, setCustom] = useState('')
const [centreId, setCentreId] = useState('dove') const [centerId, setCenterId] = useState('dove')
const [ink, setInk] = useState(QR_INK) const [ink, setInk] = useState(QR_INK)
const [paper, setPaper] = useState(QR_PAPER) const [paper, setPaper] = useState(QR_PAPER)
const [doveColor, setDoveColor] = useState(QR_DOVE) const [doveColor, setDoveColor] = useState(QR_DOVE)
@ -283,8 +283,8 @@ export default function QrCodeMaker() {
const target = kind === 'custom' ? typed : selected ? `${selected.path}${section}` : null const target = kind === 'custom' ? typed : selected ? `${selected.path}${section}` : null
const url = kind === 'custom' ? typed : target ? siteUrl(target) : null const url = kind === 'custom' ? typed : target ? siteUrl(target) : null
const centreOption = CENTRES.find((c) => c.id === centreId) ?? CENTRES[0] const centerOption = CENTERS.find((c) => c.id === centerId) ?? CENTERS[0]
const centre = centreOption.centre(doveColor) const center = centerOption.center(doveColor)
const warning = scanWarning(ink, paper) const warning = scanWarning(ink, paper)
useEffect(() => setCopied(false), [url]) useEffect(() => setCopied(false), [url])
@ -381,8 +381,8 @@ export default function QrCodeMaker() {
</Select> </Select>
)} )}
<Select id="qr-centre" label="In the centre" value={centreId} onChange={setCentreId}> <Select id="qr-center" label="In the center" value={centerId} onChange={setCenterId}>
{CENTRES.map((c) => ( {CENTERS.map((c) => (
<option key={c.id} value={c.id}> <option key={c.id} value={c.id}>
{c.label} {c.label}
</option> </option>
@ -390,12 +390,12 @@ export default function QrCodeMaker() {
</Select> </Select>
<fieldset> <fieldset>
<legend className="text-sm font-medium text-body">Colours</legend> <legend className="text-sm font-medium text-body">Colors</legend>
<div className="mt-2 flex flex-wrap items-end gap-5"> <div className="mt-2 flex flex-wrap items-end gap-5">
<ColourInput id="qr-ink" label="Code" value={ink} onChange={setInk} /> <ColorInput id="qr-ink" label="Code" value={ink} onChange={setInk} />
<ColourInput id="qr-paper" label="Background" value={paper} onChange={setPaper} /> <ColorInput id="qr-paper" label="Background" value={paper} onChange={setPaper} />
{centreOption.id === 'dove' && ( {centerOption.id === 'dove' && (
<ColourInput id="qr-dove" label="Dove" value={doveColor} onChange={setDoveColor} /> <ColorInput id="qr-dove" label="Dove" value={doveColor} onChange={setDoveColor} />
)} )}
{(ink !== QR_INK || paper !== QR_PAPER || doveColor !== QR_DOVE) && ( {(ink !== QR_INK || paper !== QR_PAPER || doveColor !== QR_DOVE) && (
<button <button
@ -408,7 +408,7 @@ export default function QrCodeMaker() {
className="pb-2 text-sm underline" className="pb-2 text-sm underline"
style={{ color: accentText(BRAND) }} style={{ color: accentText(BRAND) }}
> >
Reset colours Reset colors
</button> </button>
)} )}
</div> </div>
@ -446,7 +446,7 @@ export default function QrCodeMaker() {
<QrCode <QrCode
ref={svgRef} ref={svgRef}
value={url} value={url}
centre={centre} center={center}
ink={ink} ink={ink}
paper={paper} paper={paper}
label={`QR code for ${url}`} label={`QR code for ${url}`}
@ -490,8 +490,8 @@ const inputClass =
'w-full rounded-xl border border-muted/50 bg-surface px-4 py-3 text-body ' + 'w-full rounded-xl border border-muted/50 bg-surface px-4 py-3 text-body ' +
'outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25' 'outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25'
/* A colour well with its hex beside it, both editable. */ /* A color well with its hex beside it, both editable. */
function ColourInput({ function ColorInput({
id, id,
label, label,
value, value,
@ -519,7 +519,7 @@ function ColourInput({
/> />
<input <input
type="text" type="text"
aria-label={`${label} colour, as hex`} aria-label={`${label} color, as hex`}
value={text} value={text}
onChange={(e) => { onChange={(e) => {
setText(e.target.value) setText(e.target.value)

View file

@ -3,10 +3,10 @@
Posts to /api/requests (server/src/routes/requests.js), as a form Posts to /api/requests (server/src/routes/requests.js), as a form
so files can go with it. What can be asked for is REQUEST_TYPES; so files can go with it. What can be asked for is REQUEST_TYPES;
?type=chapter in the address picks one to start with, which is how ?type=group in the address picks one to start with, which is how
the site's "Request" buttons open it. the site's "Request" buttons open it.
Each type's details (its `fields` in requestTypes.ts: a chapter's Each type's details (its `fields` in requestTypes.ts: a group's
city and meeting time, an event's dates) go as one JSON field; the city and meeting time, an event's dates) go as one JSON field; the
admin opens the record's editor filled in from them. admin opens the record's editor filled in from them.

View file

@ -6,8 +6,8 @@
Backdrop, what fills the background: Backdrop, what fills the background:
brand drifting colour and slow concentric rings (many brand drifting color and slow concentric rings (many
circles, one centre) with the dove at that centre circles, one center) with the dove at that center
photos the hero photos, crossfading with a slow zoom, a photos the hero photos, crossfading with a slow zoom, a
progress bar per photo and a pause button (anything progress bar per photo and a pause button (anything
that moves on its own for more than five seconds that moves on its own for more than five seconds
@ -222,7 +222,7 @@ function BrandBackdrop() {
</radialGradient> </radialGradient>
</defs> </defs>
{/* The rings are faint; the dove at their centre is not, so {/* The rings are faint; the dove at their center is not, so
the opacity sits on the rings rather than the whole SVG. */} the opacity sits on the rings rather than the whole SVG. */}
<g opacity="0.16"> <g opacity="0.16">
<g className="hp-rings" fill="none" stroke="#ffffff"> <g className="hp-rings" fill="none" stroke="#ffffff">
@ -239,7 +239,7 @@ function BrandBackdrop() {
</g> </g>
{/* Outside the rotating groups, so it stays upright while the {/* Outside the rotating groups, so it stays upright while the
rings turn around it. 64 × 42.7 at the centre fits inside rings turn around it. 64 × 42.7 at the center fits inside
the innermost ring (r 40) with room to float. */} the innermost ring (r 40) with room to float. */}
<circle cx="200" cy="200" r="46" fill="url(#hp-dove-glow)" /> <circle cx="200" cy="200" r="46" fill="url(#hp-dove-glow)" />
<g className="hp-dove" style={{ color: '#ffffff' }} opacity="0.9"> <g className="hp-dove" style={{ color: '#ffffff' }} opacity="0.9">
@ -451,7 +451,7 @@ 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 background photo (or its
colour), then what, when and where, then its buttons and a way color), then what, when and where, then its buttons and a way
to its page. The first action link is the filled button, since to its page. The first action link is the filled button, since
it's usually Register. */ it's usually Register. */
function EventPanel({ event }: { event: HeroEvent }) { function EventPanel({ event }: { event: HeroEvent }) {

View file

@ -29,7 +29,7 @@ type PathfinderProps = {
paths: FrontPagePath[] paths: FrontPagePath[]
} }
/* One accent per position, cycling. Paths are data; colour is /* One accent per position, cycling. Paths are data; color is
presentation, so it's assigned here rather than stored. */ presentation, so it's assigned here rather than stored. */
/* A path's icon: a key from src/data/pathIcons.ts, drawn from /* A path's icon: a key from src/data/pathIcons.ts, drawn from
Phosphor. A path saved before the list existed may hold an emoji; Phosphor. A path saved before the list existed may hold an emoji;

View file

@ -33,7 +33,7 @@
to { transform: translate(-10%, -15%) scale(1.2); } to { transform: translate(-10%, -15%) scale(1.2); }
} }
/* Concentric rings: many circles, one centre. */ /* Concentric rings: many circles, one center. */
.hp-rings { .hp-rings {
animation: hp-spin 90s linear infinite; animation: hp-spin 90s linear infinite;
transform-origin: 50% 50%; transform-origin: 50% 50%;
@ -44,7 +44,7 @@
to { transform: rotate(360deg); } to { transform: rotate(360deg); }
} }
/* The dove at the rings' centre bobs gently rather than turning. */ /* The dove at the rings' center bobs gently rather than turning. */
.hp-dove { .hp-dove {
animation: hp-bob 6s ease-in-out infinite; animation: hp-bob 6s ease-in-out infinite;
transform-box: fill-box; transform-box: fill-box;

View file

@ -203,7 +203,7 @@ function siteConfigurationPlugin(config: SiteConfiguration): Plugin {
} }
} }
/* The colour tokens exist twice: as data in server/src/themeDefaults.js /* The color tokens exist twice: as data in server/src/themeDefaults.js
(the admin's defaults, the contrast check) and as CSS in (the admin's defaults, the contrast check) and as CSS in
src/index.css (what pages draw with). This stops the build, and the src/index.css (what pages draw with). This stops the build, and the
dev server, when the two disagree, naming each difference. */ dev server, when the two disagree, naming each difference. */
@ -231,7 +231,7 @@ function themeDefaultsCheck(): Plugin {
} }
if (problems.length) { if (problems.length) {
this.error( this.error(
`Colour tokens disagree between src/index.css and server/src/themeDefaults.js:\n ${problems.join('\n ')}`, `Color tokens disagree between src/index.css and server/src/themeDefaults.js:\n ${problems.join('\n ')}`,
) )
} }
}, },