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

@ -25,7 +25,8 @@
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.
and its words, a video card linking to its video. `level` is that
heading's level, one under the heading above the cards.
═══════════════════════════════════════════════════════════════ */
@ -84,8 +85,9 @@ function VideoPicture({ card }: { card: FeaturedCard }) {
const RULE = 'border-brand'
function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
function Card({ card, large, level }: { card: FeaturedCard; large: boolean; level: 3 | 4 }) {
const href = hrefFor(card)
const Title = level === 4 ? 'h4' : 'h3'
const text = (
<div className={`flex flex-1 flex-col ${large ? 'p-8 md:p-10' : 'p-7'}`}>
@ -93,7 +95,7 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
<p className="text-sm font-semibold text-link">{card.eyebrow}</p>
)}
{card.title && (
<h3 className={`mt-2 font-display font-bold leading-snug text-ink ${large ? 'text-2xl md:text-3xl' : 'text-lg'}`}>
<Title className={`mt-2 font-display font-bold leading-snug text-ink ${large ? 'text-2xl md:text-3xl' : 'text-lg'}`}>
{href ? (
// Stretched over the whole card, so the picture and the
// blurb are part of the click without nesting links.
@ -106,7 +108,7 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
) : (
card.title
)}
</h3>
</Title>
)}
{card.blurb && (
<p className={`mt-2 leading-relaxed text-muted ${large ? '' : 'line-clamp-3 text-sm'}`}>{card.blurb}</p>
@ -135,7 +137,10 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
)
}
function ReadingCards({ cards }: { cards: FeaturedCard[] }) {
type FeaturedCardsProps = { cards: FeaturedCard[]; level?: 3 | 4 }
function ReadingCards({ cards, level = 3 }: FeaturedCardsProps) {
const Title = level === 4 ? 'h4' : 'h3'
return (
<>
{cards.map((card, index) => {
@ -143,7 +148,7 @@ function ReadingCards({ cards }: { cards: FeaturedCard[] }) {
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.title && <Title>{href ? <HomeLink url={href}>{card.title}</HomeLink> : card.title}</Title>}
{card.blurb && <p>{card.blurb}</p>}
</div>
)
@ -152,9 +157,9 @@ function ReadingCards({ cards }: { cards: FeaturedCard[] }) {
)
}
export default function FeaturedCards({ cards }: { cards: FeaturedCard[] }) {
export default function FeaturedCards({ cards, level = 3 }: FeaturedCardsProps) {
const reading = useReadingMode()
if (reading) return <ReadingCards cards={cards} />
if (reading) return <ReadingCards cards={cards} level={level} />
const leadLarge = cards.length >= 3
return (
<div className="overflow-hidden shadow-md">
@ -164,6 +169,7 @@ export default function FeaturedCards({ cards }: { cards: FeaturedCard[] }) {
key={`${card.kind}-${card.ref?.id ?? card.url}-${index}`}
card={card}
large={leadLarge && index === 0}
level={level}
/>
))}
</ul>