Design overhaul (v1.10.0 to v1.10.2) #18

Merged
ngu-git-admin merged 17 commits from design-overhaul into main 2026-09-30 23:59:16 +01:00
4 changed files with 154 additions and 98 deletions
Showing only changes of commit 2df908f7c4 - Show all commits

View file

@ -277,7 +277,7 @@ The numbers band's "Number Source" dropdown works the same way:
| 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 site's colors, light and dark | the database over `src/index.css` | Admin → Panel → Site settings → Colors (superadmins): pick a color, set its light and/or dark value; saving refuses anything that makes text hard to read. The defaults are `THEME_DEFAULTS` in `server/src/themeDefaults.js` (the admin and the contrast check read it) and the same values as CSS in `src/index.css`; the build stops if the two differ. The admin's labels for them are `THEME_LABELS` in `src/lib/adminSchema/siteSettings.ts`. Change a token's value in both modes and every use follows. Use the token utilities (`text-muted`, `bg-surface`, `border-brand/20`) or `var(--color-…)`, not hex. A color that arrives as data (a page accent, an event's or region's color) goes through `src/lib/color.ts`: `withAlpha` for tints, `accentText` for text in it, `readableOn` for text on it. |
| The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. | | The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. |
| A page section's accent 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. | | 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. |
| The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's circles and tones are in `src/components/PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. | | The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. |
| Timeline leaf colors (green now, autumn going back) | `leafColor` in `src/lib/color.ts` | The green, gold and autumn stops, and `LEAF_TURNED_BY` (2000), the year before which every leaf is fully turned. | | Timeline leaf colors (green now, autumn going back) | `leafColor` in `src/lib/color.ts` | The green, gold and autumn stops, and `LEAF_TURNED_BY` (2000), the year before which every leaf is fully turned. |
| Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. | | Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. | | Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |

View file

