diff --git a/CLAUDE.md b/CLAUDE.md index f6beba4..cca8458 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co # 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 - 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 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/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. @@ -70,7 +70,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu - **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. - **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`. -- **Icons are Phosphor** (`@phosphor-icons/react`), weight `bold` (or `fill` for play/star). No hand-drawn `` 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 `` 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. - **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`. diff --git a/docs/google-drive-and-mail.md b/docs/google-drive-and-mail.md index 2789404..d3a53bf 100644 --- a/docs/google-drive-and-mail.md +++ b/docs/google-drive-and-mail.md @@ -60,7 +60,7 @@ hand. | Folder | Used by | Set in | | --- | --- | --- | -| `Requests/` | 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/` | 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` | A new use calls `driveUpload("", name, mime, bytes)` from diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index 28939bc..74807ed 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -165,9 +165,9 @@ also in `server/src/admin-schema/` and a CHECK): | Entity → field | Stored values | Labelled? | 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 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 → Status (+ list filter) | upcoming, past, cancelled | no | `STATUS_LABEL` in `src/pages/EventDetail.tsx` | | Events → Series → Repeats | weekly, monthly_date, monthly_weekday | **yes** | `src/lib/eventSeries.ts` | @@ -197,7 +197,7 @@ code): | 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 hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labelled by name | | Event hosts / event people / team members / timeline people → Person | `people` | people | @@ -271,7 +271,7 @@ The numbers band's "Number Source" dropdown works the same way: | 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`. | | 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. | -| 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. | | 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 `` (`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. | @@ -280,7 +280,7 @@ The numbers band's "Number Source" dropdown works the same way: | 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 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 navigation | `src/pages/admin/adminNav.ts` | | | The live site's address (used by QR codes) | `SITE_ORIGIN` in `src/lib/site.ts` | | diff --git a/server/src/admin-schema.js b/server/src/admin-schema.js index 7c62f6b..0073b61 100644 --- a/server/src/admin-schema.js +++ b/server/src/admin-schema.js @@ -15,7 +15,7 @@ columns writable columns of the parent row extensions 1:1 side tables, optionally gated on a column 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 singleton the one id this entity ever has; the engine refuses create and delete (see front_page) @@ -86,7 +86,7 @@ export const OPTION_QUERIES = { // dropdowns of which four are always wrong. The timeline and the // featured cards both pick from it. `kind` is the discriminator // 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: ` SELECT 'event' AS kind, id, title AS label FROM events UNION ALL diff --git a/server/src/admin-schema/frontPage.js b/server/src/admin-schema/frontPage.js index 6fe3bcd..346d709 100644 --- a/server/src/admin-schema/frontPage.js +++ b/server/src/admin-schema/frontPage.js @@ -89,7 +89,7 @@ export const frontPage = { "manual", "years_since", "regions", - "chapters", + "groups", "partners", "events_held", "retreats_held", diff --git a/server/src/admin-schema/organizations.js b/server/src/admin-schema/organizations.js index a4059fc..2fdc388 100644 --- a/server/src/admin-schema/organizations.js +++ b/server/src/admin-schema/organizations.js @@ -28,7 +28,7 @@ export const organizations = { }, columns: [ - enumeration("kind", ["national", "region", "chapter", "partner"], { + enumeration("kind", ["national", "region", "group", "partner"], { required: true, }), text("name", { required: true }), @@ -58,10 +58,10 @@ export const organizations = { ], }, { - key: "chapter", - table: "chapters", + key: "group", + table: "groups", idColumn: "id", - when: { column: "kind", value: "chapter" }, + when: { column: "kind", value: "group" }, columns: [text("region_id"), text("meets"), text("started")], }, ], diff --git a/server/src/googleService.js b/server/src/googleService.js index 214edc5..3aca412 100644 --- a/server/src/googleService.js +++ b/server/src/googleService.js @@ -148,7 +148,7 @@ async function findOrMakeFolder(path) { const walked = []; for (const name of path.split("/").filter(Boolean)) { // 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)); walked.push(name); const quoted = name.replace(/\\/g, "\\\\").replace(/'/g, "\\'"); diff --git a/server/src/migrations/052_groups.sql b/server/src/migrations/052_groups.sql new file mode 100644 index 0000000..cf14851 --- /dev/null +++ b/server/src/migrations/052_groups.sql @@ -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/, 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/', '/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; diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js index da9b940..12380a1 100644 --- a/server/src/pageMeta.js +++ b/server/src/pageMeta.js @@ -169,7 +169,7 @@ function firstParagraph(db, ownerKind, id, slot) { /* ── 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) { 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 }; } - 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); const [, base, rawId] = match; @@ -404,8 +404,8 @@ export function metaFor(db, rawPath) { return eventMeta(site, db, id, meta); case "regions": return organizationMeta(site, db, id, "region", meta); - case "chapters": - return organizationMeta(site, db, id, "chapter", meta); + case "groups": + return organizationMeta(site, db, id, "group", meta); case "partners": return organizationMeta(site, db, id, "partner", meta); case "organizations": diff --git a/server/src/routes/content.js b/server/src/routes/content.js index b65cc0f..a16f53a 100644 --- a/server/src/routes/content.js +++ b/server/src/routes/content.js @@ -3,7 +3,7 @@ GET /events list + the event scopes 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 /teams list, ?org=slug GET /teams/:id one team's page @@ -11,13 +11,13 @@ GET /awards/:id one award and its recipients 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 list component be written once and pointed at any kind. The lists leave out unlisted records (is_listed = 0); 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. Responses carry their fallbacks already resolved: an event's @@ -70,7 +70,7 @@ const content = new Hono(); // anything. stale-while-revalidate keeps the page instant while the // refresh happens behind it. -const ORG_KINDS = ["national", "region", "chapter", "partner"]; +const ORG_KINDS = ["national", "region", "group", "partner"]; /* ── Loaders ───────────────────────────────────────────────── */ @@ -112,7 +112,7 @@ function shapeHost(row) { kind: row.host_kind, // 'organization' | 'person' id: row.host_id, 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. org_kind: row.host_org_kind, }; @@ -264,11 +264,11 @@ function attachRegionDetails(db, orgs) { ) .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 .prepare( `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 WHERE c.region_id IN (${marks(ids.length)}) ORDER BY o.sort_order, o.name`, @@ -309,20 +309,20 @@ function attachRegionDetails(db, orgs) { scope: byId[org.id]?.scope ?? null, map_note: byId[org.id]?.map_note ?? null, areas: areasBy.get(org.id) ?? [], - chapters: childrenBy.get(org.id) ?? [], + groups: childrenBy.get(org.id) ?? [], }; } } -function attachChapterDetails(db, orgs) { - const ids = orgs.filter((o) => o.kind === "chapter").map((o) => o.id); +function attachGroupDetails(db, orgs) { + const ids = orgs.filter((o) => o.kind === "group").map((o) => o.id); if (ids.length === 0) return; const rows = db .prepare( `SELECT c.id, c.region_id, c.meets, c.started, 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 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])); for (const org of orgs) { - if (org.kind !== "chapter") continue; + if (org.kind !== "group") continue; const row = byId[org.id] ?? {}; org.details = { region_id: row.region_id ?? null, @@ -539,7 +539,7 @@ content.get("/events/:id", (c) => { /* ── Organizations ───────────────────────────────────────────── GET /organizations every published, listed org 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 places, so a list component reads `name`, `color`, `logo` and @@ -584,13 +584,13 @@ content.get("/organizations", (c) => { ); attachRegionDetails(db, organizations); - attachChapterDetails(db, organizations); + attachGroupDetails(db, organizations); attachLeadership(db, 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) => { const db = c.get("db"); const id = c.req.param("id"); @@ -607,7 +607,7 @@ content.get("/organizations/:id", (c) => { const one = [organization]; attachRegionDetails(db, one); - attachChapterDetails(db, one); + attachGroupDetails(db, one); attachLeadership(db, one); attachTeams(db, one); attachAwards(db, one); @@ -637,8 +637,8 @@ content.get("/organizations/:id", (c) => { GET /teams/:id one team's page An unpublished organization hides its teams too, in both - routes. Without that join a retired chapter's board stays - reachable by URL after the chapter itself has gone. + routes. Without that join a retired group's board stays + reachable by URL after the group itself has gone. ───────────────────────────────────────────────────────────── */ content.get("/teams", (c) => { diff --git a/server/src/routes/directory.js b/server/src/routes/directory.js index 0e63a3c..ced9fa2 100644 --- a/server/src/routes/directory.js +++ b/server/src/routes/directory.js @@ -5,7 +5,7 @@ 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, - 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 site" without five list requests carrying descriptions, links and blocks it would throw away. diff --git a/server/src/routes/feedback.js b/server/src/routes/feedback.js index 536e235..b31f643 100644 --- a/server/src/routes/feedback.js +++ b/server/src/routes/feedback.js @@ -69,7 +69,7 @@ feedback.post("/", async (c) => { const email = clean(body.email, LIMITS.email); const message = clean(body.message, LIMITS.message); 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 feedbackType = TYPES.includes(body.feedbackType) ? body.feedbackType diff --git a/server/src/routes/history.js b/server/src/routes/history.js index b32fe83..50714f2 100644 --- a/server/src/routes/history.js +++ b/server/src/routes/history.js @@ -6,7 +6,7 @@ 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 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. What's left here is shaping, and three things the view can't do: diff --git a/server/src/routes/home.js b/server/src/routes/home.js index f503c71..b891936 100644 --- a/server/src/routes/home.js +++ b/server/src/routes/home.js @@ -56,7 +56,7 @@ const PAGE_ID = "home"; const STAT_QUERIES = { regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`, - 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`, events_held: `SELECT COUNT(*) AS n FROM v_events WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`, diff --git a/server/src/routes/requests.js b/server/src/routes/requests.js index f64872d..3d5aab1 100644 --- a/server/src/routes/requests.js +++ b/server/src/routes/requests.js @@ -2,7 +2,7 @@ REQUEST ROUTE: POST /api/requests 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 'content' (046_content_requests.sql), files in Google Drive. @@ -30,7 +30,7 @@ const requests = new Hono(); const CATEGORIES = { blog: ["new"], event: ["new", "update"], - chapter: ["new", "update"], + group: ["new", "update"], region: ["update"], partner: ["new", "update"], team: ["new", "update"], @@ -64,12 +64,12 @@ export function cleanDetails(raw) { } const MIN_MESSAGE = 10; // 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 TYPE_FOLDERS = { blog: "Blog Posts", event: "Events", - chapter: "Chapters", + group: "Groups", region: "Regions", partner: "Partners", team: "Teams", diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js index b8591bd..7a1edd6 100644 --- a/server/src/seed-showcase.js +++ b/server/src/seed-showcase.js @@ -10,7 +10,7 @@ exercises all of it: /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 /awards/showcase-award award: recipients, one at an event /people/showcase-person person: bio, links, roles past and @@ -30,7 +30,7 @@ Published but unlisted by default: every page above works, and 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. --listed lists everything instead, and 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 REGION = "showcase-region"; -const CHAPTER = "showcase-chapter"; +const GROUP = "showcase-group"; const TEAM = "showcase-team"; const AWARD = "showcase-award"; const PERSON = "showcase-person"; @@ -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 teams 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(); /* ── Organizations ── */ @@ -256,11 +256,11 @@ tx(db, () => { blocks("organization", REGION, "body", pageBody("region")); insert("organizations", { - id: CHAPTER, - kind: "chapter", - name: "Showcase Chapter", + id: GROUP, + kind: "group", + name: "Showcase Group", short_name: "Showcase Ch.", - tagline: "A chapter with every field filled in", + tagline: "A group with every field filled in", color: "#138ba0", logo: IMAGE, ...place, @@ -270,10 +270,10 @@ tx(db, () => { is_listed: LISTED, sort_order: 99, }); - insert("chapters", { id: CHAPTER, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" }); - links("organization", CHAPTER, standardLinks("Showcase Chapter")); - blocks("organization", CHAPTER, "card", cardText("chapter")); - blocks("organization", CHAPTER, "body", pageBody("chapter")); + insert("groups", { id: GROUP, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" }); + links("organization", GROUP, standardLinks("Showcase Group")); + blocks("organization", GROUP, "card", cardText("group")); + blocks("organization", GROUP, "body", pageBody("group")); /* ── People ── */ insert("people", { @@ -290,7 +290,7 @@ tx(db, () => { country: "US", 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.", - primary_org_id: CHAPTER, + primary_org_id: GROUP, is_published: 1, is_listed: LISTED, }); @@ -343,7 +343,7 @@ tx(db, () => { 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: 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) => 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_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" }]); blocks("event", SERIES, "card", cardText("series")); @@ -489,7 +489,7 @@ db.close(); console.log(`✓ Showcase written (${LISTED ? "listed" : "unlisted: pages only"}):`); for (const path of [ `/regions/${REGION}`, - `/chapters/${CHAPTER}`, + `/groups/${GROUP}`, `/teams/${TEAM}`, `/awards/${AWARD}`, `/people/${PERSON}`, diff --git a/site.json b/site.json index ad90c32..880dd13 100644 --- a/site.json +++ b/site.json @@ -20,7 +20,7 @@ }, "/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": { "title": "Leadership", @@ -28,7 +28,7 @@ }, "/resources": { "title": "Resources", - "description": "Teachings, brand assets, and material for chapters and partners." + "description": "Teachings, brand assets, and material for groups and partners." }, "/history": { "title": "History", @@ -40,7 +40,7 @@ }, "/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": { "title": "QR Codes", diff --git a/src/App.tsx b/src/App.tsx index fd90856..9585533 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -17,7 +17,7 @@ import RequireRole from "./pages/admin/RequireRole.tsx" // 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: // 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 in , so the header stays put while // a page loads. import Home from "./pages/Home.tsx" @@ -94,7 +94,7 @@ export default function App() { } /> } /> } /> - } /> + } /> } /> } /> } /> diff --git a/src/components/OrgLogo.tsx b/src/components/OrgLogo.tsx index 1ee2074..225d11c 100644 --- a/src/components/OrgLogo.tsx +++ b/src/components/OrgLogo.tsx @@ -4,7 +4,7 @@ An organization's logo, or its initials in a square in its colour 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 - chapter map. + group map. ═══════════════════════════════════════════════════════════════ */ import Logo from './Logo.tsx' diff --git a/src/components/PageShell.tsx b/src/components/PageShell.tsx index 99d8602..f83b706 100644 --- a/src/components/PageShell.tsx +++ b/src/components/PageShell.tsx @@ -18,7 +18,7 @@ { id: "local", // matches the nav hash, #local - title: "Local Chapters", + title: "Local Groups", blurb: "Optional line under the section heading.", accent: BRAND, // heading, banner, rule background: "var(--color-tint)", diff --git a/src/components/PageState.tsx b/src/components/PageState.tsx index ad166bd..644bedc 100644 --- a/src/components/PageState.tsx +++ b/src/components/PageState.tsx @@ -3,7 +3,7 @@ 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: - 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. Rendered inside PageShell so the chrome doesn't flicker in and @@ -33,7 +33,7 @@ export default function PageState({ error: string | null notFound: boolean onRetry: () => void - /** Lowercase, as it appears mid-sentence: "retreat", "chapter". */ + /** Lowercase, as it appears mid-sentence: "retreat", "group". */ noun: string backTo: string backLabel: string diff --git a/src/data/mapGrid.ts b/src/data/mapGrid.ts index 17b534f..53bc37e 100644 --- a/src/data/mapGrid.ts +++ b/src/data/mapGrid.ts @@ -2,7 +2,7 @@ MAP GRID 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 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])); -/* ── Which tile a chapter sits on ────────────────────────────── +/* ── Which tile a group sits on ────────────────────────────── The database stores a real address, state_code for US, and a country code otherwise, rather than a tile name. This is the one place that translates between the two, so adding a Mexico band later means a line here and nothing in SQL. 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 = { CA: "CANADA", // ISO country code, not California }; -export function areaForChapter(chapter) { - if (!chapter) return null; - if (chapter.is_online) return null; +export function areaForGroup(group) { + if (!group) return null; + if (group.is_online) return null; - if (chapter.country === "US") { - return AREA_BY_CODE[chapter.state_code] ? chapter.state_code : null; + if (group.country === "US") { + 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 ─────────────────────────────────────────── @@ -146,13 +146,13 @@ export function buildAreaSlices(regionAreas: any[] = [], regions: any[] = []) { return byArea; } -/* ── Chapter counts per tile ─────────────────────────────────── +/* ── Group counts per tile ─────────────────────────────────── { WA: 2, MO: 1, CANADA: 1 } ───────────────────────────────────────────────────────────── */ -export function countChaptersByArea(chapters: any[] = []) { +export function countGroupsByArea(groups: any[] = []) { const counts = {}; - for (const chapter of chapters) { - const code = areaForChapter(chapter); + for (const group of groups) { + const code = areaForGroup(group); if (code) counts[code] = (counts[code] ?? 0) + 1; } return counts; diff --git a/src/data/requestTypes.ts b/src/data/requestTypes.ts index 5dff828..ef015a2 100644 --- a/src/data/requestTypes.ts +++ b/src/data/requestTypes.ts @@ -6,8 +6,8 @@ CATEGORIES in server/src/routes/requests.js (and the CHECK in 046_content_requests.sql); keep them in step. - A link can open the form on one: requestLink("chapter") is - /request?type=chapter. People, teams and awards have no buttons on + A link can open the form on one: requestLink("group") is + /request?type=group. People, teams and awards have no buttons on the site, but are here to pick. `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 `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. ═══════════════════════════════════════════════════════════════ */ @@ -91,20 +91,20 @@ export const REQUEST_TYPES: RequestType[] = [ ], }, { - id: "chapter", - label: "Chapter", - hint: "A local NGU chapter", + id: "group", + label: "Group", + hint: "A local NGU group", actions: ["new", "update"], - subject: "The chapter's name", + subject: "The group's name", entity: "organizations", heading: "name", - preset: { kind: "chapter" }, + preset: { kind: "group" }, fields: [ { key: "region", label: "Region it's in", placeholder: "eg. Great Lakes" }, CITY, STATE, 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, EMAIL, DESCRIPTION, diff --git a/src/lib/adminSchema/frontPage.ts b/src/lib/adminSchema/frontPage.ts index e8528f7..daa1ef8 100644 --- a/src/lib/adminSchema/frontPage.ts +++ b/src/lib/adminSchema/frontPage.ts @@ -28,7 +28,7 @@ const STAT_SOURCES = [ ["manual", "Print Value Field"], ["years_since", "Years Since Value"], ["regions", "Count: regions"], - ["chapters", "Count: chapters"], + ["groups", "Count: groups"], ["partners", "Count: partners"], ["events_held", "Count: past events"], ["retreats_held", "Count: past retreats"], diff --git a/src/lib/adminSchema/organizations.ts b/src/lib/adminSchema/organizations.ts index 39403f7..7f99014 100644 --- a/src/lib/adminSchema/organizations.ts +++ b/src/lib/adminSchema/organizations.ts @@ -20,7 +20,7 @@ export const organizations = { { key: "is_listed", label: "Listed", widget: "bool" }, ], 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_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] }, ], @@ -34,7 +34,7 @@ export const organizations = { path: "kind", label: "Kind", widget: "select", - options: ["national", "region", "chapter", "partner"], + options: ["national", "region", "group", "partner"], required: true, help: "Changing this swaps which extra fields apply", }, @@ -60,18 +60,18 @@ export const organizations = { ], }, { - legend: "Chapter", - when: { path: "kind", value: "chapter" }, + legend: "Group", + when: { path: "kind", value: "group" }, fields: [ { - path: "chapter.region_id", + path: "group.region_id", label: "Region", widget: "select", optionsFrom: "regions", blankLabel: "Default: none", }, - { path: "chapter.meets", label: "Meets", help: "2nd Sundays, 6:00pm" }, - { path: "chapter.started", label: "Started", help: "Since 2021" }, + { path: "group.meets", label: "Meets", help: "2nd Sundays, 6:00pm" }, + { path: "group.started", label: "Started", help: "Since 2021" }, ], }, { legend: "Place", fields: PLACE_FIELDS }, diff --git a/src/lib/hrefs.ts b/src/lib/hrefs.ts index d1cff72..963e90a 100644 --- a/src/lib/hrefs.ts +++ b/src/lib/hrefs.ts @@ -5,7 +5,7 @@ never sends paths, it sends `{ kind, id }` and, for an organization, the `org_kind` that decides which of the three 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 while the router only knew /retreats/:id. @@ -30,16 +30,16 @@ 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' -/* 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 each. 'national' is NGU itself, one record, no listing to sit under, so it falls through to the generic path. */ const ORG_BASE: Record = { region: '/regions', - chapter: '/chapters', + group: '/groups', partner: '/partners', 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. */ export function orgListHref(kind?: string | null): { to: string; label: string } { switch (kind) { case 'region': return { to: '/community#regions', label: 'All regions' } - case 'chapter': - return { to: '/community#chapters', label: 'All chapters' } + case 'group': + return { to: '/community#groups', label: 'All groups' } case 'partner': return { to: '/community#partners', label: 'All partner organizations' } default: diff --git a/src/lib/organizations.ts b/src/lib/organizations.ts index 8e4fdde..9592678 100644 --- a/src/lib/organizations.ts +++ b/src/lib/organizations.ts @@ -1,7 +1,7 @@ /* ═══════════════════════════════════════════════════════════════ 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 way and filters by kind: @@ -14,8 +14,8 @@ `details`, so a list component can render the common parts without knowing what it's holding: - region { scope, map_note, areas[], chapters[] } - chapter { region_id, region_name, region_color, meets, started } + region { scope, map_note, areas[], groups[] } + group { region_id, region_name, region_color, meets, started } partner {} 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. ───────────────────────────────────────────────────────────── */ -const WITH_PAGE = new Set(["region", "chapter", "partner"]); +const WITH_PAGE = new Set(["region", "group", "partner"]); export function orgPath(org) { return WITH_PAGE.has(org?.kind) && !isBadId(org.id) ? orgHref(org.id, org.kind) : null; diff --git a/src/lib/sections.tsx b/src/lib/sections.tsx index a56fc94..ceb483b 100644 --- a/src/lib/sections.tsx +++ b/src/lib/sections.tsx @@ -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 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 times with a different filter each. @@ -24,8 +24,8 @@ import RequestLink from "../components/RequestLink.tsx"; Toggle: EventCardsToggle, }, request: { // optional button - type: "chapter", // to the Request form - label: "Add or update a chapter", + type: "group", // to the Request form + label: "Add or update a group", }, } diff --git a/src/lib/useCommunity.ts b/src/lib/useCommunity.ts index 324db1a..eb5daba 100644 --- a/src/lib/useCommunity.ts +++ b/src/lib/useCommunity.ts @@ -1,10 +1,10 @@ /* ═══════════════════════════════════════════════════════════════ useCommunity - The chapter map's view of the organization list (OrgList-Map). - Regions and chapters are the same table and the same endpoint; + The group map's view of the organization list (OrgList-Map). + Regions and groups are the same table and the same endpoint; 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: @@ -24,17 +24,17 @@ import { useOrganizations, } from "./organizations.ts"; import { - areaForChapter, + areaForGroup, buildAreaSlices, - countChaptersByArea, + countGroupsByArea, } from "../data/mapGrid.ts"; export function useCommunity() { const regionsQuery = useOrganizations("region"); - const chaptersQuery = useOrganizations("chapter"); + const groupsQuery = useOrganizations("group"); const rawRegions = regionsQuery.organizations; - const rawChapters = chaptersQuery.organizations; + const rawGroups = groupsQuery.organizations; return useMemo(() => { /* ── Regions ─────────────────────────────────────────────── @@ -52,18 +52,18 @@ export function useCommunity() { 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 to is a rendering question, answered here once rather than at every call site. */ - const chapters = rawChapters.map((org) => ({ + const groups = rawGroups.map((org) => ({ ...org, region_id: org.details?.region_id ?? null, region_name: org.details?.region_name ?? null, region_color: org.details?.region_color ?? null, meets: org.details?.meets ?? null, started: org.details?.started ?? null, - area_code: areaForChapter(org), + area_code: areaForGroup(org), })); 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. */ const slices = buildAreaSlices(regionAreas, regions); - const chapterCounts = countChaptersByArea(chapters); + const groupCounts = countGroupsByArea(groups); - const chaptersByRegion = new Map(); - for (const chapter of chapters) { - if (!chapter.region_id) continue; - const list = chaptersByRegion.get(chapter.region_id); - if (list) list.push(chapter); - else chaptersByRegion.set(chapter.region_id, [chapter]); + const groupsByRegion = new Map(); + for (const group of groups) { + if (!group.region_id) continue; + const list = groupsByRegion.get(group.region_id); + if (list) list.push(group); + 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, rather than by the sort_order the API returns. */ @@ -108,8 +108,8 @@ export function useCommunity() { .filter(Boolean); return { - loading: regionsQuery.loading || chaptersQuery.loading, - error: regionsQuery.error ?? chaptersQuery.error, + loading: regionsQuery.loading || groupsQuery.loading, + error: regionsQuery.error ?? groupsQuery.error, regions, regionAreas, @@ -118,11 +118,11 @@ export function useCommunity() { international, virtual, - chapters, - chaptersIn, + groups, + groupsIn, slices, - chapterCounts, + groupCounts, regionsForArea, areasLabelFor, @@ -130,10 +130,10 @@ export function useCommunity() { }; }, [ rawRegions, - rawChapters, + rawGroups, regionsQuery.loading, regionsQuery.error, - chaptersQuery.loading, - chaptersQuery.error, + groupsQuery.loading, + groupsQuery.error, ]); } diff --git a/src/lib/useContent.ts b/src/lib/useContent.ts index 34a31b5..7656b65 100644 --- a/src/lib/useContent.ts +++ b/src/lib/useContent.ts @@ -76,7 +76,7 @@ export type Link = { export type OrgRef = { id: string; name: string; kind?: string | null } /* 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 exactly what refHref() in hrefs.ts takes. */ export type EventHost = { @@ -207,7 +207,7 @@ export type RegionArea = { export type OrganizationRecord = { id: string - kind: 'national' | 'region' | 'chapter' | 'partner' + kind: 'national' | 'region' | 'group' | 'partner' name: string short_name?: string | null tagline?: string | null @@ -234,7 +234,7 @@ export type OrganizationRecord = { scope?: RegionScope | null map_note?: string | null 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_name?: string | null region_color?: string | null diff --git a/src/navConfig.ts b/src/navConfig.ts index 967ee3b..e9eead4 100644 --- a/src/navConfig.ts +++ b/src/navConfig.ts @@ -27,7 +27,7 @@ export const PAGE_SECTIONS = { ], "/community": [ { label: "Community Blog", hash: "#blog" }, - { label: "Local Chapters", hash: "#chapters" }, + { label: "Local Groups", hash: "#groups" }, { label: "Unity Regions", hash: "#regions" }, { label: "Partner Organizations", hash: "#partners" }, ], diff --git a/src/pages/Community.tsx b/src/pages/Community.tsx index 24012b2..00b2b71 100644 --- a/src/pages/Community.tsx +++ b/src/pages/Community.tsx @@ -15,7 +15,7 @@ const PAGE = sitePage("/community"); COMMUNITY PAGE 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. 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 = [ { - id: "chapters", - title: "Local Chapters", + id: "groups", + title: "Local Groups", blurb: "Young adult groups meeting in person and online across the movement.", accent: BRAND, background: "var(--color-tint)", 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 }, }, { id: "regions", title: "Unity Regions", 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", background: "var(--color-surface)", Component: OrgListVertical, diff --git a/src/pages/OrganizationDetail.tsx b/src/pages/OrganizationDetail.tsx index ff7a6d0..8a10196 100644 --- a/src/pages/OrganizationDetail.tsx +++ b/src/pages/OrganizationDetail.tsx @@ -1,12 +1,12 @@ /* ═══════════════════════════════════════════════════════════════ 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 table. The kind decides which extras render, not which file runs. 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 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 // 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. // // 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 // this redirects somewhere nothing matches. 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({ - id: 'chapters', - title: 'Chapters', + id: 'groups', + title: 'Groups', blurb: org.details.map_note ?? undefined, accent, background: 'var(--color-surface)', content: (
- {(org.details.chapters ?? []).map((chapter) => ( + {(org.details.groups ?? []).map((group) => ( - + - {chapter.name} + {group.name} - {chapter.location_label && ( + {group.location_label && ( - {chapter.location_label} + {group.location_label} )} @@ -285,7 +285,7 @@ function Facts({ {org.details.scope} )} - {org.kind === 'chapter' && org.details.region_id && ( + {org.kind === 'group' && org.details.region_id && ( Part of{' '} )} - {org.kind === 'chapter' && org.details.meets && ( + {org.kind === 'group' && org.details.meets && ( Meets {org.details.meets} )} - {org.kind === 'chapter' && org.details.started && ( + {org.kind === 'group' && org.details.started && ( Since {org.details.started} )} {org.is_online && Online} @@ -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 (

{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."}