Write the site in US English
color, center, canceled, labeled, recognize and the rest, in UI text, help text, comments, docs and names (ColorInput, QrCenter). Migration 053 renames the two Site settings color CHECKs, whose names are the messages the admin shows. Kept: events.status's stored value 'cancelled' (shown as canceled), aria-labelledby, schema.org's EventCancelled, and old migrations as they ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
38aff34c97
commit
2ad65cdc15
60 changed files with 182 additions and 148 deletions
|
|
@ -69,7 +69,7 @@ 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`.
|
||||
- **Colors are tokens, not hex.** Admins can override any token (Panel → Site settings → Colors). The defaults are `server/src/themeDefaults.js` plus the same values as CSS in `src/index.css`; the build fails if they differ (`themeDefaultsCheck` in `vite.config.ts`), and migration 041's CHECK lists the token names. Use the utilities from `src/index.css` (`text-ink`, `text-body`, `text-muted`, `text-link`, `bg-surface`, `bg-tint`, `bg-action`, `border-brand/20`...) so dark mode works; a literal only for something that must look the same in both modes (white on a dark band, a platform's color). Data colors (accents, event and region colors) go through `withAlpha`, `accentText` and `readableOn` in `src/lib/color.ts`, never `${color}55`.
|
||||
- **Icons are Phosphor** (`@phosphor-icons/react`), weight `bold` (or `fill` for play/star). No hand-drawn `<svg>` icons and no Unicode glyphs as icons (× › ▶ →). Brand marks are the exception: `DoveMark`, `PlatformIcon`, the Google logo, the 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 `-`.
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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, 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 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,7 +190,7 @@ 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):
|
||||
|
|
@ -199,12 +199,12 @@ code):
|
|||
| --- | --- | --- |
|
||||
| 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,15 +268,15 @@ 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. |
|
||||
| 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 `<RequestLink>` (`src/components/RequestLink.tsx`). |
|
||||
| The site's colours, light and dark | the database over `src/index.css` | Admin → Panel → Site settings → Colours (superadmins): pick a colour, set its light and/or dark value; saving refuses anything that makes text hard to read. The defaults are `THEME_DEFAULTS` in `server/src/themeDefaults.js` (the admin and the contrast check read it) and the same values as CSS in `src/index.css`; the build stops if the two differ. The admin's labels for them are `THEME_LABELS` in `src/lib/adminSchema/siteSettings.ts`. Change a token's value in both modes and every use follows. Use the token utilities (`text-muted`, `bg-surface`, `border-brand/20`) or `var(--color-…)`, not hex. A colour that arrives as data (a page accent, an event's or region's colour) goes through `src/lib/color.ts`: `withAlpha` for tints, `accentText` for text in it, `readableOn` for text on it. |
|
||||
| The site's colors, light and dark | the database over `src/index.css` | Admin → Panel → Site settings → Colors (superadmins): pick a color, set its light and/or dark value; saving refuses anything that makes text hard to read. The defaults are `THEME_DEFAULTS` in `server/src/themeDefaults.js` (the admin and the contrast check read it) and the same values as CSS in `src/index.css`; the build stops if the two differ. The admin's labels for them are `THEME_LABELS` in `src/lib/adminSchema/siteSettings.ts`. Change a token's value in both modes and every use follows. Use the token utilities (`text-muted`, `bg-surface`, `border-brand/20`) or `var(--color-…)`, not hex. A color that arrives as data (a page accent, an event's or region's color) goes through `src/lib/color.ts`: `withAlpha` for tints, `accentText` for text in it, `readableOn` for text on it. |
|
||||
| The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. |
|
||||
| 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` | |
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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}`);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
34
server/src/migrations/053_us_spelling.sql
Normal file
34
server/src/migrations/053_us_spelling.sql
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 053 US SPELLING IN MESSAGES
|
||||
--
|
||||
-- The site is written in US English now. Two of 041's CHECKs are
|
||||
-- named with the sentence the admin shows when a save breaks them
|
||||
-- (admin-crud.js), and those said "colour"; the table is rebuilt to
|
||||
-- rename them, the same columns and rows as before.
|
||||
--
|
||||
-- events.status keeps the value 'cancelled': it's stored data, and
|
||||
-- the admin and the pages show it as "canceled".
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
CREATE TABLE site_setting_colors_new (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
settings_id TEXT NOT NULL REFERENCES site_settings (id) ON DELETE CASCADE,
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
token TEXT NOT NULL CHECK (token IN (
|
||||
'ink', 'body', 'muted', 'link', 'brand', 'action', 'action-hover',
|
||||
'surface', 'tint', 'tint-soft', 'danger', 'danger-tint')),
|
||||
light TEXT CONSTRAINT "A color must be written #rrggbb, eg. #0f7183."
|
||||
CHECK (light IS NULL OR (length(light) = 7 AND light GLOB '#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]')),
|
||||
dark TEXT CONSTRAINT "A dark color must be written #rrggbb, eg. #5ccbdc."
|
||||
CHECK (dark IS NULL OR (length(dark) = 7 AND dark GLOB '#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]')),
|
||||
UNIQUE (settings_id, token)
|
||||
) STRICT;
|
||||
|
||||
INSERT INTO site_setting_colors_new (id, settings_id, sort_order, token, light, dark)
|
||||
SELECT id, settings_id, sort_order, token, light, dark
|
||||
FROM site_setting_colors;
|
||||
|
||||
PRAGMA legacy_alter_table = ON;
|
||||
DROP TABLE site_setting_colors;
|
||||
ALTER TABLE site_setting_colors_new RENAME TO site_setting_colors;
|
||||
PRAGMA legacy_alter_table = OFF;
|
||||
|
|
@ -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 <style>.
|
||||
themeCss: themeCss(db),
|
||||
pages,
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ auth.get("/google/callback", async (c) => {
|
|||
deleteCookie(c, OAUTH_COOKIE, OAUTH_COOKIE_OPTIONS);
|
||||
|
||||
// Pressing Cancel on Google's screen comes back as ?error=.
|
||||
if (c.req.query("error")) return backToLogin(c, "cancelled");
|
||||
if (c.req.query("error")) return backToLogin(c, "canceled");
|
||||
|
||||
const code = c.req.query("code");
|
||||
if (!saved?.state || !code || c.req.query("state") !== saved.state) {
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ clips.get("/clips/:id/download", async (c) => {
|
|||
return streamFile(c, file, {
|
||||
type: audio ? "audio/mpeg" : "video/mp4",
|
||||
attachment: `${stem}-${job.id}.${audio ? "mp3" : "mp4"}`,
|
||||
// Only once the whole file has been read out: a cancelled
|
||||
// Only once the whole file has been read out: a canceled
|
||||
// download keeps it for another try.
|
||||
onComplete: () =>
|
||||
forgetDownloaded(db, job).catch((err) => console.warn(`clips: couldn't delete ${job.file}: ${err.message}`)),
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
An event's hosts are a list, in billing order, and each one is
|
||||
either an organization or a person, `kind` says which, and
|
||||
`org_kind` is there for the three organization routes. The
|
||||
first is the one the colour and logo fell back to, which is why
|
||||
first is the one the color and logo fell back to, which is why
|
||||
order is data and not a display choice.
|
||||
|
||||
Two things the team and award routes deliberately don't do:
|
||||
|
|
@ -439,7 +439,7 @@ function attachAwards(db, orgs) {
|
|||
|
||||
/* ── Events ────────────────────────────────────────────────────
|
||||
Flat, with the event scopes alongside. Retreats.tsx owns the
|
||||
band titles and colours and filters this list by scope_id.
|
||||
band titles and colors and filters this list by scope_id.
|
||||
|
||||
Oldest first, undated last. The carousel shows the list as it
|
||||
comes and opens on the first upcoming event, so past events
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
FEEDBACK ROUTE: the only public write on the site
|
||||
|
||||
Everything hostile that will ever reach this service arrives
|
||||
here, so the defences live here rather than being sprinkled
|
||||
here, so the defenses live here rather than being sprinkled
|
||||
around:
|
||||
|
||||
rate limit applied where this router is mounted (5/min)
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
rows, and for awards only public citations to published people
|
||||
(an award's page names its recipients whether they're listed or
|
||||
not, so the count does too). A count
|
||||
that disagreed with the page it summarises would be worse than
|
||||
that disagreed with the page it summarizes would be worse than
|
||||
none. 'manual' and 'years_since' read the row's own value.
|
||||
|
||||
── Countdown ──
|
||||
The pinned event if it is still published and not over, listed
|
||||
or not; otherwise the next published, listed, non-cancelled
|
||||
or not; otherwise the next published, listed, non-canceled
|
||||
event that hasn't ended. "Hasn't ended" is COALESCE(ends_on, starts_on) >= today,
|
||||
so a running series with a start date in the past still counts.
|
||||
The client works out the next meeting of a series from `series`.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
to MAX_FILES attachments. Stored as a feedback row of type
|
||||
'content' (046_content_requests.sql), files in Google Drive.
|
||||
|
||||
The same defences as the feedback route (honeypot, length caps,
|
||||
The same defenses as the feedback route (honeypot, length caps,
|
||||
a rate limit where it's mounted), plus: files are judged by their
|
||||
first bytes, not the name or type the browser claims, and nothing
|
||||
goes to Drive until everything else has passed.
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ const ALL_BLOCKS = [
|
|||
];
|
||||
|
||||
/* A record page's body: a handful of types, so it reads like a
|
||||
real page rather than a catalogue. */
|
||||
real page rather than a catalog. */
|
||||
const pageBody = (what) => [
|
||||
["heading", { text: `About this ${what}` }],
|
||||
["paragraph", { text: `This is **showcase data** for a ${what} page. Every field on the record is filled in, so anything left blank on the page is something the page doesn't draw.\n\nSee the [content block showcase](/blog/${POST_ID}) for every block type.` }],
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
THEME
|
||||
|
||||
The admin's palette (Panel → Site settings → Colours, table
|
||||
site_setting_colors) over the site's own colour tokens.
|
||||
The admin's palette (Panel → Site settings → Colors, table
|
||||
site_setting_colors) over the site's own color tokens.
|
||||
|
||||
The defaults are THEME_DEFAULTS (themeDefaults.js), which the
|
||||
build checks against src/index.css. A blank override keeps the
|
||||
|
|
@ -117,6 +117,6 @@ export function checkTheme(db) {
|
|||
}
|
||||
}
|
||||
if (problems.length) {
|
||||
throw new HttpError(422, `These colours would be hard to read: ${problems.join("; ")}.`);
|
||||
throw new HttpError(422, `These colors would be hard to read: ${problems.join("; ")}.`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
THEME DEFAULTS
|
||||
|
||||
The site's own colour tokens, light and dark: the one list both
|
||||
The site's own color tokens, light and dark: the one list both
|
||||
the server (theme.js: contrast check, overrides) and the admin
|
||||
(Site settings → Colours: defaults shown) read. No imports, so the
|
||||
(Site settings → Colors: defaults shown) read. No imports, so the
|
||||
browser bundle can take it too.
|
||||
|
||||
src/index.css holds the same values as CSS (@theme and its dark
|
||||
block), since CSS can't import this. The build checks the two
|
||||
agree and stops if they don't (themeDefaultsCheck in
|
||||
vite.config.ts). Change a colour here and there together.
|
||||
vite.config.ts). Change a color here and there together.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
// light dark
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
},
|
||||
"/qr": {
|
||||
"title": "QR Codes",
|
||||
"description": "Codes for flyers, slides and signs, pointing at any page on the site or any link, in your choice of colours."
|
||||
"description": "Codes for flyers, slides and signs, pointing at any page on the site or any link, in your choice of colors."
|
||||
},
|
||||
"/give": {
|
||||
"title": "Giving",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
NGU's dove, lifted from the original home page. The path and its
|
||||
two transforms are the drawing as exported, untouched; only the
|
||||
wrapper changed, sized by the caller, coloured by currentColor,
|
||||
wrapper changed, sized by the caller, colored by currentColor,
|
||||
and hidden from screen readers since it's decoration wherever
|
||||
it appears.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
LOGO
|
||||
|
||||
An <img> for a logo or mark that may not exist: no src, or a file
|
||||
that 404s, and it draws `fallback` instead (initials, a colour dot,
|
||||
that 404s, and it draws `fallback` instead (initials, a color dot,
|
||||
or nothing). `src` is already resolved (mediaUrl in media.ts). An
|
||||
upload loads its 640px copy first (useSmallImage). Decorative by
|
||||
default (alt ""), since a logo sits next to the name it stands for.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
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
|
||||
group map.
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
A QR code as an <svg>, sized by its container.
|
||||
|
||||
`centre` puts something on a badge over the middle: the NGU dove,
|
||||
`center` puts something on a badge over the middle: the NGU dove,
|
||||
or an image (an SVG from src/assets/qr, passed as a data: URL).
|
||||
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
|
||||
<svg> 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<SVGSVGElement>
|
||||
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({
|
|||
<rect width={total} height={total} fill={paper} />
|
||||
<path d={path} fill={ink} />
|
||||
|
||||
{centre && (
|
||||
{center && (
|
||||
<g shapeRendering="auto">
|
||||
<rect
|
||||
x={badgeAt}
|
||||
|
|
@ -98,17 +98,17 @@ export default function QrCode({
|
|||
stroke={ink}
|
||||
strokeWidth={0.35}
|
||||
/>
|
||||
{centre.kind === 'dove' ? (
|
||||
{center.kind === 'dove' ? (
|
||||
<DoveMark
|
||||
x={(total - doveWidth) / 2}
|
||||
y={(total - doveHeight) / 2}
|
||||
width={doveWidth}
|
||||
height={doveHeight}
|
||||
style={{ color: centre.color ?? QR_DOVE }}
|
||||
style={{ color: center.color ?? QR_DOVE }}
|
||||
/>
|
||||
) : (
|
||||
<image
|
||||
href={centre.src}
|
||||
href={center.src}
|
||||
x={(total - imageSize) / 2}
|
||||
y={(total - imageSize) / 2}
|
||||
width={imageSize}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
choice, else the system setting) so a dark visitor never sees a
|
||||
white flash. Pressing this makes an explicit choice and remembers
|
||||
it; until then the site follows the system, including a change
|
||||
made while the page is open. Colours come from the tokens in
|
||||
made while the page is open. Colors come from the tokens in
|
||||
index.css.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ const inputLocked =
|
|||
|
||||
/* ── Dotted paths ────────────────────────────────────────────── */
|
||||
|
||||
/* What an empty colour field shows in its swatch and placeholder:
|
||||
/* What an empty color field shows in its swatch and placeholder:
|
||||
the field's own default (a value, or one worked out from the row),
|
||||
else the brand teal. */
|
||||
function colorPlaceholder(field, row): string {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
sends it (FeedbackForm's fixedType), with an email required.
|
||||
|
||||
'general' isn't offered anywhere; it's the server's fallback for
|
||||
a type it doesn't recognise, so old rows still read sensibly.
|
||||
a type it doesn't recognize, so old rows still read sensibly.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export const FEEDBACK_TYPES = [
|
||||
|
|
|
|||
|
|
@ -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%;
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export const organizations = {
|
|||
{ 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 },
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 },
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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)'
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
Turns the link an admin pastes into the URL an <iframe> can
|
||||
load. People paste the page they're looking at (a YouTube watch
|
||||
or live link, a Facebook video, a Vimeo page), not the embed
|
||||
form, so those are recognised and rewritten. Anything else that
|
||||
form, so those are recognized and rewritten. Anything else that
|
||||
is https is assumed to already be an embed URL and passed
|
||||
through; anything that isn't https is refused, so the hero never
|
||||
frames a plain-http or javascript: URL.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
What this is not: event_scopes. A scope owns presentation:
|
||||
Retreats.tsx keys its title, accent and background on the id, so
|
||||
an unrecognised scope_id makes an event vanish with no error,
|
||||
an unrecognized scope_id makes an event vanish with no error,
|
||||
which is why that one is a real table with a real foreign key. A
|
||||
type carries no presentation of its own and an unknown value
|
||||
renders as its own name, so a CHECK is enough.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
── On missing ids ──
|
||||
Every builder takes an id the caller believed it had. When it
|
||||
doesn't, the old behaviour was to interpolate the string
|
||||
doesn't, the old behavior was to interpolate the string
|
||||
"undefined" into a path, render a link to it, mount a page and
|
||||
fetch /api/organizations/undefined, four steps between the
|
||||
mistake and any sign of it, none of which name the component
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
const { organizations } = useOrganizations("partner");
|
||||
const { organizations } = useOrganizations(); // all
|
||||
|
||||
Every organization has the same card surface, name, colour,
|
||||
Every organization has the same card surface, name, color,
|
||||
logo, description, links. What differs by kind sits under
|
||||
`details`, so a list component can render the common parts
|
||||
without knowing what it's holding:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function qrMatrix(text: string, level: QrLevel): QrMatrix {
|
|||
return { size: modules.size, dark: (row, col) => modules.get(row, col) === 1 }
|
||||
}
|
||||
|
||||
/* The dark modules as one SVG path, a run of horizontal neighbours
|
||||
/* The dark modules as one SVG path, a run of horizontal neighbors
|
||||
per subpath, offset by the quiet zone. One element instead of a
|
||||
rect per module keeps the markup (and the SVG download) small. */
|
||||
export function qrPath(matrix: QrMatrix, margin: number): string {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
const { data, error, loading } = useResource("/events");
|
||||
|
||||
Note the `ignore` flag rather than an AbortController: the
|
||||
request is shared and cached, so cancelling it would throw away
|
||||
request is shared and cached, so canceling it would throw away
|
||||
work another component may still want. We just stop writing
|
||||
state after unmount.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ function RecipientRow({ recipient, accent }: { recipient: Recipient; accent: str
|
|||
|
||||
/* awarded_on may be a partial date, so this takes the leading year
|
||||
rather than parsing. A full date would be false precision on a
|
||||
row backfilled from a programme booklet. */
|
||||
row backfilled from a program booklet. */
|
||||
function year(date?: string | null): string | null {
|
||||
if (!date) return null
|
||||
const match = /^(\d{4})/.exec(date)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ const ROLE_LABEL: Record<string, string> = {
|
|||
const STATUS_LABEL: Record<string, string> = {
|
||||
upcoming: 'Upcoming',
|
||||
past: 'Past',
|
||||
cancelled: 'Cancelled',
|
||||
cancelled: 'Canceled',
|
||||
}
|
||||
|
||||
export default function EventDetail() {
|
||||
|
|
@ -131,7 +131,7 @@ export default function EventDetail() {
|
|||
},
|
||||
]
|
||||
|
||||
// A cancelled series has no next meeting, whatever its dates say.
|
||||
// A canceled series has no next meeting, whatever its dates say.
|
||||
const upcoming =
|
||||
event.status === 'cancelled'
|
||||
? []
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const SECTIONS = [
|
|||
id: 'make',
|
||||
title: 'Make a QR code',
|
||||
blurb:
|
||||
'Pick a page from the main navigation, any event, organization, team, award, person or blog post, or type any link. Site pages always point at the live site. Choose what sits in the centre and the colours; a warning shows if the code might not scan.',
|
||||
'Pick a page from the main navigation, any event, organization, team, award, person or blog post, or type any link. Site pages always point at the live site. Choose what sits in the center and the colors; a warning shows if the code might not scan.',
|
||||
accent: BRAND,
|
||||
background: 'var(--color-tint)',
|
||||
content: (
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ function RequestFiles({ row, canWrite, canRemove }) {
|
|||
);
|
||||
}
|
||||
|
||||
/* A content request's details (049), labelled from requestTypes.ts;
|
||||
/* A content request's details (049), labeled from requestTypes.ts;
|
||||
keys it no longer knows are shown as they are. */
|
||||
function RequestDetails({ row }) {
|
||||
const entries = Object.entries(row.details ?? {});
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ export default function AdminLayout() {
|
|||
</div>
|
||||
|
||||
{/* 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 && (
|
||||
<div className="border-t border-brand/10 bg-tint-soft">
|
||||
<div className="mx-auto flex max-w-5xl flex-wrap gap-6 px-6 py-2.5 text-sm">
|
||||
|
|
|
|||
|
|
@ -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<string, string> = {
|
||||
cancelled: "Google sign-in was cancelled.",
|
||||
canceled: "Google sign-in was canceled.",
|
||||
expired: "That sign-in took too long or was already used. Try again.",
|
||||
no_account:
|
||||
"There's no admin account for that Google account. Ask a superadmin to add your email.",
|
||||
|
|
|
|||
|
|
@ -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("-")}-`
|
||||
: "";
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<Link
|
||||
|
|
@ -585,7 +585,7 @@ function Bar({ seg, accent }: { seg: Segment; accent: string }) {
|
|||
className={`pointer-events-auto flex items-center gap-1 truncate px-2 text-xs font-semibold text-white transition-[filter] hover:brightness-110 ${
|
||||
seg.continuesBefore ? 'ml-0 rounded-l-none' : 'ml-1 rounded-l-md'
|
||||
} ${seg.continuesAfter ? 'mr-0 rounded-r-none' : 'mr-1 rounded-r-md'} ${
|
||||
cancelled ? 'line-through opacity-60' : ''
|
||||
canceled ? 'line-through opacity-60' : ''
|
||||
}`}
|
||||
style={{
|
||||
gridColumn: `${seg.col + 1} / span ${seg.span}`,
|
||||
|
|
@ -711,7 +711,7 @@ function EventLine({ item, accent }: { item: Occurrence; accent: string }) {
|
|||
const { event } = item
|
||||
const color = event.color || accent
|
||||
const where = event.location_label || (event.is_online ? 'Online' : null)
|
||||
const cancelled = event.status === 'cancelled'
|
||||
const canceled = event.status === 'cancelled'
|
||||
|
||||
return (
|
||||
<Link
|
||||
|
|
@ -720,9 +720,9 @@ function EventLine({ item, accent }: { item: Occurrence; accent: string }) {
|
|||
>
|
||||
<span className="mt-1.5 h-3 w-3 shrink-0 rounded-full" style={{ background: color }} aria-hidden="true" />
|
||||
<span className="min-w-0">
|
||||
<span className={`block font-semibold group-hover:underline ${cancelled ? 'line-through' : ''}`}>
|
||||
<span className={`block font-semibold group-hover:underline ${canceled ? 'line-through' : ''}`}>
|
||||
{event.title}
|
||||
{cancelled && <span className="ml-2 text-xs font-bold uppercase text-danger no-underline">Cancelled</span>}
|
||||
{canceled && <span className="ml-2 text-xs font-bold uppercase text-danger no-underline">Canceled</span>}
|
||||
</span>
|
||||
<span className="block text-sm" style={{ color: BODY }}>
|
||||
{[
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import { accentText, withAlpha, readableOn, BRAND } from '../../lib/color.ts'
|
|||
fires only for an event with no host at all. */
|
||||
const DEFAULT_ORG_LOGO = null;
|
||||
|
||||
const INK = "var(--color-ink)"; // button text: the card colour is only a border
|
||||
const INK = "var(--color-ink)"; // button text: the card color is only a border
|
||||
const CARD_BG = "var(--color-surface)"; // sits under every card, photo or not
|
||||
|
||||
/* Laid over a card's background image so black text reads on any
|
||||
|
|
@ -186,7 +186,7 @@ export function Card({
|
|||
filter: past ? "saturate(0.75)" : "none",
|
||||
pointerEvents: interactive ? "auto" : "none",
|
||||
}}
|
||||
// A card shown but not in play (a carousel neighbour, a collapsed
|
||||
// A card shown but not in play (a carousel neighbor, a collapsed
|
||||
// past event) keeps its links out of the tab order too.
|
||||
inert={!interactive}
|
||||
>
|
||||
|
|
@ -277,7 +277,7 @@ export function Card({
|
|||
compact ? "gap-2" : "gap-3"
|
||||
} ${links.length === 0 ? "mt-4" : ""}`}
|
||||
>
|
||||
{/* Button text takes the card's colour (the event's own,
|
||||
{/* Button text takes the card's color (the event's own,
|
||||
or the band's default, teal unless the page sets one),
|
||||
the same as the border, rather than the card's black. */}
|
||||
{links.map(item => (
|
||||
|
|
@ -464,7 +464,7 @@ export default function EventListCards({
|
|||
);
|
||||
|
||||
/* Open on the first upcoming event. The list is empty on the
|
||||
first render, so this can't be a useState initialiser, it has
|
||||
first render, so this can't be a useState initializer, it has
|
||||
to wait for the data and then run once. Clearing the guard when
|
||||
the list empties means a refetch re-seeds. */
|
||||
const seeded = useRef(false);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { scrollBehavior } from "../../lib/motion.ts";
|
|||
|
||||
Filtered to groups, and unlike the other sections that isn't
|
||||
a prop. A map only makes sense for organizations that sit
|
||||
somewhere, and it reads regions off the same data to colour the
|
||||
somewhere, and it reads regions off the same data to color the
|
||||
tiles, so "plot partners instead" isn't a filter change, it's a
|
||||
different component. Named for the view rather than the filter
|
||||
so that stays visible.
|
||||
|
|
@ -49,7 +49,7 @@ const INK = "var(--color-body)";
|
|||
const FALLBACK_COLOR = "#4a6b72";
|
||||
|
||||
/* organizations.color is nullable; an SVG fill left undefined paints
|
||||
black, so an uncoloured region takes the same fallback as a card. */
|
||||
black, so an uncolored region takes the same fallback as a card. */
|
||||
const colorOf = (item) => item.color || FALLBACK_COLOR;
|
||||
|
||||
const US_TITLE = "US Unity Regions";
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import { accentText } from '../../lib/color.ts'
|
|||
A stack of organizations, each collapsed to a line and
|
||||
expandable for the rest. Every row carries two ways out: an
|
||||
arrow through to that organization's page on this site, and a
|
||||
labelled button out to its own site when it has one.
|
||||
labeled button out to its own site when it has one.
|
||||
|
||||
Nothing here is region-specific. It asks for a kind and renders
|
||||
what comes back, so the same section lists partners or groups
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
Which the page or record itself
|
||||
Section for a main page with a subnav, optionally one of
|
||||
its #sections
|
||||
Centre nothing, the NGU dove, or any SVG in
|
||||
Center nothing, the NGU dove, or any SVG in
|
||||
src/assets/qr (drop a file there and it's offered;
|
||||
it's embedded in the code, so downloads carry it)
|
||||
Colours the code, its background, and the dove. A warning
|
||||
Colors the code, its background, and the dove. A warning
|
||||
appears when the pair is unlikely to scan: too
|
||||
little contrast, or a light code on a dark ground
|
||||
|
||||
|
|
@ -27,13 +27,13 @@
|
|||
Codes point at SITE_ORIGIN, never at wherever this page is open,
|
||||
so one made on localhost still works on a poster.
|
||||
|
||||
Downloads are the on-screen <svg> itself: serialised for the SVG,
|
||||
Downloads are the on-screen <svg> itself: serialized for the SVG,
|
||||
drawn onto a canvas for the PNG. Neither needs a server.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||
|
||||
import QrCode, { QR_DOVE, QR_INK, QR_PAPER, type QrCentre } from '../../components/QrCode.tsx'
|
||||
import QrCode, { QR_DOVE, QR_INK, QR_PAPER, type QrCenter } from '../../components/QrCode.tsx'
|
||||
import { NAV_ACTIONS, PAGE_LINKS, PAGE_SECTIONS } from '../../navConfig.ts'
|
||||
import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts'
|
||||
import { siteUrl } from '../../lib/site.ts'
|
||||
|
|
@ -59,31 +59,31 @@ const KINDS: Array<[Kind, string]> = [
|
|||
['custom', 'A link I type'],
|
||||
]
|
||||
|
||||
/* The centres on offer: the dove, then every SVG in src/assets/qr,
|
||||
/* The centers on offer: the dove, then every SVG in src/assets/qr,
|
||||
named after its file ("ngu-circle.svg" → "Ngu circle"). Read as
|
||||
text and turned into data: URLs so they sit inside the code's own
|
||||
SVG. */
|
||||
const CENTRE_FILES = import.meta.glob<string>('../../assets/qr/*.svg', {
|
||||
const CENTER_FILES = import.meta.glob<string>('../../assets/qr/*.svg', {
|
||||
eager: true,
|
||||
query: '?raw',
|
||||
import: 'default',
|
||||
})
|
||||
|
||||
type CentreOption = { id: string; label: string; centre: (dove: string) => QrCentre }
|
||||
type CenterOption = { id: string; label: string; center: (dove: string) => QrCenter }
|
||||
|
||||
const toDataUrl = (svg: string) =>
|
||||
`data:image/svg+xml;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(svg)))}`
|
||||
|
||||
const CENTRES: CentreOption[] = [
|
||||
{ id: 'none', label: 'Nothing', centre: () => null },
|
||||
{ id: 'dove', label: 'NGU dove', centre: (color) => ({ kind: 'dove', color }) },
|
||||
...Object.entries(CENTRE_FILES)
|
||||
const CENTERS: CenterOption[] = [
|
||||
{ id: 'none', label: 'Nothing', center: () => null },
|
||||
{ id: 'dove', label: 'NGU dove', center: (color) => ({ kind: 'dove', color }) },
|
||||
...Object.entries(CENTER_FILES)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([path, svg]) => {
|
||||
const name = path.split('/').pop()!.replace(/\.svg$/i, '')
|
||||
const label = name.replace(/[-_]+/g, ' ').replace(/^./, (c) => c.toUpperCase())
|
||||
const src = toDataUrl(svg)
|
||||
return { id: `file:${name}`, label, centre: () => ({ kind: 'image', src }) as QrCentre }
|
||||
return { id: `file:${name}`, label, center: () => ({ kind: 'image', src }) as QrCenter }
|
||||
}),
|
||||
]
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ export default function QrCodeMaker() {
|
|||
const [path, setPath] = useState('/')
|
||||
const [section, setSection] = useState('')
|
||||
const [custom, setCustom] = useState('')
|
||||
const [centreId, setCentreId] = useState('dove')
|
||||
const [centerId, setCenterId] = useState('dove')
|
||||
const [ink, setInk] = useState(QR_INK)
|
||||
const [paper, setPaper] = useState(QR_PAPER)
|
||||
const [doveColor, setDoveColor] = useState(QR_DOVE)
|
||||
|
|
@ -283,8 +283,8 @@ export default function QrCodeMaker() {
|
|||
const target = kind === 'custom' ? typed : selected ? `${selected.path}${section}` : null
|
||||
const url = kind === 'custom' ? typed : target ? siteUrl(target) : null
|
||||
|
||||
const centreOption = CENTRES.find((c) => c.id === centreId) ?? CENTRES[0]
|
||||
const centre = centreOption.centre(doveColor)
|
||||
const centerOption = CENTERS.find((c) => c.id === centerId) ?? CENTERS[0]
|
||||
const center = centerOption.center(doveColor)
|
||||
const warning = scanWarning(ink, paper)
|
||||
|
||||
useEffect(() => setCopied(false), [url])
|
||||
|
|
@ -381,8 +381,8 @@ export default function QrCodeMaker() {
|
|||
</Select>
|
||||
)}
|
||||
|
||||
<Select id="qr-centre" label="In the centre" value={centreId} onChange={setCentreId}>
|
||||
{CENTRES.map((c) => (
|
||||
<Select id="qr-center" label="In the center" value={centerId} onChange={setCenterId}>
|
||||
{CENTERS.map((c) => (
|
||||
<option key={c.id} value={c.id}>
|
||||
{c.label}
|
||||
</option>
|
||||
|
|
@ -390,12 +390,12 @@ export default function QrCodeMaker() {
|
|||
</Select>
|
||||
|
||||
<fieldset>
|
||||
<legend className="text-sm font-medium text-body">Colours</legend>
|
||||
<legend className="text-sm font-medium text-body">Colors</legend>
|
||||
<div className="mt-2 flex flex-wrap items-end gap-5">
|
||||
<ColourInput id="qr-ink" label="Code" value={ink} onChange={setInk} />
|
||||
<ColourInput id="qr-paper" label="Background" value={paper} onChange={setPaper} />
|
||||
{centreOption.id === 'dove' && (
|
||||
<ColourInput id="qr-dove" label="Dove" value={doveColor} onChange={setDoveColor} />
|
||||
<ColorInput id="qr-ink" label="Code" value={ink} onChange={setInk} />
|
||||
<ColorInput id="qr-paper" label="Background" value={paper} onChange={setPaper} />
|
||||
{centerOption.id === 'dove' && (
|
||||
<ColorInput id="qr-dove" label="Dove" value={doveColor} onChange={setDoveColor} />
|
||||
)}
|
||||
{(ink !== QR_INK || paper !== QR_PAPER || doveColor !== QR_DOVE) && (
|
||||
<button
|
||||
|
|
@ -408,7 +408,7 @@ export default function QrCodeMaker() {
|
|||
className="pb-2 text-sm underline"
|
||||
style={{ color: accentText(BRAND) }}
|
||||
>
|
||||
Reset colours
|
||||
Reset colors
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -446,7 +446,7 @@ export default function QrCodeMaker() {
|
|||
<QrCode
|
||||
ref={svgRef}
|
||||
value={url}
|
||||
centre={centre}
|
||||
center={center}
|
||||
ink={ink}
|
||||
paper={paper}
|
||||
label={`QR code for ${url}`}
|
||||
|
|
@ -490,8 +490,8 @@ const inputClass =
|
|||
'w-full rounded-xl border border-muted/50 bg-surface px-4 py-3 text-body ' +
|
||||
'outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25'
|
||||
|
||||
/* A colour well with its hex beside it, both editable. */
|
||||
function ColourInput({
|
||||
/* A color well with its hex beside it, both editable. */
|
||||
function ColorInput({
|
||||
id,
|
||||
label,
|
||||
value,
|
||||
|
|
@ -519,7 +519,7 @@ function ColourInput({
|
|||
/>
|
||||
<input
|
||||
type="text"
|
||||
aria-label={`${label} colour, as hex`}
|
||||
aria-label={`${label} color, as hex`}
|
||||
value={text}
|
||||
onChange={(e) => {
|
||||
setText(e.target.value)
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
Backdrop, what fills the background:
|
||||
|
||||
brand drifting colour and slow concentric rings (many
|
||||
circles, one centre) with the dove at that centre
|
||||
brand drifting color and slow concentric rings (many
|
||||
circles, one center) with the dove at that center
|
||||
photos the hero photos, crossfading with a slow zoom, a
|
||||
progress bar per photo and a pause button (anything
|
||||
that moves on its own for more than five seconds
|
||||
|
|
@ -222,7 +222,7 @@ function BrandBackdrop() {
|
|||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
{/* The rings are faint; the dove at their centre is not, so
|
||||
{/* The rings are faint; the dove at their center is not, so
|
||||
the opacity sits on the rings rather than the whole SVG. */}
|
||||
<g opacity="0.16">
|
||||
<g className="hp-rings" fill="none" stroke="#ffffff">
|
||||
|
|
@ -239,7 +239,7 @@ function BrandBackdrop() {
|
|||
</g>
|
||||
|
||||
{/* Outside the rotating groups, so it stays upright while the
|
||||
rings turn around it. 64 × 42.7 at the centre fits inside
|
||||
rings turn around it. 64 × 42.7 at the center fits inside
|
||||
the innermost ring (r 40) with room to float. */}
|
||||
<circle cx="200" cy="200" r="46" fill="url(#hp-dove-glow)" />
|
||||
<g className="hp-dove" style={{ color: '#ffffff' }} opacity="0.9">
|
||||
|
|
@ -451,7 +451,7 @@ function VideoFrame({
|
|||
/* ── Featured event ──────────────────────────────────────────── */
|
||||
|
||||
/* The event's own card for the hero: its background photo (or its
|
||||
colour), then what, when and where, then its buttons and a way
|
||||
color), then what, when and where, then its buttons and a way
|
||||
to its page. The first action link is the filled button, since
|
||||
it's usually Register. */
|
||||
function EventPanel({ event }: { event: HeroEvent }) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ type PathfinderProps = {
|
|||
paths: FrontPagePath[]
|
||||
}
|
||||
|
||||
/* One accent per position, cycling. Paths are data; colour is
|
||||
/* One accent per position, cycling. Paths are data; color is
|
||||
presentation, so it's assigned here rather than stored. */
|
||||
/* A path's icon: a key from src/data/pathIcons.ts, drawn from
|
||||
Phosphor. A path saved before the list existed may hold an emoji;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
to { transform: translate(-10%, -15%) scale(1.2); }
|
||||
}
|
||||
|
||||
/* Concentric rings: many circles, one centre. */
|
||||
/* Concentric rings: many circles, one center. */
|
||||
.hp-rings {
|
||||
animation: hp-spin 90s linear infinite;
|
||||
transform-origin: 50% 50%;
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* The dove at the rings' centre bobs gently rather than turning. */
|
||||
/* The dove at the rings' center bobs gently rather than turning. */
|
||||
.hp-dove {
|
||||
animation: hp-bob 6s ease-in-out infinite;
|
||||
transform-box: fill-box;
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ function siteConfigurationPlugin(config: SiteConfiguration): Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
/* The colour tokens exist twice: as data in server/src/themeDefaults.js
|
||||
/* The color tokens exist twice: as data in server/src/themeDefaults.js
|
||||
(the admin's defaults, the contrast check) and as CSS in
|
||||
src/index.css (what pages draw with). This stops the build, and the
|
||||
dev server, when the two disagree, naming each difference. */
|
||||
|
|
@ -231,7 +231,7 @@ function themeDefaultsCheck(): Plugin {
|
|||
}
|
||||
if (problems.length) {
|
||||
this.error(
|
||||
`Colour tokens disagree between src/index.css and server/src/themeDefaults.js:\n ${problems.join('\n ')}`,
|
||||
`Color tokens disagree between src/index.css and server/src/themeDefaults.js:\n ${problems.join('\n ')}`,
|
||||
)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue