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
|
|
@ -54,11 +54,15 @@ function GivingPanel() {
|
|||
"
|
||||
style={{ backgroundColor: BRAND, "--tw-ring-color": BRAND } as React.CSSProperties}
|
||||
>
|
||||
Give
|
||||
Give through Church Center
|
||||
</a>
|
||||
|
||||
<p className="mt-4 text-sm text-muted">
|
||||
If you would like to send a check, please email our Board Treasurer at treasurer@nextgenerationofunity.org to get an address.
|
||||
If you would like to send a check, please email our Board Treasurer at{" "}
|
||||
<a href="mailto:treasurer@nextgenerationofunity.org" className="text-link underline">
|
||||
treasurer@nextgenerationofunity.org
|
||||
</a>{" "}
|
||||
to get an address.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
record (GET /directory), scored by suggest.ts against the
|
||||
address. So /organisation offers Organization, /retreat offers
|
||||
Retreats, and an old /chapters/lynnwood offers the Lynnwood group.
|
||||
Below them, the main pages to start from.
|
||||
Below them, the main pages to start from, except in reading mode,
|
||||
whose own line of page links (ReaderView) already gives them.
|
||||
|
||||
The server sends this same page with a 404 status for an unknown
|
||||
address (routes/pages.js), so search engines drop it.
|
||||
|
|
@ -23,6 +24,7 @@ import { useDirectory, type Directory } from '../lib/useContent.ts'
|
|||
import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts'
|
||||
import { suggest, type Candidate } from '../lib/suggest.ts'
|
||||
import { ACCENTS, BRAND } from '../lib/color.ts'
|
||||
import { useReadingMode } from '../lib/readingMode.ts'
|
||||
|
||||
const ORG_KIND_LABEL: Record<string, string> = {
|
||||
national: 'Organization',
|
||||
|
|
@ -64,6 +66,7 @@ export default function NotFound() {
|
|||
const { pathname } = useLocation()
|
||||
const { data: directory, loading } = useDirectory()
|
||||
const matches = useMemo(() => suggest(pathname, candidates(directory ?? null)), [pathname, directory])
|
||||
const reading = useReadingMode()
|
||||
|
||||
return (
|
||||
<PageShell
|
||||
|
|
@ -103,13 +106,13 @@ export default function NotFound() {
|
|||
</ul>
|
||||
) : (
|
||||
<p className="notice max-w-xl p-6 text-body">
|
||||
Try one of the main pages below, or the menu at the top.
|
||||
{reading ? 'Try one of the main pages at the top.' : 'Try one of the main pages below, or the menu at the top.'}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
...(reading ? [] : [{
|
||||
id: 'start',
|
||||
title: 'Start from',
|
||||
accent: ACCENTS.green,
|
||||
|
|
@ -126,7 +129,7 @@ export default function NotFound() {
|
|||
))}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
}]),
|
||||
]}
|
||||
/>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import { mediaUrl, initials } from '../lib/media.ts'
|
|||
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
||||
import { capitalize } from '../lib/text.ts'
|
||||
import { accentText, BRAND } from '../lib/color.ts'
|
||||
import { useReadingMode } from '../lib/readingMode.ts'
|
||||
|
||||
const BODY = 'var(--color-muted)'
|
||||
|
||||
|
|
@ -205,7 +206,7 @@ export default function PersonDetail() {
|
|||
{(posts) => (
|
||||
<ul className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{posts.map((post) => (
|
||||
<PostCard key={post.id} post={post} accent={accent} />
|
||||
<PostCard key={post.id} post={post} accent={accent} level={3} />
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
|
@ -231,7 +232,9 @@ function Capped<T>({
|
|||
children: (shown: T[]) => ReactNode
|
||||
}) {
|
||||
const [all, setAll] = useState(false)
|
||||
const more = !all && items.length > SHOW_FIRST
|
||||
// Reading mode has no button to press: everything shows.
|
||||
const reading = useReadingMode()
|
||||
const more = !all && !reading && items.length > SHOW_FIRST
|
||||
return (
|
||||
<>
|
||||
{children(more ? items.slice(0, SHOW_FIRST) : items)}
|
||||
|
|
@ -253,6 +256,8 @@ function Capped<T>({
|
|||
|
||||
function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||
const photo = mediaUrl(person.photo)
|
||||
// Each fact reads on a line of its own there, so it says what it is.
|
||||
const reading = useReadingMode()
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
||||
|
|
@ -274,22 +279,35 @@ function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
|||
</span>
|
||||
)}
|
||||
|
||||
{person.pronouns && <span style={{ color: BODY }}>{person.pronouns}</span>}
|
||||
|
||||
{person.org && (
|
||||
<Link
|
||||
to={orgHref(person.org.id, person.org.kind)}
|
||||
className="font-medium hover:underline"
|
||||
style={{ color: accentText(accent) }}
|
||||
>
|
||||
{person.org.name}
|
||||
</Link>
|
||||
{person.pronouns && (
|
||||
<span style={{ color: BODY }}>
|
||||
{reading && 'Pronouns: '}
|
||||
{person.pronouns}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{person.location_label && <span style={{ color: BODY }}>{person.location_label}</span>}
|
||||
{person.org && (
|
||||
<span>
|
||||
{reading && 'Home organization: '}
|
||||
<Link
|
||||
to={orgHref(person.org.id, person.org.kind)}
|
||||
className="font-medium hover:underline"
|
||||
style={{ color: accentText(accent) }}
|
||||
>
|
||||
{person.org.name}
|
||||
</Link>
|
||||
</span>
|
||||
)}
|
||||
|
||||
{person.location_label && (
|
||||
<span style={{ color: BODY }}>
|
||||
{reading && 'Based in: '}
|
||||
{person.location_label}
|
||||
</span>
|
||||
)}
|
||||
|
||||
<Link to="/organization#leadership" className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
|
||||
Leadership
|
||||
{reading ? 'All leadership' : 'Leadership'}
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export default function TeamDetail() {
|
|||
|
||||
sections.push({
|
||||
id: 'members',
|
||||
title: hasAbout ? 'Members' : team.name,
|
||||
title: 'Members',
|
||||
accent,
|
||||
content: (
|
||||
<div className="max-w-6xl mx-auto px-6 space-y-6">
|
||||
|
|
|
|||
|
|
@ -35,8 +35,12 @@ const DEFAULTS = {
|
|||
|
||||
const EXCERPT_CHARS = 180
|
||||
|
||||
/* One post as a card; person pages list their posts with it too. */
|
||||
export function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
||||
/* One post as a card; person pages list their posts with it too.
|
||||
`level` is the title's heading level, one under the heading above
|
||||
the cards. The date line comes after the title in the page, so it
|
||||
reads as this post's (not the one before), and is drawn above it. */
|
||||
export function PostCard({ post, accent, level = 4 }: { post: BlogPostSummary; accent: string; level?: 3 | 4 }) {
|
||||
const Title = level === 3 ? 'h3' : 'h4'
|
||||
const cover = useSmallImage(mediaUrl(post.cover_image))
|
||||
const date = postDate(post.published_on)
|
||||
const authors = post.authors.map((author) => author.name).join(', ')
|
||||
|
|
@ -49,19 +53,19 @@ export function PostCard({ post, accent }: { post: BlogPostSummary; accent: stri
|
|||
<div className="aspect-video w-full bg-tint" />
|
||||
)}
|
||||
<div className="flex flex-1 flex-col p-6">
|
||||
{(date || post.tags.length > 0) && (
|
||||
<p className="text-sm font-semibold" style={{ color: accentText(accent) }}>
|
||||
{[date, ...post.tags].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
)}
|
||||
<h4 className="mt-2 font-display text-xl font-bold leading-snug text-ink">
|
||||
<Title className="mt-2 font-display text-xl font-bold leading-snug text-ink">
|
||||
<Link
|
||||
to={blogHref(post.id)}
|
||||
className="after:absolute after:inset-0 after:content-[''] hover:underline"
|
||||
>
|
||||
{post.title}
|
||||
</Link>
|
||||
</h4>
|
||||
</Title>
|
||||
{(date || post.tags.length > 0) && (
|
||||
<p className="order-first text-sm font-semibold" style={{ color: accentText(accent) }}>
|
||||
{[date, ...post.tags].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
)}
|
||||
{post.excerpt && (
|
||||
<p className="mt-2 leading-relaxed text-muted">{preview(post.excerpt, EXCERPT_CHARS)}</p>
|
||||
)}
|
||||
|
|
@ -137,7 +141,7 @@ export default function CommunityBlog({ accent = BRAND }: { accent?: string }) {
|
|||
</div>
|
||||
{external.cards.length > 0 && (
|
||||
<div className="mt-6">
|
||||
<FeaturedCards cards={external.cards} />
|
||||
<FeaturedCards cards={external.cards} level={4} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { mediaUrl } from "../../lib/media.ts";
|
|||
import { useSmallImage } from "../../lib/useSmallImage.ts";
|
||||
import Logo from "../../components/Logo.tsx";
|
||||
import { accentText, withAlpha, readableOn, BRAND } from '../../lib/color.ts'
|
||||
import { useReadingMode } from "../../lib/readingMode.ts";
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
EVENT LIST: CARDS
|
||||
|
|
@ -29,6 +30,10 @@ import { accentText, withAlpha, readableOn, BRAND } from '../../lib/color.ts'
|
|||
off, the band takes every kind it finds and grows a row of chips
|
||||
to narrow by, but only once it holds more than one, so a band of
|
||||
nothing but retreats shows no control at all.
|
||||
|
||||
Reading mode (readingMode.ts) gets every event as the grid lists
|
||||
them, carousel or not, with every past event shown and no
|
||||
buttons to open or page through them.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
||||
|
|
@ -152,6 +157,11 @@ function TitleLink({ ev, linked, children }) {
|
|||
|
||||
`linked` is the one thing a caller turns off: a card on the
|
||||
event's own page shouldn't link to the page it's already on.
|
||||
|
||||
`level` is the title's heading level, one under the heading the
|
||||
card sits beneath. In reading mode the type badge (which would
|
||||
read before the title, as if the last card's) and the "Event
|
||||
details" link (the title already links there) are left out.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
export function Card({
|
||||
ev,
|
||||
|
|
@ -161,7 +171,10 @@ export function Card({
|
|||
interactive = true,
|
||||
linked = true,
|
||||
showType = false,
|
||||
level = 3,
|
||||
}) {
|
||||
const reading = useReadingMode();
|
||||
const Title = level === 4 ? "h4" : "h3";
|
||||
const past = ev.status === "past";
|
||||
const color = ev.color || defaultColor;
|
||||
const orgLogo = mediaUrl(ev.org_logo) || DEFAULT_ORG_LOGO;
|
||||
|
|
@ -177,7 +190,7 @@ export function Card({
|
|||
on every card in a row of nothing but retreats is noise, and
|
||||
the card can't tell on its own, it only ever sees one event. */
|
||||
const typeBadge =
|
||||
showType && ev.event_type ? (
|
||||
showType && ev.event_type && !reading ? (
|
||||
<span
|
||||
className="inline-block px-3 py-0.5 mb-2 text-xs font-bold uppercase tracking-wide"
|
||||
style={{ border: `1px solid ${color}`, color: INK }}
|
||||
|
|
@ -222,11 +235,11 @@ export function Card({
|
|||
<Logo src={orgLogo} className="ev-org h-11 w-auto mb-4" />
|
||||
<div className="ev-info">
|
||||
{typeBadge}
|
||||
<h3 className="text-2xl sm:text-3xl font-bold leading-tight [overflow-wrap:anywhere]">
|
||||
<Title className="text-2xl sm:text-3xl font-bold leading-tight [overflow-wrap:anywhere]">
|
||||
<TitleLink ev={ev} linked={linked}>
|
||||
{ev.title}
|
||||
</TitleLink>
|
||||
</h3>
|
||||
</Title>
|
||||
{ev.theme && (
|
||||
<p className="text-lg sm:text-xl font-bold">"{ev.theme}"</p>
|
||||
)}
|
||||
|
|
@ -250,11 +263,11 @@ export function Card({
|
|||
<div className="md:col-span-2">
|
||||
<Logo src={orgLogo} className="h-15 w-auto mb-6" />
|
||||
{typeBadge}
|
||||
<h3 className="text-2xl sm:text-4xl font-bold [overflow-wrap:anywhere]">
|
||||
<Title className="text-2xl sm:text-4xl font-bold [overflow-wrap:anywhere]">
|
||||
<TitleLink ev={ev} linked={linked}>
|
||||
{ev.title}
|
||||
</TitleLink>
|
||||
</h3>
|
||||
</Title>
|
||||
{ev.theme && (
|
||||
<p className="text-lg sm:text-2xl font-bold">"{ev.theme}"</p>
|
||||
)}
|
||||
|
|
@ -338,7 +351,7 @@ export function Card({
|
|||
)}
|
||||
|
||||
{/* Last, so Register reads first when there is one. */}
|
||||
{linked && (
|
||||
{linked && !reading && (
|
||||
<Link
|
||||
to={eventHref(ev.id)}
|
||||
className={`font-bold transition-all duration-200 hover:scale-105 text-center ${
|
||||
|
|
@ -471,6 +484,7 @@ export default function EventListCards({
|
|||
const [showPast, setShowPast] = useState(false);
|
||||
const [pastShown, setPastShown] = useState(PAST_PAGE);
|
||||
const [activeType, setActiveType] = useState("all");
|
||||
const reading = useReadingMode();
|
||||
|
||||
/* What this band holds, which is what the chips offer, not the
|
||||
full list of declared types, three quarters of which would be
|
||||
|
|
@ -522,7 +536,9 @@ export default function EventListCards({
|
|||
// The list comes oldest first; the past grid reads newest first.
|
||||
const { upcoming, past } = splitByStatus(events);
|
||||
const pastEvents = past.reverse();
|
||||
const pastDrawn = pastEvents.slice(0, showPast ? pastShown : MAX_COLS);
|
||||
// Reading mode can't press "See past events": all of them, open.
|
||||
const pastOpen = showPast || reading;
|
||||
const pastDrawn = reading ? pastEvents : pastEvents.slice(0, showPast ? pastShown : MAX_COLS);
|
||||
|
||||
const prev = () => setIndex(i => Math.max(0, i - 1));
|
||||
const next = () => setIndex(i => Math.min(events.length - 1, i + 1));
|
||||
|
|
@ -595,7 +611,7 @@ export default function EventListCards({
|
|||
? empty
|
||||
: `· No ${eventTypeLabel(activeType).toLowerCase()} events in this section yet ·`,
|
||||
)
|
||||
) : view === "grid" ? (
|
||||
) : view === "grid" || reading ? (
|
||||
/* ── GRID VIEW: upcoming first, past events collapsed below ── */
|
||||
<div className="mx-auto px-8 md:px-12 lg:px-16" style={{ maxWidth: GRID_MAX }}>
|
||||
{upcoming.length > 0 && (
|
||||
|
|
@ -630,16 +646,16 @@ export default function EventListCards({
|
|||
<div
|
||||
className="relative transition-all duration-500 ease-out"
|
||||
style={{
|
||||
maxHeight: showPast ? "none" : PAST_PEEK,
|
||||
overflow: showPast ? "visible" : "hidden",
|
||||
maskImage: showPast ? "none" : PAST_FADE,
|
||||
WebkitMaskImage: showPast ? "none" : PAST_FADE,
|
||||
maxHeight: pastOpen ? "none" : PAST_PEEK,
|
||||
overflow: pastOpen ? "visible" : "hidden",
|
||||
maskImage: pastOpen ? "none" : PAST_FADE,
|
||||
WebkitMaskImage: pastOpen ? "none" : PAST_FADE,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="grid gap-6 items-stretch"
|
||||
style={{ gridTemplateColumns: GRID_TEMPLATE }}
|
||||
aria-hidden={!showPast}
|
||||
aria-hidden={!pastOpen}
|
||||
>
|
||||
{pastDrawn.map(ev => (
|
||||
<Card
|
||||
|
|
@ -648,35 +664,38 @@ export default function EventListCards({
|
|||
defaultColor={cardColor}
|
||||
accent={accent}
|
||||
compact
|
||||
interactive={showPast}
|
||||
interactive={pastOpen}
|
||||
showType={mixed}
|
||||
level={4}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap justify-center gap-3 mt-6">
|
||||
{showPast && pastShown < pastEvents.length && (
|
||||
{!reading && (
|
||||
<div className="flex flex-wrap justify-center gap-3 mt-6">
|
||||
{showPast && pastShown < pastEvents.length && (
|
||||
<button
|
||||
onClick={() => setPastShown(n => n + PAST_PAGE)}
|
||||
className="btn py-2.5 px-6 transition-all duration-200 hover:scale-105"
|
||||
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
|
||||
>
|
||||
Show more ({pastEvents.length - pastShown})
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
onClick={() => setPastShown(n => n + PAST_PAGE)}
|
||||
className="btn py-2.5 px-6 transition-all duration-200 hover:scale-105"
|
||||
onClick={() => setShowPast(v => !v)}
|
||||
aria-expanded={showPast}
|
||||
className="btn flex items-center gap-2 py-2.5 px-6 transition-all duration-200 hover:scale-105"
|
||||
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
|
||||
>
|
||||
Show more ({pastEvents.length - pastShown})
|
||||
{showPast
|
||||
? "Hide past events"
|
||||
: `See past events (${pastEvents.length})`}
|
||||
<CaretDown className="h-4 w-4 transition-transform duration-300" style={{ transform: showPast ? "rotate(180deg)" : "none" }} weight="bold" aria-hidden="true" />
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
onClick={() => setShowPast(v => !v)}
|
||||
aria-expanded={showPast}
|
||||
className="btn flex items-center gap-2 py-2.5 px-6 transition-all duration-200 hover:scale-105"
|
||||
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
|
||||
>
|
||||
{showPast
|
||||
? "Hide past events"
|
||||
: `See past events (${pastEvents.length})`}
|
||||
<CaretDown className="h-4 w-4 transition-transform duration-300" style={{ transform: showPast ? "rotate(180deg)" : "none" }} weight="bold" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { ArrowUpRight } from '@phosphor-icons/react';
|
||||
import { Link } from "react-router-dom";
|
||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||
import OrgLogo from "../../components/OrgLogo.tsx";
|
||||
import {
|
||||
|
|
@ -7,6 +8,7 @@ import {
|
|||
byName,
|
||||
} from "../../lib/organizations.ts";
|
||||
import { accentText } from '../../lib/color.ts'
|
||||
import { useReadingMode } from '../../lib/readingMode.ts'
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
ORGANIZATION LIST: CARDS
|
||||
|
|
@ -33,9 +35,12 @@ const FALLBACK_COLOR = "#3b5456";
|
|||
const CARD_MIN = "20rem";
|
||||
const GRID_MAX = "88rem";
|
||||
|
||||
function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
||||
/* Under a block title the card names are a level below it. */
|
||||
function OrgCard({ org, accent, pageLabel, siteLabel, titled }) {
|
||||
const color = org.color || accent;
|
||||
const path = orgPath(org);
|
||||
const reading = useReadingMode();
|
||||
const Name = titled ? "h4" : "h3";
|
||||
|
||||
// Tagline first, then where they are. Partners often have one and
|
||||
// not the other, so this is the line that's most likely to say
|
||||
|
|
@ -51,9 +56,9 @@ function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
|||
<OrgLogo org={org} color={color} size="h-10 w-10 sm:h-14 sm:w-14" />
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<h3 className="text-lg sm:text-xl font-bold leading-tight [overflow-wrap:anywhere]" style={{ color }}>
|
||||
{org.name}
|
||||
</h3>
|
||||
<Name className="text-lg sm:text-xl font-bold leading-tight [overflow-wrap:anywhere]" style={{ color }}>
|
||||
{path ? <Link to={path}>{org.name}</Link> : org.name}
|
||||
</Name>
|
||||
{subtitle && (
|
||||
<p className="text-sm mt-0.5" style={{ color: MUTED }}>
|
||||
{subtitle}
|
||||
|
|
@ -63,8 +68,9 @@ function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
|||
|
||||
{/* Top-right rather than in the footer: the footer holds
|
||||
outbound links, and the arrow goes somewhere different
|
||||
in kind, deeper into this site. */}
|
||||
{path && (
|
||||
in kind, deeper into this site. Reading mode has the
|
||||
name's link and leaves it out. */}
|
||||
{path && !reading && (
|
||||
<ArrowLink
|
||||
to={path}
|
||||
label={`${org.name}: ${pageLabel}`}
|
||||
|
|
@ -135,6 +141,7 @@ function Block({ title, orgs, accent, pageLabel, siteLabel }) {
|
|||
accent={accent}
|
||||
pageLabel={pageLabel}
|
||||
siteLabel={siteLabel}
|
||||
titled={!!title}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { CaretRight, MagnifyingGlass, X } from '@phosphor-icons/react';
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Fragment, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useCommunity } from "../../lib/useCommunity.ts";
|
||||
import { useOrganization } from "../../lib/useContent.ts";
|
||||
import { Link } from "react-router-dom";
|
||||
|
|
@ -9,6 +9,7 @@ import { orgPath } from "../../lib/organizations.ts";
|
|||
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
||||
import { accentText, readableOn } from '../../lib/color.ts'
|
||||
import { scrollBehavior } from "../../lib/motion.ts";
|
||||
import { useReadingMode } from "../../lib/readingMode.ts";
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
ORGANIZATION LIST: MAP
|
||||
|
|
@ -58,6 +59,7 @@ const GRID_CAP = 12;
|
|||
|
||||
const US_TITLE = "US Unity Regions";
|
||||
const INTL_TITLE = "International Unity Regions";
|
||||
const ONLINE_TITLE = "Online Unity Regions";
|
||||
|
||||
/* ── Body content ──────────────────────────────────────────────
|
||||
A group's description is ordered blocks rather than one
|
||||
|
|
@ -753,6 +755,65 @@ function GroupGrid({ regions, groups, groupsIn, subtextFor, openId, setOpenId })
|
|||
);
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
READING MODE
|
||||
Either view as text: the regions grouped as the list groups them,
|
||||
each with every one of its groups (no cap, no search), and no map.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
function ReadingRegions({ domestic, international, virtual, groupsIn, subtextFor }) {
|
||||
const region = r => {
|
||||
const path = orgPath(r);
|
||||
const subtext = subtextFor(r);
|
||||
const list = groupsIn(r.id);
|
||||
return (
|
||||
<Fragment key={r.id}>
|
||||
<h4>{path ? <Link to={path}>{r.name}</Link> : r.name}</h4>
|
||||
{subtext && <p>{subtext}</p>}
|
||||
{list.length === 0 ? (
|
||||
<p>No groups yet. Interested in starting one?</p>
|
||||
) : (
|
||||
<ul>
|
||||
{list.map(c => (
|
||||
<li key={c.id}>
|
||||
{orgPath(c) ? <Link to={orgPath(c)!}>{c.name}</Link> : c.name}
|
||||
{[c.location_label, c.meets].filter(Boolean).map(part => `, ${part}`).join("")}
|
||||
{c.website && (
|
||||
<>
|
||||
, <a href={c.website}>Website</a>
|
||||
</>
|
||||
)}
|
||||
{c.email && (
|
||||
<>
|
||||
, <a href={`mailto:${c.email}`}>Contact</a>
|
||||
</>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{([
|
||||
[US_TITLE, domestic],
|
||||
[INTL_TITLE, international],
|
||||
[ONLINE_TITLE, virtual],
|
||||
] as [string, any[]][]).map(([title, list]) =>
|
||||
list.length > 0 ? (
|
||||
<Fragment key={title}>
|
||||
<h3>{title}</h3>
|
||||
{list.map(region)}
|
||||
</Fragment>
|
||||
) : null
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/* The control for the section heading's action bar. */
|
||||
export function OrgMapToggle({ view, setView, accent }) {
|
||||
const btn = active => ({
|
||||
|
|
@ -806,6 +867,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
const [hovered, setHovered] = useState<any>(null);
|
||||
const [openId, setOpenId] = useState<any>(null); // no card open on arrival
|
||||
const [query, setQuery] = useState("");
|
||||
const reading = useReadingMode();
|
||||
|
||||
// The list scrolls itself to whatever the map or legend points at.
|
||||
const listRef = useRef<any>(null);
|
||||
|
|
@ -936,6 +998,18 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
);
|
||||
}
|
||||
|
||||
if (reading) {
|
||||
return shell(
|
||||
<ReadingRegions
|
||||
domestic={domestic}
|
||||
international={international}
|
||||
virtual={virtual}
|
||||
groupsIn={groupsIn}
|
||||
subtextFor={subtextFor}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (view === "grid") {
|
||||
return (
|
||||
<GroupGrid
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { ArrowUpRight, CaretRight } from '@phosphor-icons/react';
|
||||
import { useId, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||
import { mediaUrl } from "../../lib/media.ts";
|
||||
import Logo from "../../components/Logo.tsx";
|
||||
|
|
@ -12,6 +13,7 @@ import {
|
|||
byName,
|
||||
} from "../../lib/organizations.ts";
|
||||
import { accentText } from '../../lib/color.ts'
|
||||
import { useReadingMode } from '../../lib/readingMode.ts'
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
ORGANIZATION LIST: VERTICAL
|
||||
|
|
@ -78,9 +80,12 @@ function OrgMark({ org, color }) {
|
|||
return <Logo src={mediaUrl(org.logo)} className="h-8 w-8 object-contain shrink-0" fallback={fallback} />;
|
||||
}
|
||||
|
||||
function OrgRow({ org, pageLabel, siteLabel }) {
|
||||
function OrgRow({ org, pageLabel, siteLabel, titled }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const panelId = useId();
|
||||
const reading = useReadingMode();
|
||||
// Under a block title the names are a level below it.
|
||||
const Name = titled ? "h4" : "h3";
|
||||
|
||||
const color = org.color || FALLBACK_COLOR;
|
||||
const path = orgPath(org);
|
||||
|
|
@ -102,28 +107,36 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
|||
return (
|
||||
<div className="py-3" style={{ borderTop: `1px solid ${RULE}` }}>
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<button
|
||||
onClick={() => setOpen(v => !v)}
|
||||
aria-expanded={open}
|
||||
aria-controls={panelId}
|
||||
className="flex-1 min-w-0 flex items-center gap-3 text-left py-1"
|
||||
>
|
||||
<CaretRight className="ol-chevron h-4 w-4 shrink-0" style={{ color, transform: open ? "rotate(90deg)" : "none" }} weight="bold" aria-hidden="true" />
|
||||
{/* Reading mode can't open the row (the panel reads anyway),
|
||||
so the name is a heading linked to the page instead. */}
|
||||
{reading ? (
|
||||
<div>
|
||||
<Name>{path ? <Link to={path}>{org.name}</Link> : org.name}</Name>
|
||||
{summary && <p>{summary}</p>}
|
||||
</div>
|
||||
) : (
|
||||
<button
|
||||
onClick={() => setOpen(v => !v)}
|
||||
aria-expanded={open}
|
||||
aria-controls={panelId}
|
||||
className="flex-1 min-w-0 flex items-center gap-3 text-left py-1"
|
||||
>
|
||||
<CaretRight className="ol-chevron h-4 w-4 shrink-0" style={{ color, transform: open ? "rotate(90deg)" : "none" }} weight="bold" aria-hidden="true" />
|
||||
|
||||
<OrgMark org={org} color={color} />
|
||||
<OrgMark org={org} color={color} />
|
||||
|
||||
<span className="min-w-0">
|
||||
<span className="block font-display font-bold text-lg leading-tight" style={{ color }}>
|
||||
{org.name}
|
||||
</span>
|
||||
{summary && (
|
||||
<span className="block text-sm leading-snug" style={{ color: MUTED }}>
|
||||
{summary}
|
||||
<span className="min-w-0">
|
||||
<span className="block font-display font-bold text-lg leading-tight" style={{ color }}>
|
||||
{org.name}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
</button>
|
||||
{summary && (
|
||||
<span className="block text-sm leading-snug" style={{ color: MUTED }}>
|
||||
{summary}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
{org.website && (
|
||||
|
|
@ -140,7 +153,7 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
|||
|
||||
{/* Last in the row, so the arrow lines up down the right
|
||||
edge whether or not a row has an outbound site. */}
|
||||
{path && (
|
||||
{path && !reading && (
|
||||
<ArrowLink
|
||||
to={path}
|
||||
label={`${org.name}: ${pageLabel}`}
|
||||
|
|
@ -219,7 +232,7 @@ function Block({ title, orgs, pageLabel, siteLabel }) {
|
|||
</h3>
|
||||
)}
|
||||
{orgs.map(org => (
|
||||
<OrgRow key={org.id} org={org} pageLabel={pageLabel} siteLabel={siteLabel} />
|
||||
<OrgRow key={org.id} org={org} pageLabel={pageLabel} siteLabel={siteLabel} titled={!!title} />
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { MONTH_LABELS, type PersonRef, type TimelineItem } from '../../../lib/ti
|
|||
import { hrefFor, logoSrc } from '../../../lib/timelineRefs.ts'
|
||||
import { initials, mediaUrl } from '../../../lib/media.ts'
|
||||
import { useSmallImage } from '../../../lib/useSmallImage.ts'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
|
||||
const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
||||
milestone: 'Milestone',
|
||||
|
|
@ -57,6 +58,7 @@ type Props = {
|
|||
|
||||
export default function TimelineEntry({ item, variant = 'inline' }: Props) {
|
||||
const featured = variant === 'featured'
|
||||
const reading = useReadingMode()
|
||||
const href = hrefFor(item)
|
||||
const logo = logoSrc(item)
|
||||
|
||||
|
|
@ -117,6 +119,23 @@ export default function TimelineEntry({ item, variant = 'inline' }: Props) {
|
|||
// An explicit href may point off-site; Link is for in-app routes only.
|
||||
const external = !!href && /^(https?:)?\/\//.test(href)
|
||||
|
||||
// Reading mode: the card's link has no heading to carry it, so the
|
||||
// title would read twice and the date not at all. Plain lines instead.
|
||||
if (reading) {
|
||||
const title = !href ? item.title : external ? <a href={href}>{item.title}</a> : <Link to={href}>{item.title}</Link>
|
||||
const facts = [item.precision === 'year' ? '' : fullMarker(item), item.meta].filter(Boolean)
|
||||
return (
|
||||
<li>
|
||||
<p>
|
||||
{title}
|
||||
{facts.map((fact) => `, ${fact}`).join('')}
|
||||
</p>
|
||||
{item.blurb ? <p>{item.blurb}</p> : null}
|
||||
{roster}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<li className="site-tl__entryWrap">
|
||||
{href && external ? (
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { CaretDown, CaretUp } from '@phosphor-icons/react'
|
|||
import { useState } from 'react'
|
||||
import type { GroupedYear, SortDirection } from '../../../lib/timeline.ts'
|
||||
import TimelineYear from './TimelineYear.tsx'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
|
||||
type Props = {
|
||||
years: GroupedYear[]
|
||||
|
|
@ -28,7 +29,11 @@ export default function TimelineUpcoming({
|
|||
openYears,
|
||||
onToggleYear,
|
||||
}: Props) {
|
||||
const [open, setOpen] = useState(false)
|
||||
const [chosen, setOpen] = useState(false)
|
||||
// Reading mode can't press the button: the list is open, under a
|
||||
// heading (its years are h4s, like a decade's) in place of it.
|
||||
const reading = useReadingMode()
|
||||
const open = chosen || reading
|
||||
if (count === 0) return null
|
||||
|
||||
return (
|
||||
|
|
@ -36,22 +41,24 @@ export default function TimelineUpcoming({
|
|||
className={`site-tl__upcoming${open ? ' site-tl__upcoming--open' : ''}`}
|
||||
aria-label="Upcoming"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="site-tl__upcomingBtn"
|
||||
aria-expanded={open}
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
>
|
||||
<span className="site-tl__upcomingDot" aria-hidden="true" />
|
||||
<span className="site-tl__upcomingLabel">
|
||||
{open
|
||||
? 'Hide what’s scheduled'
|
||||
: `${count} ${count === 1 ? 'thing' : 'things'} still to come`}
|
||||
</span>
|
||||
<span className="site-tl__chevron" aria-hidden="true">
|
||||
{open ? <CaretDown weight="bold" /> : <CaretUp weight="bold" />}
|
||||
</span>
|
||||
</button>
|
||||
{reading ? <h3>Still to come</h3> : (
|
||||
<button
|
||||
type="button"
|
||||
className="site-tl__upcomingBtn"
|
||||
aria-expanded={open}
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
>
|
||||
<span className="site-tl__upcomingDot" aria-hidden="true" />
|
||||
<span className="site-tl__upcomingLabel">
|
||||
{open
|
||||
? 'Hide what’s scheduled'
|
||||
: `${count} ${count === 1 ? 'thing' : 'things'} still to come`}
|
||||
</span>
|
||||
<span className="site-tl__chevron" aria-hidden="true">
|
||||
{open ? <CaretDown weight="bold" /> : <CaretUp weight="bold" />}
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{open ? (
|
||||
<div className="site-tl__upcomingList">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import type { CSSProperties } from 'react'
|
||||
import type { GroupedYear } from '../../../lib/timeline.ts'
|
||||
import TimelineEntry from './TimelineEntry.tsx'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
|
||||
/** A solid teal dot per year, its size growing with the year's
|
||||
* entries so the rail reads as a density chart. (A vine or tree
|
||||
|
|
@ -15,8 +16,13 @@ type Props = {
|
|||
onToggle: (year: number) => void
|
||||
}
|
||||
|
||||
export default function TimelineYear({ year, open, onToggle }: Props) {
|
||||
export default function TimelineYear({ year, open: chosen, onToggle }: Props) {
|
||||
// Reading mode can't open a year, so every year is open, the year a
|
||||
// heading in place of its button, and an empty year left out.
|
||||
const reading = useReadingMode()
|
||||
const open = chosen || reading
|
||||
const empty = year.count === 0
|
||||
const MonthLabel = reading ? 'h5' : 'h4'
|
||||
const panelId = `site-tl-year-${year.year}`
|
||||
|
||||
const className = [
|
||||
|
|
@ -28,25 +34,31 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
|||
.filter(Boolean)
|
||||
.join(' ')
|
||||
|
||||
if (reading && empty) return null
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<button
|
||||
type="button"
|
||||
className="site-tl__yearBtn"
|
||||
aria-expanded={open}
|
||||
aria-controls={panelId}
|
||||
onClick={() => onToggle(year.year)}
|
||||
>
|
||||
<span
|
||||
className="site-tl__dot"
|
||||
style={{ '--tl-dot': dotSize(year.count) } as CSSProperties}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="site-tl__yearLabel">{year.year}</span>
|
||||
<span className="site-tl__yearCount">
|
||||
{empty ? '-' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||
</span>
|
||||
</button>
|
||||
{reading ? (
|
||||
<h4>{year.year}</h4>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
className="site-tl__yearBtn"
|
||||
aria-expanded={open}
|
||||
aria-controls={panelId}
|
||||
onClick={() => onToggle(year.year)}
|
||||
>
|
||||
<span
|
||||
className="site-tl__dot"
|
||||
style={{ '--tl-dot': dotSize(year.count) } as CSSProperties}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="site-tl__yearLabel">{year.year}</span>
|
||||
<span className="site-tl__yearCount">
|
||||
{empty ? '-' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{open ? (
|
||||
empty ? (
|
||||
|
|
@ -65,7 +77,7 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
|||
|
||||
{year.months.map((month) => (
|
||||
<section className="site-tl__month" key={month.month}>
|
||||
<h4 className="site-tl__monthLabel">{month.label}</h4>
|
||||
<MonthLabel className="site-tl__monthLabel">{month.label}</MonthLabel>
|
||||
<ul className="site-tl__list">
|
||||
{month.items.map((item) => (
|
||||
<TimelineEntry key={item.id} item={item} />
|
||||
|
|
@ -76,7 +88,7 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
|||
|
||||
{year.undated.length > 0 ? (
|
||||
<section className="site-tl__month site-tl__undated">
|
||||
<h4 className="site-tl__monthLabel">Elsewhere in {year.year}</h4>
|
||||
<MonthLabel className="site-tl__monthLabel">Elsewhere in {year.year}</MonthLabel>
|
||||
<ul className="site-tl__list">
|
||||
{year.undated.map((item) => (
|
||||
<TimelineEntry key={item.id} item={item} />
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
doesn't open it.
|
||||
|
||||
Nothing featured, and the section doesn't render at all.
|
||||
|
||||
Reading mode (readingMode.ts) gets the entries as text, oldest
|
||||
first, each a linked heading with its date and words (ReadingRail).
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight, CaretRight, CaretLeft } from '@phosphor-icons/react';
|
||||
|
|
@ -29,6 +32,7 @@ import { hrefFor, logoSrc } from '../../../lib/timelineRefs.ts'
|
|||
import { MONTH_LABELS, type TimelineItem } from '../../../lib/timeline.ts'
|
||||
import { accentText, BRAND } from '../../../lib/color.ts'
|
||||
import { scrollBehavior } from '../../../lib/motion.ts';
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
|
||||
const DRAG_SLOP = 6
|
||||
|
||||
|
|
@ -43,9 +47,29 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
|||
const railRef = useRef<HTMLOListElement>(null)
|
||||
const drag = useRef({ x: 0, left: 0, moved: false, active: false })
|
||||
const [dragging, setDragging] = useState(false)
|
||||
const reading = useReadingMode()
|
||||
|
||||
if (!loading && !error && featured.length === 0) return null
|
||||
|
||||
if (reading) {
|
||||
return (
|
||||
<section id={id}>
|
||||
<h2>{title}</h2>
|
||||
{blurb && <p>{blurb}</p>}
|
||||
{error ? (
|
||||
<p>Couldn’t load the timeline. {error}</p>
|
||||
) : loading ? (
|
||||
<p>Loading the timeline…</p>
|
||||
) : (
|
||||
featured.map((item) => <ReadingEntry key={item.id} item={item} />)
|
||||
)}
|
||||
<p>
|
||||
<Link to="/history">See the full history</Link>
|
||||
</p>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const step = (direction: number) => {
|
||||
const rail = railRef.current
|
||||
const card = rail?.querySelector('li')
|
||||
|
|
@ -182,6 +206,17 @@ function dateLabel(item: TimelineItem): string {
|
|||
return y
|
||||
}
|
||||
|
||||
function ReadingEntry({ item }: { item: TimelineItem }) {
|
||||
const href = hrefFor(item)
|
||||
return (
|
||||
<>
|
||||
<h3>{href ? <HomeLink url={href}>{item.title}</HomeLink> : item.title}</h3>
|
||||
<p>{[dateLabel(item), item.meta].filter(Boolean).join(', ')}</p>
|
||||
{item.blurb && <p>{item.blurb}</p>}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function RailCard({ item, showYear }: { item: TimelineItem; showYear: boolean }) {
|
||||
const href = hrefFor(item)
|
||||
const logo = logoSrc(item)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
`hero` is null while the page config loads or when it failed; the
|
||||
stage still draws, empty, so the page doesn't jump when it
|
||||
arrives. The error itself is shown by Home, not here.
|
||||
|
||||
Reading mode (readingMode.ts) gets it as text (ReadingHero): the
|
||||
words and buttons, every photo's caption at once (no slideshow),
|
||||
then the feature as a link, or the event's card.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight, Play, Pause, Star } from '@phosphor-icons/react'
|
||||
|
|
@ -47,6 +51,7 @@ import { livestreamEmbedUrl, videoSource, type VideoSource } from '../../../lib/
|
|||
import { mediaUrl } from '../../../lib/media.ts'
|
||||
import { prefersLessMotion } from '../../../lib/motion.ts'
|
||||
import { focusOnMount } from '../../../lib/focus.ts'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
import { eventHref } from '../../../lib/hrefs.ts'
|
||||
import { seriesLabel } from '../../../lib/eventSeries.ts'
|
||||
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
|
||||
|
|
@ -73,6 +78,14 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
|
|||
// Every feature shares a layout: words left, feature right.
|
||||
const beside = feature !== 'none'
|
||||
|
||||
if (useReadingMode()) {
|
||||
return (
|
||||
<section id="hero">
|
||||
{hero && <ReadingHero hero={hero} feature={feature} slides={backdrop === 'photos' ? slides : []} video={video} />}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
id="hero"
|
||||
|
|
@ -186,6 +199,73 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
|||
)
|
||||
}
|
||||
|
||||
/* ── Reading mode ──────────────────────────────────────────────
|
||||
The hero as text: its words and buttons, the photos' captions
|
||||
(all of them, not the one a timer is showing), then the feature:
|
||||
a link out to the stream or the video, or the event's card,
|
||||
which already reads plainly. */
|
||||
|
||||
type ReadingHeroProps = {
|
||||
hero: Hero
|
||||
feature: HeroFeature
|
||||
slides: HeroSlide[]
|
||||
video: VideoSource | null
|
||||
}
|
||||
|
||||
function ReadingHero({ hero, feature, slides, video }: ReadingHeroProps) {
|
||||
const captions = slides.filter((slide) => slide.caption)
|
||||
return (
|
||||
<>
|
||||
{feature === 'none' && hero.eyebrow && <p>{hero.eyebrow}</p>}
|
||||
<h1>{hero.headline}</h1>
|
||||
{hero.subhead && <p>{hero.subhead}</p>}
|
||||
{[hero.primary, hero.secondary].map(
|
||||
(button) =>
|
||||
button && (
|
||||
<p key={button.url}>
|
||||
<HomeLink url={button.url}>{button.label}</HomeLink>
|
||||
</p>
|
||||
),
|
||||
)}
|
||||
|
||||
{captions.length > 0 && (
|
||||
<ul>
|
||||
{captions.map((slide, index) => (
|
||||
<li key={`${slide.media}-${index}`}>
|
||||
{slide.link_url ? <HomeLink url={slide.link_url}>{slide.caption}</HomeLink> : slide.caption}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{feature === 'livestream' && hero.livestream && (
|
||||
<p>
|
||||
Live now{hero.livestream.title && `: ${hero.livestream.title}`}.{' '}
|
||||
<HomeLink url={hero.livestream.url}>Watch live</HomeLink>
|
||||
</p>
|
||||
)}
|
||||
|
||||
{feature === 'video' && hero.video && (
|
||||
<p>
|
||||
Featured video:{' '}
|
||||
{video?.kind === 'file' ? (
|
||||
<a href={video.src}>{hero.video.title || 'Watch the video'}</a>
|
||||
) : (
|
||||
<HomeLink url={hero.video.url}>{hero.video.title || 'Watch the video'}</HomeLink>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{feature === 'event' && hero.event && (
|
||||
<>
|
||||
<p>Featured event</p>
|
||||
<EventPanel event={hero.event} />
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
/* ── The hero's buttons ──────────────────────────────────────────
|
||||
Both set: one cell in two halves, the primary filled on the left
|
||||
and the secondary clear on the right, split by a slash (the
|
||||
|
|
|
|||
|
|
@ -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