Reading mode: every page and section reads as text

The reader (ReaderView.tsx) now reads an icon-only link's label, puts
a card's link on its first line or picture when it has no heading,
gives each item of a row of facts or links its own line, keeps line
breaks, skips what CSS hides, turns a form into one line saying it
can't be used there, shows empty table cells as "-", keeps section and
heading ids so #links land, and opens file links as files.

What it can't read draws its own text version (useReadingMode()):
the hero, pathfinder, front page history, event lists (every event,
past ones too), org lists and groups map (every region and group,
linked), history timeline (every year open), schedules (every day,
fold-outs included), people tiles (everyone, with details) and videos.

Also: org names are linked headings, heading levels fixed where cards
repeated their section's, Team pages lose the doubled "Members",
Giving links the treasurer's email and names Church Center.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-03 17:12:27 -05:00
parent c79910ef8d
commit 27e5fbd690
24 changed files with 788 additions and 180 deletions

View file

@ -18,10 +18,14 @@
the place typed in, with a link out to the full map.
Tabs follow the ARIA tab pattern: arrow keys move between them.
Reading mode (readingMode.ts) gets every day as a heading, each
entry a line (time, title, place, person) with its fold-out after
it, no map frame (ReadingSchedule).
═══════════════════════════════════════════════════════════════ */
import { CaretDown } from '@phosphor-icons/react'
import { useId, useState, type KeyboardEvent } from 'react'
import { Fragment, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
import { Link } from 'react-router-dom'
import { personHref } from '../lib/hrefs.ts'
@ -31,6 +35,7 @@ import { Anchor, Paragraphs } from './InlineText.tsx'
import { withAlpha, accentText, readableOn } from '../lib/color.ts'
import { useSmallImage } from '../lib/useSmallImage.ts'
import { focusOnMount } from '../lib/focus.ts'
import { useReadingMode } from '../lib/readingMode.ts'
const BODY = 'var(--color-muted)'
const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
@ -215,6 +220,54 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
)
}
/* Reading mode: every day, every entry and its fold-out, as text. A
day is an h4, under the page's h3 block headings (ContentBlocks). */
function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string | null; accent: string }) {
return (
<div>
{intro && <Paragraphs text={intro} accent={accent} />}
{days.map((day, index) => (
<div key={day.name || index}>
{days.length > 1 && <h4>{day.name || 'Schedule'}</h4>}
<ul>
{day.entries.map((entry, i) => {
const graphic = mediaUrl(entry.media)
const place = entry.map?.trim()
const parts: ReactNode[] = [
entry.time,
entry.url ? <Anchor href={entry.url}>{entry.text}</Anchor> : entry.text,
entry.location,
entry.person && <Link to={personHref(entry.person.id)}>{entry.person.name}</Link>,
].filter(Boolean)
return (
<li key={i}>
<p>
{parts.map((part, j) => (
<Fragment key={j}>
{j > 0 && ' · '}
{part}
</Fragment>
))}
</p>
{entry.detail && <p>{entry.detail}</p>}
{entry.person?.tagline && <p>{entry.person.tagline}</p>}
{entry.description && <Paragraphs text={entry.description} accent={accent} />}
{graphic && <img src={graphic} alt={entry.media_alt ?? ''} />}
{place && (
<p>
<a href={mapLink(place)}>Open {place} in Google Maps</a>
</p>
)}
</li>
)
})}
</ul>
</div>
))}
</div>
)
}
export default function ScheduleBlock({
items,
intro,
@ -227,8 +280,10 @@ export default function ScheduleBlock({
const days = groupByDay(items)
const [active, setActive] = useState(() => todayIndex(days))
const baseId = useId()
const reading = useReadingMode()
if (days.length === 0) return null
if (reading) return <ReadingSchedule days={days} intro={intro} accent={accent} />
const current = days[Math.min(active, days.length - 1)]
// Arrows move one tab and wrap; Home and End jump to the ends.