From c79910ef8db48d033af02b3a7a8df25c4ae21e98 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Sat, 3 Oct 2026 16:54:55 -0500 Subject: [PATCH] Reading mode: text versions of the front page's bands - Stats: one line per number, no longer stuck at 0 (the count waited for the band to scroll into view, which the hidden page never does); reduced motion shows the numbers at once too. - Calendar: the next six weeks from today as a list (date, linked title, time, type, place), wherever a calendar is drawn. - Featured cards: a linked heading and its words each; a video card links to its video. - Countdown: left out, the retreats band shows the same event. Co-Authored-By: Claude Opus 5.5 --- docs/updating-data-in-code.md | 2 +- src/components/FeaturedCards.tsx | 23 ++++++++++ src/pages/sections/EventCalendar.tsx | 42 ++++++++++++++++++- .../sections/home/NextEventCountdown.tsx | 5 +++ src/pages/sections/home/StatsBand.tsx | 28 +++++++++++-- 5 files changed, 95 insertions(+), 5 deletions(-) diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index af3b74a..12872b3 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -279,7 +279,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`. | -| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal--)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. Something saved or sent (the newsletter's colors) uses `STORED_PALETTE`, which is never swapped. | +| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal--)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the stats band, the calendar (the next six weeks as a list) and the featured cards; the countdown draws nothing. Something saved or sent (the newsletter's colors) uses `STORED_PALETTE`, which is never swapped. | | 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/FeaturedCards.tsx b/src/components/FeaturedCards.tsx index 9476633..5f5b4d6 100644 --- a/src/components/FeaturedCards.tsx +++ b/src/components/FeaturedCards.tsx @@ -23,6 +23,9 @@ fall outside), 4px thick. With three or more cards the first is the large one, two rows tall, and the next two stack beside it, so it no longer stretches its neighbor. + + Reading mode (readingMode.ts) gets each card as a linked heading + and its words, a video card linking to its video. ═══════════════════════════════════════════════════════════════ */ @@ -31,6 +34,7 @@ import VideoPlayer from './VideoPlayer.tsx' import { refHref } from '../lib/hrefs.ts' import { mediaUrl } from '../lib/media.ts' import type { FeaturedCard } from '../lib/useFrontPage.ts' +import { useReadingMode } from '../lib/readingMode.ts' import { useSmallImage } from '../lib/useSmallImage.ts' /* Image kinds that are photographs, drawn edge to edge. Anything @@ -131,7 +135,26 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) { ) } +function ReadingCards({ cards }: { cards: FeaturedCard[] }) { + return ( + <> + {cards.map((card, index) => { + const href = card.kind === 'video' ? card.url : hrefFor(card) + return ( +
+ {card.eyebrow &&

{card.eyebrow}

} + {card.title &&

{href ? {card.title} : card.title}

} + {card.blurb &&

{card.blurb}

} +
+ ) + })} + + ) +} + export default function FeaturedCards({ cards }: { cards: FeaturedCard[] }) { + const reading = useReadingMode() + if (reading) return const leadLarge = cards.length >= 3 return (
diff --git a/src/pages/sections/EventCalendar.tsx b/src/pages/sections/EventCalendar.tsx index 794b670..926fa0b 100644 --- a/src/pages/sections/EventCalendar.tsx +++ b/src/pages/sections/EventCalendar.tsx @@ -39,6 +39,9 @@ Below md the grid would be seven unreadable slivers, so the month view shows the list there instead. The toggle still works; it just has one answer on a phone. + + Reading mode (readingMode.ts) gets no grid or controls: the next + six weeks from today as a list, one line per event (ReadingList). ═══════════════════════════════════════════════════════════════ */ import { ArrowRight, ArrowLeft, CaretRight, CaretLeft } from '@phosphor-icons/react' @@ -52,6 +55,7 @@ import { eventHref } from '../../lib/hrefs.ts' import type { EventListItem } from '../../lib/useContent.ts' import { withAlpha, accentText, readableOn, BRAND } from '../../lib/color.ts' import { localISO } from '../../lib/timeline.ts' +import { useReadingMode } from '../../lib/readingMode.ts' export type CalendarControl = 'scope' | 'type' | 'online' | 'search' export type CalendarView = 'month' | 'list' @@ -225,7 +229,43 @@ function nextDateAfter(events: EventListItem[], after: string): string | null { /* ── Component ───────────────────────────────────────────────── */ -export default function EventCalendar({ +export default function EventCalendar(props: EventCalendarProps) { + return useReadingMode() ? : +} + +/* How many days from today the reading mode list covers. */ +const READING_DAYS = 42 + +/* Reading mode: what's on from today for six weeks, as text. */ +function ReadingList({ scope, host, status, type }: EventCalendarProps) { + const today = iso(new Date()) + const to = addDays(today, READING_DAYS - 1) + const { events, loading, error } = useEvents({ scope, host, status, type, from: today, to }) + const items = useMemo(() => occurrencesIn(events, today, to), [events, today, to]) + + if (error) return

Couldn’t load the calendar. {error}

+ if (loading && items.length === 0) return

Loading the calendar…

+ if (items.length === 0) return

Nothing on the calendar in the next six weeks.

+ + return ( +
    + {items.map((item) => { + const { event } = item + const when = item.start !== item.end ? rangeLabel(item.start, item.end) : longDay(item.start) + const where = event.location_label || (event.is_online ? 'Online' : null) + return ( +
  • + {when}: {event.title} + {event.status === 'cancelled' && ' (canceled)'} + {[item.time, eventTypeLabel(event.event_type), where].filter(Boolean).map((part) => `, ${part}`)} +
  • + ) + })} +
+ ) +} + +function CalendarGrid({ scope, host, status, diff --git a/src/pages/sections/home/NextEventCountdown.tsx b/src/pages/sections/home/NextEventCountdown.tsx index 7971339..f14917c 100644 --- a/src/pages/sections/home/NextEventCountdown.tsx +++ b/src/pages/sections/home/NextEventCountdown.tsx @@ -26,6 +26,7 @@ import { eventHref } from '../../../lib/hrefs.ts' import { upcomingOccurrences } from '../../../lib/eventSeries.ts' import type { CountdownEvent } from '../../../lib/useFrontPage.ts' import { withAlpha, accentText, BRAND } from '../../../lib/color.ts' +import { useReadingMode } from '../../../lib/readingMode.ts' /* Local midnight (or HH:MM) on a 'YYYY-MM-DD'. */ @@ -63,6 +64,7 @@ export default function NextEventCountdown({ event: CountdownEvent overlap: boolean }) { + const reading = useReadingMode() const now = useNow(1000) const when = target(event) const accent = event.color || BRAND @@ -79,6 +81,9 @@ export default function NextEventCountdown({ const where = event.location_label || (event.is_online ? 'Online' : null) + // Reading mode: the event is already in the retreats band. + if (reading) return null + return (
(null) - const [seen, setSeen] = useState(false) + // Less motion: no wait for the band to scroll into view (reading + // mode's hidden page never does). + const [seen, setSeen] = useState(prefersLessMotion) useEffect(() => { const el = ref.current @@ -43,6 +47,24 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) { return () => observer.disconnect() }, [seen]) + if (useReadingMode()) { + return ( +
+

{title}

+ {blurb &&

{blurb}

} +
    + {stats.map((stat, index) => ( +
  • + {stat.value} + {stat.suffix} {stat.label} + {stat.note && `: ${stat.note}`} +
  • + ))} +
+
+ ) + } + return (
{value} - const n = reduced || !run ? (run ? target : 0) : shown + const n = reduced ? target : run ? shown : 0 return ( {n.toLocaleString(undefined, {