@ -163,7 +163,7 @@ export default function Layout() {
// container, and then nothing inside it can be position: sticky // container, and then nothing inside it can be position: sticky
// (a blog post's contents column scrolled away with the page). // (a blog post's contents column scrolled away with the page).
<div <div
className="relative min-h-screen overflow-x-clip" className="min-h-screen overflow-x-clip"
style={{ "--header-h": `${headerHeight}px` } as React.CSSProperties} style={{ "--header-h": `${headerHeight}px` } as React.CSSProperties}
> >
<a <a

View file

@ -1,93 +1,84 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
PAGE BACKDROP: the circles and their tones (PageBackdrop.tsx) PAGE BACKDROP: the circles, their layers and shades
(PageBackdrop.tsx places them)
Flat fills only: no blur, no gradient, no glow. Light mode uses Flat fills only: no blur, no gradient, no glow. Light mode uses
the palette's four palest shades, dark mode its dark shades at the palette's four palest shades at 60%, dark mode its dark
45% opacity over the ink background. Every text token reads at shades (two deepened a step) at 30% over the ink background.
4.5:1 or better on any of them, even where three overlap (the Every text token reads at 4.5:1 or better on each shade even at
lowest, 4.8:1, is the danger red in dark mode). full strength, so however many circles overlap, text stays
readable (the lowest, 4.66:1, is the danger red on #004552).
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
/* Spans the whole page (Layout's root is its containing block), so
the section circles sit at points down the document; the window
layer inside it is fixed. */
.page-backdrop { .page-backdrop {
position: absolute;
inset: 0;
z-index: -1;
overflow: hidden; /* the section circles, never the fixed layer */
pointer-events: none;
--pb-opacity: 0.7;
--pb-a: #c2f6ff;
--pb-b: #dfebd6;
--pb-c: #c2ffd6;
--pb-d: #c2fbff;
--pb-e: #dfebd6;
}
.page-backdrop__window {
position: fixed; position: fixed;
inset: 0; inset: 0;
z-index: -1;
overflow: hidden; overflow: hidden;
pointer-events: none;
--pb-opacity: 0.6;
--pb-0: #c2f6ff;
--pb-1: #dfebd6;
--pb-2: #c2ffd6;
--pb-3: #c2fbff;
} }
/* A circle's place: across by its left, down its layer's whole
travel (the window plus how far the layer rises), centered on
that point. */
.page-backdrop__circle { .page-backdrop__circle {
position: absolute; position: absolute;
width: var(--pb-size);
height: var(--pb-size);
top: calc(var(--pb-top) * (100vh + var(--pb-scroll, 0px) * var(--pb-speed)) - var(--pb-size) / 2);
border-radius: 50%; border-radius: 50%;
opacity: var(--pb-opacity); opacity: var(--pb-opacity);
transition: background-color 1.4s cubic-bezier(0.16, 1, 0.3, 1); transition: background-color 2.4s ease-in-out;
} }
/* Slow: fixed to the window. */ /* Each layer rises by its share of the page's scroll as the page
.page-backdrop__circle--a { width: 70vmax; height: 70vmax; left: -24vmax; top: -16vmax; background: var(--pb-a); --pb-drift: -22vh; } scrolls: the back slowest, none as fast as the page. */
.page-backdrop__circle--b { width: 50vmax; height: 50vmax; right: -18vmax; top: 34vh; background: var(--pb-b); --pb-drift: -40vh; }
/* Section: placed down the page, moving with it. */
.page-backdrop__circle--c { width: 42vmax; height: 42vmax; left: 34vw; top: 18%; background: var(--pb-c); }
.page-backdrop__circle--d { width: 32vmax; height: 32vmax; left: -8vmax; top: 48%; background: var(--pb-d); }
.page-backdrop__circle--e { width: 36vmax; height: 36vmax; right: -6vmax; top: 74%; background: var(--pb-e); }
/* The slow circles drift up across the whole scroll of the page. */
@supports (animation-timeline: scroll()) { @supports (animation-timeline: scroll()) {
.page-backdrop__circle--a, .page-backdrop__circle {
.page-backdrop__circle--b { animation: page-backdrop-rise linear both;
animation: page-backdrop-drift linear both;
animation-timeline: scroll(root block); animation-timeline: scroll(root block);
} }
} }
@keyframes page-backdrop-drift { @keyframes page-backdrop-rise {
to { to {
transform: translateY(var(--pb-drift)); transform: translateY(calc(var(--pb-scroll, 0px) * var(--pb-speed) * -1));
} }
} }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
.page-backdrop__circle--a, .page-backdrop__circle {
.page-backdrop__circle--b {
animation: none; animation: none;
} }
} }
/* Tones, one per section in turn: the same shades, swapped around. */ /* Dark mode: the dark shades. Two blocks as in index.css: the
.page-backdrop[data-tone="1"] { --pb-a: #dfebd6; --pb-b: #c2ffd6; --pb-c: #c2f6ff; --pb-d: #dfebd6; --pb-e: #c2fbff; } toggle's choice, or the system's when there is none. */
.page-backdrop[data-tone="2"] { --pb-a: #c2ffd6; --pb-b: #c2fbff; --pb-c: #dfebd6; --pb-d: #c2f6ff; --pb-e: #c2ffd6; } :root[data-theme="dark"] .page-backdrop {
.page-backdrop[data-tone="3"] { --pb-a: #c2fbff; --pb-b: #c2f6ff; --pb-c: #c2ffd6; --pb-d: #dfebd6; --pb-e: #c2f6ff; } --pb-opacity: 0.3;
--pb-0: #004552;
/* Dark mode: the dark shades, the same turns. Two blocks as in --pb-1: #27371b;
index.css: the toggle's choice, or the system's when there is none. */ --pb-2: #003f45; /* #004c52 deepened */
:root[data-theme="dark"] .page-backdrop { --pb-opacity: 0.45; --pb-a: #004552; --pb-b: #27371b; --pb-c: #004c52; --pb-d: #00521b; --pb-e: #27371b; } --pb-3: #00441a; /* #00521b deepened */
:root[data-theme="dark"] .page-backdrop[data-tone="1"] { --pb-a: #27371b; --pb-b: #004c52; --pb-c: #004552; --pb-d: #27371b; --pb-e: #00521b; } }
:root[data-theme="dark"] .page-backdrop[data-tone="2"] { --pb-a: #004c52; --pb-b: #00521b; --pb-c: #27371b; --pb-d: #004552; --pb-e: #004c52; }
:root[data-theme="dark"] .page-backdrop[data-tone="3"] { --pb-a: #00521b; --pb-b: #004552; --pb-c: #004c52; --pb-d: #27371b; --pb-e: #004552; }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .page-backdrop { --pb-opacity: 0.45; --pb-a: #004552; --pb-b: #27371b; --pb-c: #004c52; --pb-d: #00521b; --pb-e: #27371b; } :root:not([data-theme="light"]) .page-backdrop {
:root:not([data-theme="light"]) .page-backdrop[data-tone="1"] { --pb-a: #27371b; --pb-b: #004c52; --pb-c: #004552; --pb-d: #27371b; --pb-e: #00521b; } --pb-opacity: 0.3;
:root:not([data-theme="light"]) .page-backdrop[data-tone="2"] { --pb-a: #004c52; --pb-b: #00521b; --pb-c: #27371b; --pb-d: #004552; --pb-e: #004c52; } --pb-0: #004552;
:root:not([data-theme="light"]) .page-backdrop[data-tone="3"] { --pb-a: #00521b; --pb-b: #004552; --pb-c: #004c52; --pb-d: #27371b; --pb-e: #004552; } --pb-1: #27371b;
--pb-2: #003f45; /* #004c52 deepened */
--pb-3: #00441a; /* #00521b deepened */
}
} }
@media print { @media print {
.page-backdrop { display: none; } .page-backdrop {
display: none;
}
} }

View file

@ -1,69 +1,127 @@
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
PAGE BACKDROP PAGE BACKDROP
One background behind every public page: large flat circles in One background behind every public page: flat circles in the
the palette's light shades (its dark ones in dark mode), palette's light shades (its dark ones in dark mode), overlapping.
overlapping. Sections paint nothing of their own, so it runs Sections paint nothing of their own, so it runs behind all of
behind all of them; cards keep their solid surface. them; cards keep their own raised surface.
Two kinds of circle, for depth as the page scrolls: Depth: the circles sit in LAYERS, back to front, each rising at
slow fixed to the window, drifting up slower than the page its own fraction of the page's scroll: big and slow at the back,
(a CSS scroll-driven animation, PageBackdrop.css) small and quicker at the front, none as fast as the page itself.
section placed down the page itself, so they travel with the The rise is a CSS scroll-driven animation (PageBackdrop.css) over
sections they sit behind --pb-scroll, the page's scrollable height, which is measured here
Without scroll-driven animations, or under reduced motion, the whenever the page changes size (no scroll listener). Without
slow circles simply stay put. scroll-driven animations, or under reduced motion, they stay put.
As the visitor moves through a page the circles change tone: the Each page gets its own arrangement: sizes and places come from a
section crossing the middle of the window picks one of TONES (its generator seeded with the path, so a page looks the same every
place on the page, in turn), and the circles ease to that tone's visit and different from its neighbors.
colors. Watched with an IntersectionObserver, so nothing runs
while the page sits still. Under reduced motion the change is
instant (index.css stops every transition).
Every text color passes 4.5:1 on every shade used here, overlaps As the visitor reaches a new section (a top-level one, not one
included, in both modes: the light shades are the palette's nested inside another) the circles change tone: each moves to the
palest, and the dark ones sit at partial opacity. next shade in turn, easing slowly. Watched with an
IntersectionObserver; under reduced motion the change is instant
(index.css stops every transition).
Every text color passes 4.5:1 on every shade here, however many
circles overlap (see PageBackdrop.css for the opacities).
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { useEffect, useRef } from 'react' import { useEffect, useMemo, useRef, useState, type CSSProperties } from 'react'
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import './PageBackdrop.css' import './PageBackdrop.css'
/** How many tones PageBackdrop.css defines (data-tone 0 to 3). */ /** How many shades PageBackdrop.css defines (--pb-0 to --pb-3). */
const TONES = 4 const SHADES = 4
const SLOW = ['a', 'b']
const SECTION = ['c', 'd', 'e'] /* Back to front: how many circles, how big (vmax), and how much of
the page's scroll the layer rises by. */
const LAYERS = [
{ count: 3, size: [46, 70], speed: 0.14 },
{ count: 4, size: [26, 42], speed: 0.28 },
{ count: 4, size: [16, 26], speed: 0.45 },
{ count: 5, size: [8, 15], speed: 0.65 },
]
type Circle = { layer: number; size: number; left: number; top: number; shade: number; speed: number }
/* A small seeded generator (mulberry32), so a path always draws the
same circles. */
function seeded(text: string) {
let seed = 0
for (const char of text) seed = (Math.imul(seed, 31) + char.charCodeAt(0)) | 0
return () => {
seed = (seed + 0x6d2b79f5) | 0
let t = Math.imul(seed ^ (seed >>> 15), 1 | seed)
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
return ((t ^ (t >>> 14)) >>> 0) / 4294967296
}
}
function arrange(path: string): Circle[] {
const random = seeded(path)
return LAYERS.flatMap((layer, index) =>
Array.from({ length: layer.count }, (_, i) => ({
layer: index,
size: layer.size[0] + random() * (layer.size[1] - layer.size[0]),
// Spread across the width, and down the layer's full travel:
// one slice of it per circle, placed somewhere in its slice.
left: -15 + random() * 100,
top: (i + random()) / layer.count,
shade: Math.floor(random() * SHADES),
speed: layer.speed,
})),
)
}
export default function PageBackdrop() { export default function PageBackdrop() {
const ref = useRef<HTMLDivElement>(null) const ref = useRef<HTMLDivElement>(null)
const { pathname } = useLocation() const { pathname } = useLocation()
const [tone, setTone] = useState(0)
const circles = useMemo(() => arrange(pathname), [pathname])
// The page's scrollable height, for how far each layer travels.
useEffect(() => {
const backdrop = ref.current
if (!backdrop) return undefined
const measure = () => {
const scroll = Math.max(0, document.documentElement.scrollHeight - window.innerHeight)
backdrop.style.setProperty('--pb-scroll', `${scroll}px`)
}
measure()
const observer = new ResizeObserver(measure)
observer.observe(document.body)
return () => observer.disconnect()
}, [])
// A new top-level section reaching the window's middle moves the tone on.
useEffect(() => { useEffect(() => {
const main = document.getElementById('main') const main = document.getElementById('main')
const backdrop = ref.current if (!main) return undefined
if (!main || !backdrop) return undefined
backdrop.dataset.tone = '0' setTone(0)
let watched: Element[] = [] let watched: Element[] = []
// The band crossing the window's middle line sets the tone.
const observer = new IntersectionObserver( const observer = new IntersectionObserver(
(entries) => { (entries) => {
for (const entry of entries) { for (const entry of entries) {
if (!entry.isIntersecting) continue if (!entry.isIntersecting) continue
const index = watched.indexOf(entry.target) const index = watched.indexOf(entry.target)
if (index >= 0) backdrop.dataset.tone = String(index % TONES) if (index >= 0) setTone(index % SHADES)
} }
}, },
{ rootMargin: '-50% 0px -50% 0px', threshold: 0 }, { rootMargin: '-50% 0px -50% 0px', threshold: 0 },
) )
// Pages draw their sections as their data arrives, so the list // Pages draw their sections as their data arrives, so the list
// is gathered again whenever main's content changes. // is gathered again whenever main's content changes. Only the
// outermost: a timeline's decades are sections inside one.
const collect = () => { const collect = () => {
observer.disconnect() observer.disconnect()
watched = Array.from(main.querySelectorAll('section')) watched = Array.from(main.querySelectorAll('section')).filter(
(section) => !section.parentElement?.closest('section'),
)
watched.forEach((section) => observer.observe(section)) watched.forEach((section) => observer.observe(section))
} }
collect() collect()
@ -83,13 +141,20 @@ export default function PageBackdrop() {
return ( return (
<div ref={ref} className="page-backdrop" aria-hidden="true"> <div ref={ref} className="page-backdrop" aria-hidden="true">
<div className="page-backdrop__window"> {circles.map((circle, i) => (
{SLOW.map((name) => ( <span
<span key={name} className={`page-backdrop__circle page-backdrop__circle--${name}`} /> key={i}
))} className={`page-backdrop__circle page-backdrop__circle--${circle.layer}`}
</div> style={
{SECTION.map((name) => ( {
<span key={name} className={`page-backdrop__circle page-backdrop__circle--${name}`} /> '--pb-size': `${circle.size.toFixed(1)}vmax`,
left: `${circle.left.toFixed(1)}vw`,
'--pb-top': circle.top,
'--pb-speed': circle.speed,
background: `var(--pb-${(circle.shade + tone) % SHADES})`,
} as CSSProperties
}
/>
))} ))}
</div> </div>
) )