From c74ad746f5b7344aad1a9e8c43c004ed2772a71b Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Mon, 28 Sep 2026 22:42:59 -0500 Subject: [PATCH] Add colour tokens, dark mode and drop gradients - Colour tokens in index.css named by role (ink, body, muted, link, brand, action, surface, tint, danger), used everywhere instead of hex - Dark mode: follows the system, a header toggle (site and admin) overrides it and is remembered; set before first paint in index.html - Data colours go through src/lib/color.ts: withAlpha for tints, accentText (lighter on dark) for text in an accent, readableOn for text on one, so an admin's pale colour still reads - Migration 040 drops events.gradient: a card is its photo or plain, with its colour as the border; other decorative gradients are solid - The countdown and a hero event without a photo mix their colour toward ink behind white text Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 1 + docs/updating-data-in-code.md | 1 + index.html | 9 +++ server/src/admin-schema.js | 1 - .../migrations/040_drop_event_gradient.sql | 12 +++ server/src/routes/content.js | 1 - server/src/seed-showcase.js | 1 - src/components/ContentBlocks.tsx | 21 ++--- src/components/FeaturedCards.tsx | 12 +-- src/components/InlineText.tsx | 3 +- src/components/Layout.tsx | 5 +- src/components/LegalText.tsx | 4 +- src/components/PageShell.tsx | 13 +-- src/components/PageState.tsx | 13 +-- src/components/PeopleTiles.css | 16 ++-- src/components/PrivacyNotice.tsx | 6 +- src/components/ScheduleBlock.tsx | 31 +++---- src/components/ThemeToggle.tsx | 79 ++++++++++++++++++ src/components/VideoPlayer.tsx | 2 +- src/components/admin/MediaLibrary.tsx | 46 +++++------ src/components/admin/SectionNav.tsx | 18 ++--- src/components/admin/fields.tsx | 80 +++++++++---------- src/index.css | 74 ++++++++++++++++- src/lib/adminSchema.ts | 1 - src/lib/auth.tsx | 2 +- src/lib/color.ts | 39 +++++++++ src/lib/useContent.ts | 1 - src/pages/AwardDetail.tsx | 11 +-- src/pages/BlogPost.tsx | 11 +-- src/pages/Community.tsx | 8 +- src/pages/EventDetail.tsx | 25 +++--- src/pages/Feedback.tsx | 2 +- src/pages/Giving.tsx | 2 +- src/pages/History.tsx | 8 +- src/pages/Home.tsx | 4 +- src/pages/Leadership.tsx | 8 +- src/pages/OrganizationDetail.tsx | 35 ++++---- src/pages/PersonDetail.tsx | 25 +++--- src/pages/Privacy.tsx | 6 +- src/pages/QrCodes.tsx | 2 +- src/pages/Resources.tsx | 6 +- src/pages/Retreats.tsx | 12 +-- src/pages/TeamDetail.tsx | 11 +-- src/pages/Terms.tsx | 4 +- src/pages/admin/AdminClips.tsx | 55 ++++++------- src/pages/admin/AdminFeedback.tsx | 64 +++++++-------- src/pages/admin/AdminHome.tsx | 38 ++++----- src/pages/admin/AdminLayout.tsx | 36 +++++---- src/pages/admin/AdminLogin.tsx | 30 +++---- src/pages/admin/AdminMedia.tsx | 28 +++---- src/pages/admin/AdminPanel.tsx | 52 ++++++------ src/pages/admin/EntityEdit.tsx | 34 ++++---- src/pages/admin/EntityList.tsx | 30 +++---- src/pages/sections/CommunityBlog.tsx | 21 ++--- src/pages/sections/EventCalendar.tsx | 59 +++++++------- src/pages/sections/EventList-Cards.tsx | 34 ++++---- src/pages/sections/FeedbackForm.tsx | 59 +++++++------- src/pages/sections/OrgList-Card.tsx | 11 +-- src/pages/sections/OrgList-Map.tsx | 23 +++--- src/pages/sections/OrgList-Vertical.tsx | 11 +-- src/pages/sections/QrCodeMaker.tsx | 41 +++++----- src/pages/sections/history/timeline.css | 22 ++--- src/pages/sections/home/CalendarBand.tsx | 6 +- src/pages/sections/home/FeaturedBand.tsx | 6 +- .../sections/home/FeaturedTimelineRail.tsx | 31 +++---- src/pages/sections/home/HeroStage.tsx | 9 ++- .../sections/home/NextEventCountdown.tsx | 13 +-- src/pages/sections/home/Pathfinder.tsx | 27 ++++--- src/pages/sections/home/RetreatsBand.tsx | 11 +-- src/pages/sections/home/StatsBand.tsx | 2 +- 70 files changed, 829 insertions(+), 596 deletions(-) create mode 100644 server/src/migrations/040_drop_event_gradient.sql create mode 100644 src/components/ThemeToggle.tsx create mode 100644 src/lib/color.ts diff --git a/CLAUDE.md b/CLAUDE.md index 82d4c0f..790b523 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -66,6 +66,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.** 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`. - **No em-dashes** (U+2014) anywhere: UI text, help text, comments, docs, commit messages. Use a colon, comma or parentheses. An empty table cell shows `-`. - **Admin editor text:** blank select options read `Default: …` (what blank means), examples in help text start with `eg.`, and record ids are called "URL ID". Cut-off preview text uses `preview()` from `src/lib/text.ts`, which ends it with an ellipsis. See `docs/updating-data-in-code.md`. diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index 7e99a0e..3593c64 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -274,6 +274,7 @@ The numbers band's "Number Source" dropdown works the same way: | 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). | | 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. | +| The site's colours, light and dark | `src/index.css` (`@theme` tokens and the dark overrides under them) | 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. | | 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` | | diff --git a/index.html b/index.html index d51965e..c10f0c2 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,15 @@ <!-- site:title --> + + diff --git a/server/src/admin-schema.js b/server/src/admin-schema.js index 72935f7..b25e2aa 100644 --- a/server/src/admin-schema.js +++ b/server/src/admin-schema.js @@ -378,7 +378,6 @@ const events = { text("org_logo"), text("event_logo"), text("color"), - text("gradient"), text("card_image"), bool("is_published"), bool("is_listed"), diff --git a/server/src/migrations/040_drop_event_gradient.sql b/server/src/migrations/040_drop_event_gradient.sql new file mode 100644 index 0000000..3282ab1 --- /dev/null +++ b/server/src/migrations/040_drop_event_gradient.sql @@ -0,0 +1,12 @@ +-- ═══════════════════════════════════════════════════════════════ +-- 040 NO MORE CARD GRADIENTS +-- +-- An event card is its photo (card_image) under a light veil, or a +-- plain card, always with the event's colour as its border. The +-- gradient layer went over the photo and hid it, and gradients are +-- leaving the design, so the column goes. Any gradient saved on an +-- event is dropped with it; the card falls back to its photo or the +-- plain surface. +-- ═══════════════════════════════════════════════════════════════ + +ALTER TABLE events DROP COLUMN gradient; diff --git a/server/src/routes/content.js b/server/src/routes/content.js index a8dd3f6..e232246 100644 --- a/server/src/routes/content.js +++ b/server/src/routes/content.js @@ -147,7 +147,6 @@ function shapeEvent(row, links, cardBlocks, hosts = []) { org_logo: row.effective_org_logo, event_logo: row.event_logo, color: row.effective_color, - gradient: row.gradient, card_image: row.card_image, hosts: hosts.map(shapeHost), diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js index 41bcb3b..c592ed9 100644 --- a/server/src/seed-showcase.js +++ b/server/src/seed-showcase.js @@ -352,7 +352,6 @@ tx(db, () => { org_logo: IMAGE, event_logo: IMAGE, color: "#d62976", - gradient: "linear-gradient(160deg, rgba(214,41,118,0.10), rgba(19,139,160,0.10))", card_image: IMAGE, is_published: 1, is_listed: LISTED, diff --git a/src/components/ContentBlocks.tsx b/src/components/ContentBlocks.tsx index 30d3199..71d80c8 100644 --- a/src/components/ContentBlocks.tsx +++ b/src/components/ContentBlocks.tsx @@ -38,8 +38,9 @@ import type { ContentBlock } from '../lib/useContent.ts' import { Anchor, Inline, Paragraphs } from './InlineText.tsx' import VideoPlayer from './VideoPlayer.tsx' import ScheduleBlock from './ScheduleBlock.tsx' +import { accentText } from '../lib/color.ts' -const BODY = '#4a6b72' +const BODY = 'var(--color-muted)' export default function ContentBlocks({ blocks, @@ -76,14 +77,14 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) { switch (block.type) { case 'heading': return ( -

+

{text}

) case 'subheading': return ( -

+

{text}

) @@ -93,12 +94,12 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {