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 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-03 16:54:55 -05:00
parent 502a294940
commit c79910ef8d
5 changed files with 95 additions and 5 deletions

View file

@ -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 `<html>` 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-<family>-<shade>)` (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 `<html>` 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-<family>-<shade>)` (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` | |

View file

@ -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 (
<div key={`${card.kind}-${card.ref?.id ?? card.url}-${index}`}>
{card.eyebrow && <p>{card.eyebrow}</p>}
{card.title && <h3>{href ? <HomeLink url={href}>{card.title}</HomeLink> : card.title}</h3>}
{card.blurb && <p>{card.blurb}</p>}
</div>
)
})}
</>
)
}
export default function FeaturedCards({ cards }: { cards: FeaturedCard[] }) {
const reading = useReadingMode()
if (reading) return <ReadingCards cards={cards} />
const leadLarge = cards.length >= 3
return (
<div className="overflow-hidden shadow-md">

View file

@ -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() ? <ReadingList {...props} /> : <CalendarGrid {...props} />
}
/* 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 <p>Couldn’t load the calendar. {error}</p>
if (loading && items.length === 0) return <p>Loading the calendar…</p>
if (items.length === 0) return <p>Nothing on the calendar in the next six weeks.</p>
return (
<ul>
{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 (
<li key={item.key}>
{when}: <Link to={eventHref(event.id)}>{event.title}</Link>
{event.status === 'cancelled' && ' (canceled)'}
{[item.time, eventTypeLabel(event.event_type), where].filter(Boolean).map((part) => `, ${part}`)}
</li>
)
})}
</ul>
)
}
function CalendarGrid({
scope,
host,
status,

View file

@ -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 (
<section
aria-label="Next event"

View file

@ -6,13 +6,15 @@
band scrolls into view; a value that isn't a plain number
("Since 2004", "Coast to coast") just appears.
Reduced motion skips the count and shows the number.
Reduced motion skips the count and shows the number. Reading mode
(readingMode.ts) gets one line per number: "1,200+ Members".
═══════════════════════════════════════════════════════════════ */
import { useEffect, useRef, useState } from 'react'
import type { FrontPageStat } from '../../../lib/useFrontPage.ts'
import { prefersLessMotion } from '../../../lib/motion.ts'
import { useReadingMode } from '../../../lib/readingMode.ts'
const COUNT_MS = 1400
@ -25,7 +27,9 @@ type StatsBandProps = {
export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
const ref = useRef<HTMLElement>(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 (
<section id={id}>
<h2>{title}</h2>
{blurb && <p>{blurb}</p>}
<ul>
{stats.map((stat, index) => (
<li key={`${stat.label}-${index}`}>
{stat.value}
{stat.suffix} {stat.label}
{stat.note && `: ${stat.note}`}
</li>
))}
</ul>
</section>
)
}
return (
<section
id={id}
@ -107,7 +129,7 @@ function CountUp({ value, run }: { value: string; run: boolean }) {
if (!numeric) return <>{value}</>
const n = reduced || !run ? (run ? target : 0) : shown
const n = reduced ? target : run ? shown : 0
return (
<span className="tabular-nums">
{n.toLocaleString(undefined, {