diff --git a/CLAUDE.md b/CLAUDE.md index f6beba4..e6e5bf6 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. @@ -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. - **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. +- **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 `` 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`. @@ -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. - Child collections are deleted and reinserted wholesale. Unsafe for entities referenced by foreign keys elsewhere. - `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. - `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. 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/importing.md b/docs/importing.md index 658df8c..3d770f2 100644 --- a/docs/importing.md +++ b/docs/importing.md @@ -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. 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. The conversion is `server/src/docx.js`; the route is diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index 28939bc..667be2d 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -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 | | The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) | | The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) | -| Navigation, page section titles, 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` | | 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 stores the first and shows the second. That difference is what makes -relabelling cheap. +relabeling cheap. ### Renaming what a dropdown shows @@ -163,13 +163,13 @@ wrong rather than working around it. **Fixed lists** (`options`: labels in `src/lib/adminSchema/`, values 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 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 → 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 → 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` | @@ -190,21 +190,21 @@ also in `server/src/admin-schema/` and a CHECK): | Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a | "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 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 → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labeled by name | | Event hosts / event people / team members / timeline people → Person | `people` | people | | Community blog section → Pinned posts → Post | `blog_posts` | blog posts, newest first | | Timeline → Record; Featured cards → Record | `record_refs` | every event, organization, award, person and team, narrowed by the type picked beside it | | Affiliations → Team | `teams` | teams, filtered to the chosen organization | -| Person awards → Award | `awards` | awards, 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 | --- @@ -268,19 +268,19 @@ The numbers band's "Number Source" dropdown works the same way: | What | File | Notes | | --- | --- | --- | | Header and footer navigation, page subnav links | `src/navConfig.ts` | `PAGE_LINKS`, `PAGE_SECTIONS`, `NAV_ACTIONS`. A new page also needs a route in `src/App.tsx`. | -| Section titles, blurbs and 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. | | 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. | +| 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. | -| 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. | | 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..1769d0e 100644 --- a/server/src/admin-schema.js +++ b/server/src/admin-schema.js @@ -15,13 +15,13 @@ 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) check (db, id) => void, run after a save has written 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 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 // 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/columns.js b/server/src/admin-schema/columns.js index d59deb7..0832550 100644 --- a/server/src/admin-schema/columns.js +++ b/server/src/admin-schema/columns.js @@ -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) => ({ key: "links", table: "links", @@ -189,12 +189,12 @@ export const blocksChild = (ownerKind) => ({ one with both selects filled, and that comes back keyed to the 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. sort_order isn't declared. The engine writes it from the row's 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 = { key: "event_hosts", table: "event_hosts", 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/clips.js b/server/src/clips.js index acc5b2d..97c71d4 100644 --- a/server/src/clips.js +++ b/server/src/clips.js @@ -386,7 +386,7 @@ async function cut(db, job) { const { width, height } = await probe(input); if (width && height) { // 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. let w = width; let h = height; diff --git a/server/src/db.js b/server/src/db.js index e7c5f3d..ec341d9 100644 --- a/server/src/db.js +++ b/server/src/db.js @@ -129,7 +129,7 @@ export function migrate(db, { log = console.log } = {}) { 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}`); }); 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/media.js b/server/src/media.js index e85941a..cada7e9 100644 --- a/server/src/media.js +++ b/server/src/media.js @@ -24,7 +24,7 @@ which also drops its metadata, camera location included. `keepOriginal` stores the bytes exactly as uploaded instead, 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. Names are random, so two uploads of "logo.png" can't collide 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/migrations/053_us_spelling.sql b/server/src/migrations/053_us_spelling.sql new file mode 100644 index 0000000..e8d649f --- /dev/null +++ b/server/src/migrations/053_us_spelling.sql @@ -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; diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js index da9b940..f91ac5a 100644 --- a/server/src/pageMeta.js +++ b/server/src/pageMeta.js @@ -105,7 +105,7 @@ export function siteFor(db) { index: row.indexing ? row.indexing === "on" : base.robots?.index !== false, }, 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 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 upload loads its 640px copy first (useSmallImage). Decorative by default (alt ""), since a logo sits next to the name it stands for. diff --git a/src/components/OrgLogo.tsx b/src/components/OrgLogo.tsx index 1ee2074..f51837a 100644 --- a/src/components/OrgLogo.tsx +++ b/src/components/OrgLogo.tsx @@ -1,10 +1,10 @@ /* ═══════════════════════════════════════════════════════════════ 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 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/components/PeopleTiles.tsx b/src/components/PeopleTiles.tsx index d9db438..cfbb158 100644 --- a/src/components/PeopleTiles.tsx +++ b/src/components/PeopleTiles.tsx @@ -345,7 +345,7 @@ function buildTeamGroups( return [ { 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, accent, people: data.people, diff --git a/src/components/PlatformIcon.tsx b/src/components/PlatformIcon.tsx index 17205b2..083cb35 100644 --- a/src/components/PlatformIcon.tsx +++ b/src/components/PlatformIcon.tsx @@ -6,7 +6,7 @@ import type { Platform } from '../lib/platforms.ts' PLATFORM ICON 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 included, draws nothing, so a caller can always pass the field straight through. diff --git a/src/components/QrCode.tsx b/src/components/QrCode.tsx index 8ae64bf..9d55c2f 100644 --- a/src/components/QrCode.tsx +++ b/src/components/QrCode.tsx @@ -3,7 +3,7 @@ A QR code as an , 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). With anything there, the code switches to high error correction 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. 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 for exactly that. ═══════════════════════════════════════════════════════════════ */ @@ -42,11 +42,11 @@ const BADGE = 0.24 /* DoveMark's own viewBox is 72.87 × 48.57. */ 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({ value, - centre = null, + center = null, ink = QR_INK, paper = QR_PAPER, label, @@ -54,7 +54,7 @@ export default function QrCode({ className, }: { value: string - centre?: QrCentre + center?: QrCenter ink?: string paper?: string /** Accessible name for the image, e.g. "QR code for /retreats". */ @@ -62,7 +62,7 @@ export default function QrCode({ ref?: Ref className?: string }) { - const level = centre ? 'H' : 'M' + const level = center ? 'H' : 'M' const matrix = useMemo(() => qrMatrix(value, level), [value, level]) const path = useMemo(() => qrPath(matrix, MARGIN), [matrix]) @@ -86,7 +86,7 @@ export default function QrCode({ - {centre && ( + {center && ( - {centre.kind === 'dove' ? ( + {center.kind === 'dove' ? ( ) : ( [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/index.css b/src/index.css index 69bac16..7db5e2a 100644 --- a/src/index.css +++ b/src/index.css @@ -12,16 +12,16 @@ --font-display: 'Poppins', sans-serif; --font-body: 'Montserrat', sans-serif; - /* ── Colour tokens ───────────────────────────────────────────── + /* ── Color tokens ───────────────────────────────────────────── Named for what they do, not what they look like, because dark mode (below) swaps the values. Use them as utilities (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. - A colour that must stay the same in both modes (white text on - a dark band, a platform's own colour) stays a literal. Colours - that arrive as data (page accents, event and region colours) go + A color that must stay the same in both modes (white text on + a dark band, a platform's own color) stays a literal. Colors + that arrive as data (page accents, event and region colors) go through withAlpha() and accentText() in src/lib/color.ts. */ --color-ink: #073d4a; /* headings */ --color-body: #26454c; /* body text */ @@ -47,7 +47,7 @@ --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. */ :root { --accent-text-mix: 100%; diff --git a/src/lib/adminSchema/events.ts b/src/lib/adminSchema/events.ts index f382b7a..5d31d7e 100644 --- a/src/lib/adminSchema/events.ts +++ b/src/lib/adminSchema/events.ts @@ -83,7 +83,7 @@ export const events = { label: "Type", 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_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] }, ], @@ -128,7 +128,7 @@ export const events = { path: "status", label: "Status", widget: "select", - options: ["upcoming", "past", "cancelled"], + options: ["upcoming", "past", ["cancelled", "canceled"]], blankLabel: "Default: derive from end date", }, { @@ -146,7 +146,7 @@ export const events = { fields: [ { 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: "color", label: "Colour", widget: "color" }, + { path: "color", label: "Color", widget: "color" }, { path: "card_image", label: "Card background", diff --git a/src/lib/adminSchema/frontPage.ts b/src/lib/adminSchema/frontPage.ts index e8528f7..30878f2 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"], @@ -55,7 +55,7 @@ export const frontPage = { label: "Background", widget: "select", options: [ - ["brand", "Brand: animated colour and the dove"], + ["brand", "Brand: animated color and the dove"], ["photos", "Photos: cycles through the photos below"], ], blankLabel: "Default: brand", diff --git a/src/lib/adminSchema/organizations.ts b/src/lib/adminSchema/organizations.ts index 39403f7..71ead47 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,14 +34,14 @@ 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", }, { path: "name", label: "Name", required: true }, { path: "short_name", label: "Short name" }, { 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 }, ], }, @@ -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/adminSchema/shared.ts b/src/lib/adminSchema/shared.ts index 9fe4e57..9306c28 100644 --- a/src/lib/adminSchema/shared.ts +++ b/src/lib/adminSchema/shared.ts @@ -228,10 +228,10 @@ export const linksChild = { organization or a person, never both, which the CHECK on 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. - A person supplies neither: there is no colour on a person and a - headshot is not a logo, so a person-hosted event with no colour + A person supplies neither: there is no color on a person and a + headshot is not a logo, so a person-hosted event with no color of its own falls through to the section default. */ export const hostsChild = { key: "event_hosts", diff --git a/src/lib/adminSchema/siteSettings.ts b/src/lib/adminSchema/siteSettings.ts index ddf5ab6..fe74e66 100644 --- a/src/lib/adminSchema/siteSettings.ts +++ b/src/lib/adminSchema/siteSettings.ts @@ -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 it: token and label. The defaults come from the server's list (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][] = [ ["ink", "Headings"], ["body", "Body text"], @@ -162,15 +162,15 @@ export const siteSettings = { children: [ { key: "colors", - label: "Colours", - 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.", - addLabel: "Change a colour", - title: (row) => THEME_COLORS.find(([token]) => token === row.token)?.[1] ?? "New colour", + label: "Colors", + 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 color", + title: (row) => THEME_COLORS.find(([token]) => token === row.token)?.[1] ?? "New color", blank: { token: "", light: "", dark: "" }, fields: [ { path: "token", - label: "Colour", + label: "Color", widget: "select", options: THEME_COLORS.map(([token, label]) => [token, label]), required: true, diff --git a/src/lib/adminSchema/teams.ts b/src/lib/adminSchema/teams.ts index dd1ba3d..5472db5 100644 --- a/src/lib/adminSchema/teams.ts +++ b/src/lib/adminSchema/teams.ts @@ -46,7 +46,7 @@ export const teams = { }, { path: "name", label: "Name", required: true, help: "Board, Leadership Team" }, { 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 }, ], }, diff --git a/src/lib/adminWidth.tsx b/src/lib/adminWidth.tsx index 3a3e2fe..5bd3a1e 100644 --- a/src/lib/adminWidth.tsx +++ b/src/lib/adminWidth.tsx @@ -1,8 +1,9 @@ /* ═══════════════════════════════════════════════════════════════ ADMIN PAGE WIDTH - 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. + 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), and + so does the admin home (three cards across). Like the title (adminTitle.tsx), the page asks and the layout decides, so AdminLayout stays the one place that sets
's width. diff --git a/src/lib/color.ts b/src/lib/color.ts index 381acac..8041be2 100644 --- a/src/lib/color.ts +++ b/src/lib/color.ts @@ -1,14 +1,14 @@ /* ═══════════════════════════════════════════════════════════════ COLOR - Two helpers for colours that arrive as data (a page's accent, an - event's or region's colour), so they work with the theme tokens + Two helpers for colors that arrive as data (a page's accent, an + event's or region's color), so they work with the theme tokens 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. - 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 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 => `color-mix(in srgb, ${color} var(--accent-text-mix), #ffffff)` -/* Text for on top of a colour that arrives as data: white or deep - ink, whichever has more contrast (WCAG), so a pale colour an admin +/* Text for on top of a color that arrives as data: white or deep + ink, whichever has more contrast (WCAG), so a pale color an admin picks still gets readable text. Anything that isn't #rrggbb (a CSS variable, say) gets white, which suits the site's own dark accents. */ @@ -40,8 +40,8 @@ export function readableOn(color: string): string { /* ── The site's accents ────────────────────────────────────────── 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. - ACCENTS are the other section colours a page may give a band, all + token, so the admin's palette (Site settings → Colors) reaches it. + 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 tints (5:1 or better). Use these rather than a new hex. */ export const BRAND = 'var(--color-action)' diff --git a/src/lib/embeds.ts b/src/lib/embeds.ts index c9f6460..16e7aa0 100644 --- a/src/lib/embeds.ts +++ b/src/lib/embeds.ts @@ -4,7 +4,7 @@ Turns the link an admin pastes into the URL an
- {(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 ( {title} {blurb &&

{blurb}

}
-
{children}
+
{children}
); } @@ -111,6 +115,7 @@ const QUICK_ADD = [ export default function AdminHome() { const { user } = useAuth(); const role = ROLE_LABELS[user?.role] ?? user?.role; + useWideAdminPage(); return (
diff --git a/src/pages/admin/AdminLayout.tsx b/src/pages/admin/AdminLayout.tsx index 645df79..6a4edf7 100644 --- a/src/pages/admin/AdminLayout.tsx +++ b/src/pages/admin/AdminLayout.tsx @@ -181,7 +181,7 @@ export default function AdminLayout() {
{/* 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 && (
diff --git a/src/pages/admin/AdminLogin.tsx b/src/pages/admin/AdminLogin.tsx index accbf2c..d1ecbe2 100644 --- a/src/pages/admin/AdminLogin.tsx +++ b/src/pages/admin/AdminLogin.tsx @@ -22,7 +22,7 @@ import { ApiError, get } from "../../lib/api.ts"; /* What a ?error= from the Google callback means, in the words the person at the login page needs. */ const GOOGLE_ERRORS: Record = { - 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.", no_account: "There's no admin account for that Google account. Ask a superadmin to add your email.", diff --git a/src/pages/admin/EntityEdit.tsx b/src/pages/admin/EntityEdit.tsx index 9292588..2a67690 100644 --- a/src/pages/admin/EntityEdit.tsx +++ b/src/pages/admin/EntityEdit.tsx @@ -131,7 +131,7 @@ export default function EntityEdit() { 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 ? `${qualifierPaths.map((path) => path.replace(/_id$/, "")).join("-")}-` : ""; diff --git a/src/pages/admin/EntityList.tsx b/src/pages/admin/EntityList.tsx index c97b939..76b6c9a 100644 --- a/src/pages/admin/EntityList.tsx +++ b/src/pages/admin/EntityList.tsx @@ -3,7 +3,7 @@ One component for organizations, events and people. The :entity 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 button: atLeast(user, "editor"), matching requireRole("editor") diff --git a/src/pages/admin/adminNav.ts b/src/pages/admin/adminNav.ts index e8db9d9..96688d8 100644 --- a/src/pages/admin/adminNav.ts +++ b/src/pages/admin/adminNav.ts @@ -58,7 +58,7 @@ export const DATA_NAV = { { to: "/admin/organizations", label: "Organizations", - blurb: "The national organization, regions, chapters and partners.", + blurb: "The national organization, regions, groups and partners.", }, { to: "/admin/teams", @@ -151,7 +151,7 @@ export const TOOLS_NAV = { { to: "/qr", 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.", }, ], }; diff --git a/src/pages/sections/EventCalendar.tsx b/src/pages/sections/EventCalendar.tsx index b52f74a..b7383ed 100644 --- a/src/pages/sections/EventCalendar.tsx +++ b/src/pages/sections/EventCalendar.tsx @@ -576,7 +576,7 @@ function MonthGrid({ weeks, month, today, occurrences, selected, onSelect, accen function Bar({ seg, accent }: { seg: Segment; accent: string }) { const color = seg.event.color || accent - const cancelled = seg.event.status === 'cancelled' + const canceled = seg.event.status === 'cancelled' return (