diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index e7c9fb6..b278bf2 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -278,6 +278,7 @@ The numbers band's "Number Source" dropdown works the same way: | 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. | | 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. | | 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/src/components/PageBackdrop.css b/src/components/PageBackdrop.css index ff21d1d..02fc866 100644 --- a/src/components/PageBackdrop.css +++ b/src/components/PageBackdrop.css @@ -46,13 +46,6 @@ } } -/* The same rise where scroll-driven animations are missing: the - scroll position arrives as --pb-y from PageBackdrop.tsx. */ -.page-backdrop[data-parallax="script"] .page-backdrop__circle { - transform: translateY(calc(var(--pb-y, 0px) * var(--pb-speed) * -1)); - will-change: transform; -} - @keyframes page-backdrop-rise { to { transform: translateY(calc(var(--pb-scroll, 0px) * var(--pb-speed) * -1)); @@ -60,10 +53,8 @@ } @media (prefers-reduced-motion: reduce) { - .page-backdrop__circle, - .page-backdrop[data-parallax="script"] .page-backdrop__circle { + .page-backdrop__circle { animation: none; - transform: none; } } diff --git a/src/components/PageBackdrop.tsx b/src/components/PageBackdrop.tsx index 55b59ab..80e70a5 100644 --- a/src/components/PageBackdrop.tsx +++ b/src/components/PageBackdrop.tsx @@ -11,11 +11,8 @@ small and quicker at the front, none as fast as the page itself. The rise is a CSS scroll-driven animation (PageBackdrop.css) over --pb-scroll, the page's scrollable height, which is measured here - whenever the page changes size. Browsers without scroll-driven - animations (Firefox, for now) get the same motion from a passive - scroll handler instead, which writes the scroll position to one - CSS variable, --pb-y, at most once a frame; the CSS does the rest. - Under reduced motion they stay put either way. + whenever the page changes size (no scroll listener). Without + scroll-driven animations, or under reduced motion, they stay put. Each page gets its own arrangement: sizes and places come from a generator seeded with the path, so a page looks the same every @@ -98,32 +95,6 @@ export default function PageBackdrop() { return () => observer.disconnect() }, []) - // Where scroll-driven animations are missing: the scroll position, - // once a frame at most, into --pb-y (PageBackdrop.css moves each - // layer by its share of it). - useEffect(() => { - const backdrop = ref.current - if (!backdrop || CSS.supports('animation-timeline: scroll()')) return undefined - if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return undefined - - backdrop.dataset.parallax = 'script' - let frame = 0 - const update = () => { - frame = 0 - backdrop.style.setProperty('--pb-y', `${window.scrollY}px`) - } - const onScroll = () => { - if (!frame) frame = requestAnimationFrame(update) - } - update() - window.addEventListener('scroll', onScroll, { passive: true }) - return () => { - window.removeEventListener('scroll', onScroll) - cancelAnimationFrame(frame) - delete backdrop.dataset.parallax - } - }, []) - // A new top-level section reaching the window's middle moves the tone on. useEffect(() => { const main = document.getElementById('main') diff --git a/src/components/PeopleTiles.tsx b/src/components/PeopleTiles.tsx index 400ec9e..13056fc 100644 --- a/src/components/PeopleTiles.tsx +++ b/src/components/PeopleTiles.tsx @@ -53,10 +53,9 @@ import "./PeopleTiles.css"; * lines of name (and two of title), so a row's cards are one * height. The list as a whole has the frame, not each tile. * - * Rows fill (balancedColumns): as many tiles across as fit, never - * fewer than 2 or more than 10, one fewer when that would leave a - * lone tile on the last row. When 2 don't fit at full size they - * shrink. + * Rows are balanced (balancedColumns): as many tiles across as fit, + * but never fewer than 2 or more than 10, and spread so the last + * row isn't a lone tile. When 2 don't fit at full size they shrink. * * Details open in a panel right under the tile, over what follows * (flipped to end at the tile's right edge when it would run off @@ -835,16 +834,16 @@ function Chevron() { /* ── Helpers ─────────────────────────────────────────────────── */ /* Tiles across a row: as many as fit, at least 2 and at most 10 - (never more than there are). If that would leave one tile alone on - the last row, one fewer across, so the last row has two: 7 that fit - 6 across go 5 and 2. With only 2 across, a third, narrower column - takes the odd one instead (3 tiles on a phone go 3 across). */ + (never more than there are), then evened out so the rows come + out as close to equal as they can: 5 tiles that fit 4 across go + 3 and 2, not 4 and 1. If one tile would still be left alone (3 + where only 2 fit), one more, narrower, column takes it. */ export function balancedColumns(count: number, width: number, tile: number, gap: number): number { if (count <= 1) return 1; const fit = Math.floor((width + gap) / (tile + gap)); - const cols = Math.min(count, 10, Math.max(2, fit)); - if (count % cols !== 1) return cols; - return cols > 2 ? cols - 1 : Math.min(count, 3); + const most = Math.min(count, 10, Math.max(2, fit)); + const cols = Math.ceil(count / Math.ceil(count / most)); + return count % cols === 1 && cols < Math.min(count, 10) ? cols + 1 : cols; } /* A string id is a people slug; a numeric or missing one is a diff --git a/src/components/VideoPlayer.tsx b/src/components/VideoPlayer.tsx index 3c03e00..014024f 100644 --- a/src/components/VideoPlayer.tsx +++ b/src/components/VideoPlayer.tsx @@ -6,10 +6,8 @@ featured cards and the video content block. The still is the caller's image, else YouTube's own thumbnail - (its 16:9 one, falling back to the 4:3 one cropped). Any still - that fails, or comes back as YouTube's gray "no thumbnail" - placeholder, gives way to the next; with none left it's a flat - teal panel with the play button always showing. The play button shows on hover or keyboard focus, and + (its 16:9 one, falling back to the 4:3 one cropped), else a plain + dark panel. The play button shows on hover or keyboard focus, and always on a touch screen, which can't hover. Small rounded corners, as the only rounded thing besides buttons and dots. A link that embeds.ts can't turn into a player (not https, or not a host it knows how to frame) still @@ -20,7 +18,7 @@ import { Play } from '@phosphor-icons/react' import { useState, type SyntheticEvent } from 'react' import HomeLink from '../pages/sections/home/HomeLink.tsx' -import { playingSource, videoSource, videoThumbnails } from '../lib/embeds.ts' +import { playingSource, videoSource, videoThumbnail } from '../lib/embeds.ts' import { BRAND } from '../lib/color.ts' @@ -37,7 +35,6 @@ export default function VideoPlayer({ className?: string }) { const [playing, setPlaying] = useState(false) - const [skipped, setSkipped] = useState(0) const source = videoSource(url) if (playing && source) { @@ -55,36 +52,24 @@ export default function VideoPlayer({ ) } - const stills = [...(still ? [still] : []), ...videoThumbnails(url)] - const image = stills[skipped] ?? null - const next = () => setSkipped((n) => n + 1) + const image = still ?? videoThumbnail(url) - // YouTube's placeholder for a missing still is a real 120 x 90 image, - // not an error, so it's caught by its size; wherever it came from, - // since Fetch preview may have saved one into the library. - const checkLoaded = (event: SyntheticEvent) => { + // YouTube's 16:9 still is missing for some videos; its 4:3 one never is. + const fallBack = (event: SyntheticEvent) => { const img = event.currentTarget - if (img.naturalWidth <= 120 && img.naturalHeight <= 90) next() + if (img.src.endsWith('/hq720.jpg')) img.src = img.src.replace(/hq720\.jpg$/, 'hqdefault.jpg') } const face = ( {image ? ( - + ) : ( )}