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

@ -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, {