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:
parent
c79910ef8d
commit
27e5fbd690
24 changed files with 788 additions and 180 deletions
|
|
@ -19,6 +19,9 @@
|
|||
paths are a strip of cells along the top, the chosen one filled
|
||||
flat in its accent; under it, the path's blurb and its actions
|
||||
are cells of the same block.
|
||||
|
||||
Reading mode (readingMode.ts) gets every path at once, no tabs:
|
||||
its label as a heading, its blurb and a list of its actions.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight, ArrowUpRight, BookOpen, Dot, CalendarBlank, ChatCircle, Compass, GraduationCap, HandHeart, Heart, House, MapPin, MusicNotes, Sparkle, Star, Tent, UsersThree, type Icon } from '@phosphor-icons/react'
|
||||
|
|
@ -27,6 +30,7 @@ import { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from
|
|||
import HomeLink, { isExternal } from './HomeLink.tsx'
|
||||
import type { FrontPagePath } from '../../../lib/useFrontPage.ts'
|
||||
import { ACCENTS, accentText, readableOn } from '../../../lib/color.ts'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
|
||||
type PathfinderProps = {
|
||||
id: string
|
||||
|
|
@ -69,9 +73,33 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
|||
const [selected, setSelected] = useState(0)
|
||||
const tabs = useRef<Array<HTMLButtonElement | null>>([])
|
||||
const base = useId().replace(/:/g, '')
|
||||
const reading = useReadingMode()
|
||||
|
||||
if (paths.length === 0) return null
|
||||
|
||||
if (reading) {
|
||||
return (
|
||||
<section id={id}>
|
||||
<h2>{title}</h2>
|
||||
{blurb && <p>{blurb}</p>}
|
||||
{paths.map((option, index) => (
|
||||
<div key={`${option.label}-${index}`}>
|
||||
<h3>{option.label}</h3>
|
||||
{option.blurb && <p>{option.blurb}</p>}
|
||||
<ul>
|
||||
{option.actions.map((action, i) => (
|
||||
<li key={`${action.url}-${i}`}>
|
||||
<HomeLink url={action.url}>{action.label}</HomeLink>
|
||||
{action.description && `: ${action.description}`}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const path = paths[Math.min(selected, paths.length - 1)]
|
||||
const accent = PATH_ACCENTS[selected % PATH_ACCENTS.length]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue