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
|
|
@ -31,6 +31,7 @@ import { mediaUrl } from '../lib/media.ts'
|
|||
import { initialsFor } from '../lib/organizations.ts'
|
||||
import Logo from '../components/Logo.tsx'
|
||||
import { withAlpha, accentText, readableOn, BRAND } from '../lib/color.ts'
|
||||
import { useReadingMode } from '../lib/readingMode.ts'
|
||||
|
||||
const BODY = 'var(--color-muted)'
|
||||
|
||||
|
|
@ -38,6 +39,7 @@ export default function OrganizationDetail() {
|
|||
const { id } = useParams()
|
||||
const { pathname } = useLocation()
|
||||
const { data: org, loading, error, notFound, reload } = useOrganization(id)
|
||||
const reading = useReadingMode()
|
||||
|
||||
if (!org) {
|
||||
return (
|
||||
|
|
@ -143,12 +145,25 @@ export default function OrganizationDetail() {
|
|||
}
|
||||
|
||||
if (org.awards.length > 0) {
|
||||
const recipients = (count: number) =>
|
||||
count === 0 ? 'No recipients yet' : `${count} recipient${count === 1 ? '' : 's'}`
|
||||
sections.push({
|
||||
id: 'awards',
|
||||
title: 'Awards',
|
||||
blurb: `Given by ${org.short_name || org.name}.`,
|
||||
accent,
|
||||
content: (
|
||||
// Reading mode: a card reads as one long link, so each award is
|
||||
// a line with its name linked.
|
||||
content: reading ? (
|
||||
<ul>
|
||||
{org.awards.map((award) => (
|
||||
<li key={award.id}>
|
||||
<Link to={`/awards/${award.id}`}>{award.name}</Link>
|
||||
{award.description && `: ${award.description}`} ({recipients(award.recipient_count)})
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2">
|
||||
{org.awards.map((award) => (
|
||||
<Link
|
||||
|
|
@ -166,9 +181,7 @@ export default function OrganizationDetail() {
|
|||
</span>
|
||||
)}
|
||||
<span className="mt-3 block text-xs uppercase tracking-wide opacity-70" style={{ color: BODY }}>
|
||||
{award.recipient_count === 0
|
||||
? 'No recipients yet'
|
||||
: `${award.recipient_count} recipient${award.recipient_count === 1 ? '' : 's'}`}
|
||||
{recipients(award.recipient_count)}
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue