Compare commits
5 commits
f4868f19fc
...
07e56bfd20
| Author | SHA1 | Date | |
|---|---|---|---|
| 07e56bfd20 | |||
|
|
27e5fbd690 | ||
|
|
c79910ef8d | ||
|
|
502a294940 | ||
|
|
de17da7dc8 |
42 changed files with 1371 additions and 390 deletions
|
|
@ -71,7 +71,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
|
||||||
- **Imports need explicit extensions** (`.ts`, `.tsx`, `.js`) everywhere.
|
- **Imports need explicit extensions** (`.ts`, `.tsx`, `.js`) everywhere.
|
||||||
- **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names.
|
- **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names.
|
||||||
- **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface.
|
- **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface.
|
||||||
- **Colors are tokens, not hex.** Admins can override any token (Panel → Site settings → Colors). The defaults are `server/src/themeDefaults.js` plus the same values as CSS in `src/index.css`; the build fails if they differ (`themeDefaultsCheck` in `vite.config.ts`), and migration 041's CHECK lists the token names. Use the utilities from `src/index.css` (`text-ink`, `text-body`, `text-muted`, `text-link`, `bg-surface`, `bg-tint`, `bg-action`, `border-brand/20`...) so dark mode works; a literal only for something that must look the same in both modes (white on a dark band, a platform's color). Data colors (accents, event and region colors) go through `withAlpha`, `accentText` and `readableOn` in `src/lib/color.ts`, never `${color}55`.
|
- **Colors are tokens, not hex.** Admins can override any token (Panel → Site settings → Colors). The defaults are `server/src/themeDefaults.js` plus the same values as CSS in `src/index.css`; the build fails if they differ (`themeDefaultsCheck` in `vite.config.ts`), and migration 041's CHECK lists the token names. Use the utilities from `src/index.css` (`text-ink`, `text-body`, `text-muted`, `text-link`, `bg-surface`, `bg-tint`, `bg-action`, `border-brand/20`...) so dark mode works; a literal only for something that must look the same in both modes (white on a dark band, a platform's color). Data colors (accents, event and region colors) go through `withAlpha`, `accentText` and `readableOn` in `src/lib/color.ts`, never `${color}55`. A palette color in a component or CSS file is `var(--pal-<family>-<shade>)`, not its hex, so the color blind modes reach it.
|
||||||
- **Icons are Phosphor** (`@phosphor-icons/react`), weight `bold` (or `fill` for play/star). No hand-drawn `<svg>` icons and no Unicode glyphs as icons (× › ▶ →). Brand marks are the exception: `DoveMark`, `PlatformIcon`, the Google logo, the group map.
|
- **Icons are Phosphor** (`@phosphor-icons/react`), weight `bold` (or `fill` for play/star). No hand-drawn `<svg>` icons and no Unicode glyphs as icons (× › ▶ →). Brand marks are the exception: `DoveMark`, `PlatformIcon`, the Google logo, the group map.
|
||||||
- **Accents come from `src/lib/color.ts`:** `BRAND` (the teal, via the button token so the admin palette reaches it) and `ACCENTS` (deep, green, olive), all from `PALETTE` (the site's 16-color grid). Not a new hex in a page.
|
- **Accents come from `src/lib/color.ts`:** `BRAND` (the teal, via the button token so the admin palette reaches it) and `ACCENTS` (deep, green, olive), all from `PALETTE` (the site's 16-color grid). Not a new hex in a page.
|
||||||
- **Corners: square.** Everything is square except buttons, which use the `btn` utility (Poppins Bold, a small `var(--btn-radius)` corner, also for plain CSS), video players (small rounded) and things round by nature (dots, radio marks, the play button). A note in place of content (empty section, "coming soon") uses the `notice` utility (corner brackets), not a dashed border. Cards sit on `bg-raised` with a shadow so they stand off the page. Nothing glows: no blur blobs, no glow shadows.
|
- **Corners: square.** Everything is square except buttons, which use the `btn` utility (Poppins Bold, a small `var(--btn-radius)` corner, also for plain CSS), video players (small rounded) and things round by nature (dots, radio marks, the play button). A note in place of content (empty section, "coming soon") uses the `notice` utility (corner brackets), not a dashed border. Cards sit on `bg-raised` with a shadow so they stand off the page. Nothing glows: no blur blobs, no glow shadows.
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ also in `server/src/admin-schema/` and a CHECK):
|
||||||
|
|
||||||
| Entity → field | Stored values | Labeled? | Also used on the public site by |
|
| Entity → field | Stored values | Labeled? | Also used on the public site by |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| Organizations → Kind (+ list filter) | national, region, group, partner | no, shows values | `ORG_BASE` in `src/lib/hrefs.ts` (the route each kind uses) and `orgListHref` there (its back link) |
|
| Organizations → Kind (+ list filter) | national, region, group, partner | no, shows values | `ORG_BASE` in `src/lib/hrefs.ts` (the route each kind uses) |
|
||||||
| Organizations → Region → Scope | domestic, international, virtual | no | the Community page groups regions by it |
|
| Organizations → Region → Scope | domestic, international, virtual | no | the Community page groups regions by it |
|
||||||
| Organizations → Region areas → Edge | top, bottom | no | the group map (`OrgList-Map.tsx`) |
|
| Organizations → Region areas → Edge | top, bottom | no | the group map (`OrgList-Map.tsx`) |
|
||||||
| Events → Type (+ list filter) | retreat, class, workshop, meeting, other | no | `EVENT_TYPES` in `src/lib/eventTypes.ts` (public labels and plurals) |
|
| Events → Type (+ list filter) | retreat, class, workshop, meeting, other | no | `EVENT_TYPES` in `src/lib/eventTypes.ts` (public labels and plurals) |
|
||||||
|
|
@ -279,11 +279,11 @@ The numbers band's "Number Source" dropdown works the same way:
|
||||||
| The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. |
|
| The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. |
|
||||||
| A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. |
|
| A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. |
|
||||||
| The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. |
|
| The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. |
|
||||||
| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `<html>` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode swaps palette families (`SWAPS`, picked by simulating each type: see the comment there) in code, in data colors as they load (`src/lib/api.ts`, never under /admin) and in CSS (the `--green-*` variables in `src/index.css`); a hex from the green family in a component should be one of those variables. Something saved or sent (the newsletter's colors) uses `STORED_PALETTE`, which is never swapped. |
|
| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `<html>` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal-<family>-<shade>)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well (a carousel, tabs, details behind a click, a map) draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the hero, pathfinder, stats, history rail, event lists, calendar (the next six weeks), featured cards, org lists and groups map, history timeline, schedule, people tiles and video player; the countdown draws nothing. A new component with any of those should do the same. Something saved or sent (the newsletter's colors) uses `STORED_PALETTE`, which is never swapped. |
|
||||||
| Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
|
| Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
|
||||||
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
||||||
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
||||||
| Organization kind labels ("Region", "Group") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin); `orgListHref` in `src/lib/hrefs.ts` (the public back link, "All regions") | |
|
| Organization kind labels ("Region", "Group") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin) | |
|
||||||
| Admin account roles | `src/lib/roles.ts` (labels, notes) and `ROLES` in `server/src/auth.js` | Adding a role is also a CHECK change on `admin_users.role`. |
|
| Admin account roles | `src/lib/roles.ts` (labels, notes) and `ROLES` in `server/src/auth.js` | Adding a role is also a CHECK change on `admin_users.role`. |
|
||||||
| Admin navigation | `src/pages/admin/adminNav.ts` | |
|
| Admin navigation | `src/pages/admin/adminNav.ts` | |
|
||||||
| Newsletter parts and their defaults (Tools → Newsletter) | `PARTS_SPEC`, `PART_TYPES` and `STARTER` in `src/pages/admin/AdminNewsletter.tsx`; `PICK_DEFAULTS`, `DEFAULT_TITLE` and `COLOR` in `src/lib/newsletter.ts` | A draft is one JSON list of parts (`newsletters.layout`, 060), so adding a part or a setting needs no migration: a field in `PARTS_SPEC` and its drawing in `newsletter.ts`. The color choices are `PALETTE`; `COLOR` holds the defaults as hex, since an inbox has no theme tokens. `STARTER` is what a new draft starts with. The social bar's icons are PNGs in `public/email/` (Gmail and Outlook don't show SVG), made from `PlatformIcon.tsx` by `node scripts/email-icons.mjs`: run it again after adding a platform. A social bar with no links shows the footer's, `SOCIAL_LINKS` in `src/data/socialLinks.ts`. The countdown picture is `server/src/routes/countdown.js`, counting to local midnight in its `TIME_ZONE` (America/Chicago). |
|
| Newsletter parts and their defaults (Tools → Newsletter) | `PARTS_SPEC`, `PART_TYPES` and `STARTER` in `src/pages/admin/AdminNewsletter.tsx`; `PICK_DEFAULTS`, `DEFAULT_TITLE` and `COLOR` in `src/lib/newsletter.ts` | A draft is one JSON list of parts (`newsletters.layout`, 060), so adding a part or a setting needs no migration: a field in `PARTS_SPEC` and its drawing in `newsletter.ts`. The color choices are `PALETTE`; `COLOR` holds the defaults as hex, since an inbox has no theme tokens. `STARTER` is what a new draft starts with. The social bar's icons are PNGs in `public/email/` (Gmail and Outlook don't show SVG), made from `PlatformIcon.tsx` by `node scripts/email-icons.mjs`: run it again after adding a platform. A social bar with no links shows the footer's, `SOCIAL_LINKS` in `src/data/socialLinks.ts`. The countdown picture is `server/src/routes/countdown.js`, counting to local midnight in its `TIME_ZONE` (America/Chicago). |
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
Dyslexia-friendly font every typeface becomes OpenDyslexic
|
Dyslexia-friendly font every typeface becomes OpenDyslexic
|
||||||
(self-hosted, index.css)
|
(self-hosted, index.css)
|
||||||
Reading mode the page as plain text: one column of
|
Reading mode the page as text: its headings,
|
||||||
ink on white, no colors, pictures,
|
paragraphs, links and described
|
||||||
cards or motion; a picture's
|
pictures in one column, nothing else
|
||||||
description stays in its place
|
(ReaderView.tsx)
|
||||||
Color blind mode the palette swapped so its colors stay
|
Color blind mode the palette swapped so its colors stay
|
||||||
apart for that type of color blindness,
|
apart for that type of color blindness,
|
||||||
or grays (color.ts, VISIONS)
|
or grays (color.ts, VISIONS)
|
||||||
|
|
@ -53,7 +53,7 @@ const SETTINGS = [
|
||||||
key: 'site-reading',
|
key: 'site-reading',
|
||||||
on: 'on',
|
on: 'on',
|
||||||
label: 'Reading mode',
|
label: 'Reading mode',
|
||||||
help: 'The page as plain text: one column, larger type, no colors, pictures or motion.',
|
help: 'The page as text: headings, paragraphs, links and pictures in one column, nothing else.',
|
||||||
},
|
},
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
|
|
@ -87,30 +87,6 @@ function apply(attribute: string, key: string, value: string | null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reading mode hides pictures, video and maps; their descriptions
|
|
||||||
(alt, title, aria-label) go on the parent as data-reading-alt,
|
|
||||||
which index.css shows in their place. An attribute rather than a
|
|
||||||
new element, so React's own nodes are left alone. */
|
|
||||||
const DESCRIBED = 'main img[alt]:not([alt=""]), main iframe[title], main video[aria-label]'
|
|
||||||
|
|
||||||
function describeMedia() {
|
|
||||||
for (const el of document.querySelectorAll(DESCRIBED)) {
|
|
||||||
const words = el.getAttribute('alt') ?? el.getAttribute('title') ?? el.getAttribute('aria-label')
|
|
||||||
const kind = el.tagName === 'IMG' ? 'Image' : 'Video'
|
|
||||||
el.parentElement?.setAttribute('data-reading-alt', `${kind}: ${words}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function useMediaDescriptions(on: boolean) {
|
|
||||||
useEffect(() => {
|
|
||||||
if (!on) return undefined
|
|
||||||
describeMedia()
|
|
||||||
const observer = new MutationObserver(describeMedia)
|
|
||||||
observer.observe(document.body, { childList: true, subtree: true })
|
|
||||||
return () => observer.disconnect()
|
|
||||||
}, [on])
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function AccessibilityPanel() {
|
export default function AccessibilityPanel() {
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const [state, setState] = useState(() => Object.fromEntries(SETTINGS.map((s) => [s.key, isOn(s)])))
|
const [state, setState] = useState(() => Object.fromEntries(SETTINGS.map((s) => [s.key, isOn(s)])))
|
||||||
|
|
@ -120,8 +96,6 @@ export default function AccessibilityPanel() {
|
||||||
const firstRef = useRef<HTMLButtonElement>(null)
|
const firstRef = useRef<HTMLButtonElement>(null)
|
||||||
const panelId = useId()
|
const panelId = useId()
|
||||||
|
|
||||||
useMediaDescriptions(state['site-reading'])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const root = document.documentElement
|
const root = document.documentElement
|
||||||
for (const { attribute, key } of PUBLIC_ONLY) {
|
for (const { attribute, key } of PUBLIC_ONLY) {
|
||||||
|
|
@ -187,7 +161,7 @@ export default function AccessibilityPanel() {
|
||||||
id={panelId}
|
id={panelId}
|
||||||
role="region"
|
role="region"
|
||||||
aria-label="Accessibility"
|
aria-label="Accessibility"
|
||||||
className="reading-solid absolute right-0 bottom-full mb-3 w-[min(20rem,calc(100vw-2rem))] border border-brand/20 bg-raised p-4 shadow-xl"
|
className="absolute right-0 bottom-full mb-3 w-[min(20rem,calc(100vw-2rem))] border border-brand/20 bg-raised p-4 shadow-xl"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between gap-4">
|
<div className="flex items-center justify-between gap-4">
|
||||||
<h2 className="font-display text-base font-bold text-ink">Accessibility</h2>
|
<h2 className="font-display text-base font-bold text-ink">Accessibility</h2>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export default function Banner() {
|
||||||
if (!visible) return null;
|
if (!visible) return null;
|
||||||
|
|
||||||
const linkClass =
|
const linkClass =
|
||||||
"underline underline-offset-4 decoration-[var(--green-2)] hover:text-white transition-colors";
|
"underline underline-offset-4 decoration-[var(--pal-green-2)] hover:text-white transition-colors";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,10 @@
|
||||||
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
|
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
|
||||||
line breaks, and a blank line for a new paragraph.
|
line breaks, and a blank line for a new paragraph.
|
||||||
|
|
||||||
|
Reading mode (readingMode.ts): a linked image with no alt text
|
||||||
|
is a line linking with its caption, and a video's caption is its
|
||||||
|
link (VideoPlayer), not said twice.
|
||||||
|
|
||||||
An unknown `type` renders its text as a paragraph rather than
|
An unknown `type` renders its text as a paragraph rather than
|
||||||
disappearing. A block somebody typed into the admin should be
|
disappearing. A block somebody typed into the admin should be
|
||||||
visible even if the renderer hasn't caught up with it.
|
visible even if the renderer hasn't caught up with it.
|
||||||
|
|
@ -50,6 +54,7 @@ import { accentText, BRAND } from '../lib/color.ts'
|
||||||
import { headingAnchors } from '../lib/contents.ts'
|
import { headingAnchors } from '../lib/contents.ts'
|
||||||
import { SITE_NAME } from '../lib/site.ts'
|
import { SITE_NAME } from '../lib/site.ts'
|
||||||
import { useSmallImage } from '../lib/useSmallImage.ts'
|
import { useSmallImage } from '../lib/useSmallImage.ts'
|
||||||
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
|
|
||||||
const BODY = 'var(--color-muted)'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
|
|
@ -66,11 +71,20 @@ export default function ContentBlocks({
|
||||||
// Headings get ids so a post's contents (PostContents) and a shared
|
// Headings get ids so a post's contents (PostContents) and a shared
|
||||||
// link (#getting-there) can point at them.
|
// link (#getting-there) can point at them.
|
||||||
const { idAt } = headingAnchors(blocks)
|
const { idAt } = headingAnchors(blocks)
|
||||||
|
// The heading level a block's own headings take: under the last
|
||||||
|
// heading (h3) or subheading (h4) before it, else the section's h2.
|
||||||
|
let under = 2
|
||||||
|
const levels = blocks.map((block) => {
|
||||||
|
const level = (under + 1) as 3 | 4 | 5
|
||||||
|
if (block.type === 'heading') under = 3
|
||||||
|
if (block.type === 'subheading') under = 4
|
||||||
|
return level
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`space-y-6 ${className}`}>
|
<div className={`space-y-6 ${className}`}>
|
||||||
{blocks.map((block, index) => (
|
{blocks.map((block, index) => (
|
||||||
<Block key={block.id ?? index} block={block} accent={accent} anchor={idAt.get(index)} />
|
<Block key={block.id ?? index} block={block} accent={accent} anchor={idAt.get(index)} level={levels[index]} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
@ -135,8 +149,19 @@ function Caption({ text }: { text?: string | null }) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Block({ block, accent, anchor }: { block: ContentBlock; accent: string; anchor?: string }) {
|
function Block({
|
||||||
|
block,
|
||||||
|
accent,
|
||||||
|
anchor,
|
||||||
|
level,
|
||||||
|
}: {
|
||||||
|
block: ContentBlock
|
||||||
|
accent: string
|
||||||
|
anchor?: string
|
||||||
|
level: 3 | 4 | 5
|
||||||
|
}) {
|
||||||
const text = block.text ?? ''
|
const text = block.text ?? ''
|
||||||
|
const reading = useReadingMode()
|
||||||
|
|
||||||
switch (block.type) {
|
switch (block.type) {
|
||||||
case 'heading':
|
case 'heading':
|
||||||
|
|
@ -294,6 +319,14 @@ function Block({ block, accent, anchor }: { block: ContentBlock; accent: string;
|
||||||
case 'image': {
|
case 'image': {
|
||||||
const src = mediaUrl(block.media)
|
const src = mediaUrl(block.media)
|
||||||
if (!src) return null
|
if (!src) return null
|
||||||
|
// The reader leaves out a picture with no alt, and its link with it.
|
||||||
|
if (reading && block.href && !block.alt) {
|
||||||
|
return (
|
||||||
|
<p>
|
||||||
|
<Anchor href={block.href}>{text || 'Open link'}</Anchor>
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
}
|
||||||
const img = (
|
const img = (
|
||||||
<img
|
<img
|
||||||
src={src}
|
src={src}
|
||||||
|
|
@ -320,7 +353,7 @@ function Block({ block, accent, anchor }: { block: ContentBlock; accent: string;
|
||||||
<div className="overflow-hidden">
|
<div className="overflow-hidden">
|
||||||
<VideoPlayer url={block.href} still={mediaUrl(block.media)} title={text || null} />
|
<VideoPlayer url={block.href} still={mediaUrl(block.media)} title={text || null} />
|
||||||
</div>
|
</div>
|
||||||
<Caption text={text} />
|
{!reading && <Caption text={text} />}
|
||||||
</figure>
|
</figure>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -335,8 +368,8 @@ function Block({ block, accent, anchor }: { block: ContentBlock; accent: string;
|
||||||
if (!block.team_id && picked.length === 0) return null
|
if (!block.team_id && picked.length === 0) return null
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
{block.team_id && <PeopleTiles size="lg" teams={block.team_id} accent={accent} />}
|
{block.team_id && <PeopleTiles size="lg" teams={block.team_id} accent={accent} headingLevel={level} />}
|
||||||
{picked.length > 0 && <PeopleTiles size="lg" people={picked} accent={accent} />}
|
{picked.length > 0 && <PeopleTiles size="lg" people={picked} accent={accent} headingLevel={level} />}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@
|
||||||
fall outside), 4px thick. With three or more cards the first is the large
|
fall outside), 4px thick. With three or more cards the first is the large
|
||||||
one, two rows tall, and the next two stack beside it, so it no
|
one, two rows tall, and the next two stack beside it, so it no
|
||||||
longer stretches its neighbor.
|
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. `level` is that
|
||||||
|
heading's level, one under the heading above the cards.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -31,6 +35,7 @@ import VideoPlayer from './VideoPlayer.tsx'
|
||||||
import { refHref } from '../lib/hrefs.ts'
|
import { refHref } from '../lib/hrefs.ts'
|
||||||
import { mediaUrl } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import type { FeaturedCard } from '../lib/useFrontPage.ts'
|
import type { FeaturedCard } from '../lib/useFrontPage.ts'
|
||||||
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
import { useSmallImage } from '../lib/useSmallImage.ts'
|
import { useSmallImage } from '../lib/useSmallImage.ts'
|
||||||
|
|
||||||
/* Image kinds that are photographs, drawn edge to edge. Anything
|
/* Image kinds that are photographs, drawn edge to edge. Anything
|
||||||
|
|
@ -80,8 +85,9 @@ function VideoPicture({ card }: { card: FeaturedCard }) {
|
||||||
|
|
||||||
const RULE = 'border-brand'
|
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 href = hrefFor(card)
|
||||||
|
const Title = level === 4 ? 'h4' : 'h3'
|
||||||
|
|
||||||
const text = (
|
const text = (
|
||||||
<div className={`flex flex-1 flex-col ${large ? 'p-8 md:p-10' : 'p-7'}`}>
|
<div className={`flex flex-1 flex-col ${large ? 'p-8 md:p-10' : 'p-7'}`}>
|
||||||
|
|
@ -89,7 +95,7 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
|
||||||
<p className="text-sm font-semibold text-link">{card.eyebrow}</p>
|
<p className="text-sm font-semibold text-link">{card.eyebrow}</p>
|
||||||
)}
|
)}
|
||||||
{card.title && (
|
{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 ? (
|
{href ? (
|
||||||
// Stretched over the whole card, so the picture and the
|
// Stretched over the whole card, so the picture and the
|
||||||
// blurb are part of the click without nesting links.
|
// blurb are part of the click without nesting links.
|
||||||
|
|
@ -102,7 +108,7 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
|
||||||
) : (
|
) : (
|
||||||
card.title
|
card.title
|
||||||
)}
|
)}
|
||||||
</h3>
|
</Title>
|
||||||
)}
|
)}
|
||||||
{card.blurb && (
|
{card.blurb && (
|
||||||
<p className={`mt-2 leading-relaxed text-muted ${large ? '' : 'line-clamp-3 text-sm'}`}>{card.blurb}</p>
|
<p className={`mt-2 leading-relaxed text-muted ${large ? '' : 'line-clamp-3 text-sm'}`}>{card.blurb}</p>
|
||||||
|
|
@ -131,7 +137,29 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function FeaturedCards({ 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) => {
|
||||||
|
const href = card.kind === 'video' ? card.url : hrefFor(card)
|
||||||
|
return (
|
||||||
|
<div key={`${card.kind}-${card.ref?.id ?? card.url}-${index}`}>
|
||||||
|
{card.eyebrow && <p>{card.eyebrow}</p>}
|
||||||
|
{card.title && <Title>{href ? <HomeLink url={href}>{card.title}</HomeLink> : card.title}</Title>}
|
||||||
|
{card.blurb && <p>{card.blurb}</p>}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function FeaturedCards({ cards, level = 3 }: FeaturedCardsProps) {
|
||||||
|
const reading = useReadingMode()
|
||||||
|
if (reading) return <ReadingCards cards={cards} level={level} />
|
||||||
const leadLarge = cards.length >= 3
|
const leadLarge = cards.length >= 3
|
||||||
return (
|
return (
|
||||||
<div className="overflow-hidden shadow-md">
|
<div className="overflow-hidden shadow-md">
|
||||||
|
|
@ -141,6 +169,7 @@ export default function FeaturedCards({ cards }: { cards: FeaturedCard[] }) {
|
||||||
key={`${card.kind}-${card.ref?.id ?? card.url}-${index}`}
|
key={`${card.kind}-${card.ref?.id ?? card.url}-${index}`}
|
||||||
card={card}
|
card={card}
|
||||||
large={leadLarge && index === 0}
|
large={leadLarge && index === 0}
|
||||||
|
level={level}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,14 @@ const Footer_Links = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const footerLinkClass =
|
const footerLinkClass =
|
||||||
"text-white/65 hover:text-[var(--green-2)] text-sm transition-colors";
|
"text-white/65 hover:text-[var(--pal-green-2)] text-sm transition-colors";
|
||||||
|
|
||||||
// inline-block with a little height of its own, so a finger can hit it.
|
// inline-block with a little height of its own, so a finger can hit it.
|
||||||
const pageLinkClass =
|
const pageLinkClass =
|
||||||
"inline-block py-1 text-white/80 hover:text-[var(--green-2)] text-sm font-semibold transition-colors";
|
"inline-block py-1 text-white/80 hover:text-[var(--pal-green-2)] text-sm font-semibold transition-colors";
|
||||||
|
|
||||||
const sectionLinkClass =
|
const sectionLinkClass =
|
||||||
"inline-block py-1 text-white/65 hover:text-[var(--green-2)] text-sm transition-colors";
|
"inline-block py-1 text-white/65 hover:text-[var(--pal-green-2)] text-sm transition-colors";
|
||||||
|
|
||||||
const headingClass = "text-white/90 text-sm font-semibold mb-4";
|
const headingClass = "text-white/90 text-sm font-semibold mb-4";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,10 @@ import Footer from "./Footer.tsx";
|
||||||
import PrivacyNotice from "./PrivacyNotice.tsx";
|
import PrivacyNotice from "./PrivacyNotice.tsx";
|
||||||
import PageBackdrop from "./PageBackdrop.tsx";
|
import PageBackdrop from "./PageBackdrop.tsx";
|
||||||
import AccessibilityPanel from "./AccessibilityPanel.tsx";
|
import AccessibilityPanel from "./AccessibilityPanel.tsx";
|
||||||
|
import ReaderView from "./ReaderView.tsx";
|
||||||
import ThemeToggle from "./ThemeToggle.tsx";
|
import ThemeToggle from "./ThemeToggle.tsx";
|
||||||
import { jumpTo } from "../lib/focus.ts";
|
import { jumpTo } from "../lib/focus.ts";
|
||||||
|
import { useReadingMode } from "../lib/readingMode.ts";
|
||||||
|
|
||||||
/* ── Right-side nav actions ──────────────────────────────── */
|
/* ── Right-side nav actions ──────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -88,6 +90,9 @@ export default function Layout() {
|
||||||
const [dismissed, setDismissed] = useState<string | null>(null);
|
const [dismissed, setDismissed] = useState<string | null>(null);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const lastPath = useRef(location.pathname);
|
const lastPath = useRef(location.pathname);
|
||||||
|
const reading = useReadingMode();
|
||||||
|
// The page itself, drawn hidden for the reader view to read.
|
||||||
|
const pageRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const sectionsOf = useNavSections();
|
const sectionsOf = useNavSections();
|
||||||
|
|
||||||
|
|
@ -124,19 +129,20 @@ export default function Layout() {
|
||||||
);
|
);
|
||||||
ro.observe(el);
|
ro.observe(el);
|
||||||
return () => ro.disconnect();
|
return () => ro.disconnect();
|
||||||
}, []);
|
}, [reading]);
|
||||||
|
|
||||||
// On the root, so anything can read it: index.css keeps focused
|
// On the root, so anything can read it: index.css keeps focused
|
||||||
// and jumped-to things clear of the header with it
|
// and jumped-to things clear of the header with it
|
||||||
// (scroll-padding-top), and PostContents offsets by it.
|
// (scroll-padding-top), and PostContents offsets by it.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const root = document.documentElement;
|
const root = document.documentElement;
|
||||||
root.style.setProperty("--header-h", `${headerHeight}px`);
|
// Reading mode has no header to stay clear of.
|
||||||
|
root.style.setProperty("--header-h", `${reading ? 0 : headerHeight}px`);
|
||||||
// The admin has no fixed header: nothing to stay clear of there.
|
// The admin has no fixed header: nothing to stay clear of there.
|
||||||
return () => {
|
return () => {
|
||||||
root.style.removeProperty("--header-h");
|
root.style.removeProperty("--header-h");
|
||||||
};
|
};
|
||||||
}, [headerHeight]);
|
}, [headerHeight, reading]);
|
||||||
|
|
||||||
// Router does not scroll on navigation. Go to top on a new page,
|
// Router does not scroll on navigation. Go to top on a new page,
|
||||||
// or to the anchor if the URL carries one (handles deep links too).
|
// or to the anchor if the URL carries one (handles deep links too).
|
||||||
|
|
@ -151,17 +157,42 @@ export default function Layout() {
|
||||||
if (newPage) document.getElementById("main")?.focus({ preventScroll: true });
|
if (newPage) document.getElementById("main")?.focus({ preventScroll: true });
|
||||||
}, [location.pathname, location.hash, location.key]);
|
}, [location.pathname, location.hash, location.key]);
|
||||||
|
|
||||||
return (
|
const skipLink = (
|
||||||
// overflow-x-clip, not -hidden: hidden makes this div a scroll
|
|
||||||
// container, and then nothing inside it can be position: sticky
|
|
||||||
// (a blog post's contents column scrolled away with the page).
|
|
||||||
<div className="min-h-screen overflow-x-clip">
|
|
||||||
<a
|
<a
|
||||||
href="#main"
|
href="#main"
|
||||||
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:bg-surface focus:px-4 focus:py-2 focus:font-semibold focus:text-ink"
|
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:bg-surface focus:px-4 focus:py-2 focus:font-semibold focus:text-ink"
|
||||||
>
|
>
|
||||||
Skip to content
|
Skip to content
|
||||||
</a>
|
</a>
|
||||||
|
);
|
||||||
|
|
||||||
|
// Reading mode: the page as plain text (ReaderView.tsx), with no
|
||||||
|
// header, backdrop, footer or notices; the panel stays, to turn it
|
||||||
|
// off. The page itself still renders, hidden, for the reader to
|
||||||
|
// read, so every page works without a version of its own.
|
||||||
|
if (reading) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-surface text-ink">
|
||||||
|
{skipLink}
|
||||||
|
<main id="main" tabIndex={-1} className="outline-none">
|
||||||
|
<ReaderView source={pageRef} />
|
||||||
|
<div ref={pageRef} hidden>
|
||||||
|
<Suspense fallback={null}>
|
||||||
|
<Outlet />
|
||||||
|
</Suspense>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<AccessibilityPanel />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
// overflow-x-clip, not -hidden: hidden makes this div a scroll
|
||||||
|
// container, and then nothing inside it can be position: sticky
|
||||||
|
// (a blog post's contents column scrolled away with the page).
|
||||||
|
<div className="min-h-screen overflow-x-clip">
|
||||||
|
{skipLink}
|
||||||
|
|
||||||
{/* ── NAV ─────────────────────────────────────────────── */}
|
{/* ── NAV ─────────────────────────────────────────────── */}
|
||||||
<header
|
<header
|
||||||
|
|
@ -177,7 +208,7 @@ export default function Layout() {
|
||||||
<nav
|
<nav
|
||||||
className="flex items-center justify-between px-6 py-4"
|
className="flex items-center justify-between px-6 py-4"
|
||||||
aria-label="Site"
|
aria-label="Site"
|
||||||
style={{ background: "rgba(0, 58, 69, 0.92)" }}
|
style={{ background: "color-mix(in srgb, var(--pal-teal-1) 92%, transparent)" }}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-8">
|
<div className="flex items-center gap-8">
|
||||||
<Link to="/" aria-label="Next Generation of Unity home" className="inline-block">
|
<Link to="/" aria-label="Next Generation of Unity home" className="inline-block">
|
||||||
|
|
@ -212,7 +243,7 @@ export default function Layout() {
|
||||||
className={({ isActive }) =>
|
className={({ isActive }) =>
|
||||||
`block text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${
|
`block text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${
|
||||||
isActive
|
isActive
|
||||||
? "text-white border-[var(--green-2)]"
|
? "text-white border-[var(--pal-green-2)]"
|
||||||
: "text-white/75 hover:text-white border-transparent"
|
: "text-white/75 hover:text-white border-transparent"
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
|
|
@ -233,13 +264,13 @@ export default function Layout() {
|
||||||
>
|
>
|
||||||
<ul
|
<ul
|
||||||
className="min-w-56 py-2 shadow-xl"
|
className="min-w-56 py-2 shadow-xl"
|
||||||
style={{ background: "rgba(0, 16, 17, 0.97)", borderTop: "2px solid var(--green-2)" }}
|
style={{ background: "rgba(0, 16, 17, 0.97)", borderTop: "2px solid var(--pal-green-2)" }}
|
||||||
>
|
>
|
||||||
{pageSections.map((section) => (
|
{pageSections.map((section) => (
|
||||||
<li key={section.hash}>
|
<li key={section.hash}>
|
||||||
<Link
|
<Link
|
||||||
to={`${page.path}${section.hash}`}
|
to={`${page.path}${section.hash}`}
|
||||||
className="block px-4 py-2 text-sm text-white/80 transition-colors hover:bg-white/10 hover:text-[#f0bd4f] focus-visible:bg-white/10"
|
className="block px-4 py-2 text-sm text-white/80 transition-colors hover:bg-white/10 hover:text-[var(--pal-amber-2)] focus-visible:bg-white/10"
|
||||||
>
|
>
|
||||||
{section.label}
|
{section.label}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -299,8 +330,8 @@ export default function Layout() {
|
||||||
{/* Mobile menu */}
|
{/* Mobile menu */}
|
||||||
{mobileMenuOpen && (
|
{mobileMenuOpen && (
|
||||||
<div
|
<div
|
||||||
className="reading-solid fixed inset-0 z-[60] flex flex-col items-center [justify-content:safe_center] overflow-y-auto py-16"
|
className="fixed inset-0 z-[60] flex flex-col items-center [justify-content:safe_center] overflow-y-auto py-16"
|
||||||
style={{ background: "rgba(0, 58, 69, 0.97)" }}
|
style={{ background: "color-mix(in srgb, var(--pal-teal-1) 97%, transparent)" }}
|
||||||
role="dialog"
|
role="dialog"
|
||||||
aria-modal="true"
|
aria-modal="true"
|
||||||
aria-label="Menu"
|
aria-label="Menu"
|
||||||
|
|
@ -326,7 +357,7 @@ export default function Layout() {
|
||||||
end={page.path === "/"}
|
end={page.path === "/"}
|
||||||
className={({ isActive }) =>
|
className={({ isActive }) =>
|
||||||
`block text-2xl font-bold py-3 transition-colors ${
|
`block text-2xl font-bold py-3 transition-colors ${
|
||||||
isActive ? "text-[var(--green-2)]" : "text-white hover:text-[#f0bd4f]"
|
isActive ? "text-[var(--pal-green-2)]" : "text-white hover:text-[var(--pal-amber-2)]"
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
@ -337,13 +368,13 @@ export default function Layout() {
|
||||||
{isActive && pageSections.length > 0 && (
|
{isActive && pageSections.length > 0 && (
|
||||||
<div
|
<div
|
||||||
className="ml-3 pl-4 mb-2 flex flex-col"
|
className="ml-3 pl-4 mb-2 flex flex-col"
|
||||||
style={{ borderLeft: "1px solid rgba(45,200,224,0.35)" }}
|
style={{ borderLeft: "1px solid color-mix(in srgb, var(--pal-teal-2) 35%, transparent)" }}
|
||||||
>
|
>
|
||||||
{pageSections.map((section) => (
|
{pageSections.map((section) => (
|
||||||
<a
|
<a
|
||||||
key={section.hash}
|
key={section.hash}
|
||||||
href={section.hash}
|
href={section.hash}
|
||||||
className="text-white/80 text-lg py-2 hover:text-[#f0bd4f] transition-colors"
|
className="text-white/80 text-lg py-2 hover:text-[var(--pal-amber-2)] transition-colors"
|
||||||
onClick={() => setMobileMenuOpen(false)}
|
onClick={() => setMobileMenuOpen(false)}
|
||||||
>
|
>
|
||||||
{section.label}
|
{section.label}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,20 @@
|
||||||
filled in its accent, then its website, email and socials
|
filled in its accent, then its website, email and socials
|
||||||
outlined. Nothing at all when it has none. Used on an
|
outlined. Nothing at all when it has none. Used on an
|
||||||
organization's page and on the Organization page (NGU's own).
|
organization's page and on the Organization page (NGU's own).
|
||||||
|
A platform's icon has its name beside it for screen readers and
|
||||||
|
reading mode, unless the label already says it (PlatformName).
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import PlatformIcon from './PlatformIcon.tsx'
|
import PlatformIcon from './PlatformIcon.tsx'
|
||||||
import type { OrganizationRecord } from '../lib/useContent.ts'
|
import type { OrganizationRecord } from '../lib/useContent.ts'
|
||||||
import { accentText } from '../lib/color.ts'
|
import { accentText } from '../lib/color.ts'
|
||||||
|
import { PLATFORMS } from '../lib/platforms.ts'
|
||||||
|
|
||||||
|
function PlatformName({ platform, label }: { platform?: string | null; label?: string | null }) {
|
||||||
|
const name = PLATFORMS.find((p) => p.id === platform)?.label
|
||||||
|
if (!name || label?.toLowerCase().includes(name.toLowerCase())) return null
|
||||||
|
return <span className="sr-only">{label ? `${name}: ` : name}</span>
|
||||||
|
}
|
||||||
|
|
||||||
export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
||||||
const hasAny =
|
const hasAny =
|
||||||
|
|
@ -29,6 +38,7 @@ export default function OrgContact({ org, accent }: { org: OrganizationRecord; a
|
||||||
style={{ background: accent }}
|
style={{ background: accent }}
|
||||||
>
|
>
|
||||||
<PlatformIcon platform={link.platform} />
|
<PlatformIcon platform={link.platform} />
|
||||||
|
<PlatformName platform={link.platform} label={link.label} />
|
||||||
{link.label}
|
{link.label}
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
|
|
@ -51,6 +61,7 @@ export default function OrgContact({ org, accent }: { org: OrganizationRecord; a
|
||||||
style={{ borderColor: accent, color: accentText(accent) }}
|
style={{ borderColor: accent, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
<PlatformIcon platform={link.platform} />
|
<PlatformIcon platform={link.platform} />
|
||||||
|
<PlatformName platform={link.platform} label={link.label} />
|
||||||
{link.label}
|
{link.label}
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
||||||
--pb-opacity: 0.6;
|
--pb-opacity: 0.6;
|
||||||
--pb-0: #d6f5fa;
|
--pb-0: var(--pal-teal-3);
|
||||||
--pb-1: var(--green-3);
|
--pb-1: var(--pal-green-3);
|
||||||
--pb-2: #fdf1d6;
|
--pb-2: var(--pal-amber-3);
|
||||||
--pb-3: #d6f5fa;
|
--pb-3: var(--pal-teal-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A circle's place: across by its left, down its layer's whole
|
/* A circle's place: across by its left, down its layer's whole
|
||||||
|
|
@ -71,18 +71,18 @@
|
||||||
toggle's choice, or the system's when there is none. */
|
toggle's choice, or the system's when there is none. */
|
||||||
:root[data-theme="dark"] .page-backdrop {
|
:root[data-theme="dark"] .page-backdrop {
|
||||||
--pb-opacity: 0.3;
|
--pb-opacity: 0.3;
|
||||||
--pb-0: #003a45;
|
--pb-0: var(--pal-teal-1);
|
||||||
--pb-1: var(--green-1);
|
--pb-1: var(--pal-green-1);
|
||||||
--pb-2: #4a2e00;
|
--pb-2: var(--pal-amber-1);
|
||||||
--pb-3: #003a45;
|
--pb-3: var(--pal-teal-1);
|
||||||
}
|
}
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
:root:not([data-theme="light"]) .page-backdrop {
|
:root:not([data-theme="light"]) .page-backdrop {
|
||||||
--pb-opacity: 0.3;
|
--pb-opacity: 0.3;
|
||||||
--pb-0: #003a45;
|
--pb-0: var(--pal-teal-1);
|
||||||
--pb-1: var(--green-1);
|
--pb-1: var(--pal-green-1);
|
||||||
--pb-2: #4a2e00;
|
--pb-2: var(--pal-amber-1);
|
||||||
--pb-3: #003a45;
|
--pb-3: var(--pal-teal-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
on the page backdrop (PageBackdrop.css). */
|
on the page backdrop (PageBackdrop.css). */
|
||||||
|
|
||||||
.side-nav-circle {
|
.side-nav-circle {
|
||||||
background: #d6f5fa;
|
background: var(--pal-teal-3);
|
||||||
/* A slight drop shadow, as the cards have: down and soft, no glow. */
|
/* A slight drop shadow, as the cards have: down and soft, no glow. */
|
||||||
box-shadow: 0 4px 12px rgb(0 16 17 / 0.14);
|
box-shadow: 0 4px 12px rgb(0 16 17 / 0.14);
|
||||||
/* Color by section; size and place between centered on the list
|
/* Color by section; size and place between centered on the list
|
||||||
|
|
@ -18,32 +18,32 @@
|
||||||
top 0.6s ease-in-out;
|
top 0.6s ease-in-out;
|
||||||
}
|
}
|
||||||
.side-nav-circle[data-family="green"] {
|
.side-nav-circle[data-family="green"] {
|
||||||
background: var(--green-3);
|
background: var(--pal-green-3);
|
||||||
}
|
}
|
||||||
.side-nav-circle[data-family="amber"] {
|
.side-nav-circle[data-family="amber"] {
|
||||||
background: #fdf1d6;
|
background: var(--pal-amber-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dark mode: the toggle's choice, or the system's when there is none. */
|
/* Dark mode: the toggle's choice, or the system's when there is none. */
|
||||||
:root[data-theme="dark"] .side-nav-circle {
|
:root[data-theme="dark"] .side-nav-circle {
|
||||||
background: #003a45;
|
background: var(--pal-teal-1);
|
||||||
box-shadow: 0 4px 12px rgb(0 0 0 / 0.45);
|
box-shadow: 0 4px 12px rgb(0 0 0 / 0.45);
|
||||||
}
|
}
|
||||||
:root[data-theme="dark"] .side-nav-circle[data-family="green"] {
|
:root[data-theme="dark"] .side-nav-circle[data-family="green"] {
|
||||||
background: var(--green-1);
|
background: var(--pal-green-1);
|
||||||
}
|
}
|
||||||
:root[data-theme="dark"] .side-nav-circle[data-family="amber"] {
|
:root[data-theme="dark"] .side-nav-circle[data-family="amber"] {
|
||||||
background: #4a2e00;
|
background: var(--pal-amber-1);
|
||||||
}
|
}
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
:root:not([data-theme="light"]) .side-nav-circle {
|
:root:not([data-theme="light"]) .side-nav-circle {
|
||||||
background: #003a45;
|
background: var(--pal-teal-1);
|
||||||
box-shadow: 0 4px 12px rgb(0 0 0 / 0.45);
|
box-shadow: 0 4px 12px rgb(0 0 0 / 0.45);
|
||||||
}
|
}
|
||||||
:root:not([data-theme="light"]) .side-nav-circle[data-family="green"] {
|
:root:not([data-theme="light"]) .side-nav-circle[data-family="green"] {
|
||||||
background: var(--green-1);
|
background: var(--pal-green-1);
|
||||||
}
|
}
|
||||||
:root:not([data-theme="light"]) .side-nav-circle[data-family="amber"] {
|
:root:not([data-theme="light"]) .side-nav-circle[data-family="amber"] {
|
||||||
background: #4a2e00;
|
background: var(--pal-amber-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import { isBadId, personHref } from "../lib/hrefs.ts";
|
||||||
import { mediaUrl, initials } from "../lib/media.ts";
|
import { mediaUrl, initials } from "../lib/media.ts";
|
||||||
import { useSmallImage } from "../lib/useSmallImage.ts";
|
import { useSmallImage } from "../lib/useSmallImage.ts";
|
||||||
import { paletteFill } from "../lib/color.ts";
|
import { paletteFill } from "../lib/color.ts";
|
||||||
|
import { useReadingMode } from "../lib/readingMode.ts";
|
||||||
import "./PeopleTiles.css";
|
import "./PeopleTiles.css";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,6 +72,10 @@ import "./PeopleTiles.css";
|
||||||
* with no photo gets their initials on a palette color
|
* with no photo gets their initials on a palette color
|
||||||
* (paletteFill in color.ts).
|
* (paletteFill in color.ts).
|
||||||
*
|
*
|
||||||
|
* Reading mode (readingMode.ts) gets everyone, no "Show all", each
|
||||||
|
* a heading (linked to their profile) and their title, facts and bio
|
||||||
|
* as lines (ReadingPeople).
|
||||||
|
*
|
||||||
* Field names follow the API (is_owner, location_label), so a row
|
* Field names follow the API (is_owner, location_label), so a row
|
||||||
* from /api/teams/:id/people drops in unchanged.
|
* from /api/teams/:id/people drops in unchanged.
|
||||||
*
|
*
|
||||||
|
|
@ -122,7 +127,8 @@ export interface PeopleGroupInput extends Omit<PeopleGroup, "people"> {
|
||||||
|
|
||||||
export interface TeamSpec {
|
export interface TeamSpec {
|
||||||
id: string;
|
id: string;
|
||||||
/** Heading for the members group. Defaults to the team's name. */
|
/** Heading for the members group beside a lead group, or among
|
||||||
|
* several teams. Defaults to the team's name. */
|
||||||
label?: string;
|
label?: string;
|
||||||
/** Heading for the lead group. Defaults to the lead's own title. */
|
/** Heading for the lead group. Defaults to the lead's own title. */
|
||||||
leadLabel?: string;
|
leadLabel?: string;
|
||||||
|
|
@ -146,6 +152,9 @@ export interface PeopleTilesProps
|
||||||
align?: "start" | "center";
|
align?: "start" | "center";
|
||||||
accent?: string;
|
accent?: string;
|
||||||
tilt?: boolean;
|
tilt?: boolean;
|
||||||
|
/** The group labels' heading level, by what they sit under (3 under
|
||||||
|
* a section's h2). In reading mode the names are one level under. */
|
||||||
|
headingLevel?: 3 | 4 | 5;
|
||||||
/** How long a fetched team or person is reused, in ms. */
|
/** How long a fetched team or person is reused, in ms. */
|
||||||
ttl?: number;
|
ttl?: number;
|
||||||
emptyMessage?: string;
|
emptyMessage?: string;
|
||||||
|
|
@ -372,8 +381,10 @@ function buildTeamGroups(
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
id: data.team.id,
|
id: data.team.id,
|
||||||
// One unlabeled team needs no heading; several always do.
|
// One team alone needs no heading (its page or section names
|
||||||
label: teamCount > 1 || spec.label ? name : undefined,
|
// it); several always do. `label` names the members beside a
|
||||||
|
// lead group.
|
||||||
|
label: teamCount > 1 ? name : undefined,
|
||||||
accent,
|
accent,
|
||||||
people: data.people,
|
people: data.people,
|
||||||
},
|
},
|
||||||
|
|
@ -408,6 +419,7 @@ export function PeopleTilesView({
|
||||||
accent,
|
accent,
|
||||||
tilt = false,
|
tilt = false,
|
||||||
emptyMessage = "No one listed yet.",
|
emptyMessage = "No one listed yet.",
|
||||||
|
headingLevel = 3,
|
||||||
onExpand,
|
onExpand,
|
||||||
className = "",
|
className = "",
|
||||||
style,
|
style,
|
||||||
|
|
@ -426,6 +438,7 @@ export function PeopleTilesView({
|
||||||
const [clipped, setClipped] = useState<ReadonlySet<string>>(() => new Set());
|
const [clipped, setClipped] = useState<ReadonlySet<string>>(() => new Set());
|
||||||
const rootRef = useRef<HTMLDivElement>(null);
|
const rootRef = useRef<HTMLDivElement>(null);
|
||||||
const probeRef = useRef<HTMLSpanElement>(null);
|
const probeRef = useRef<HTMLSpanElement>(null);
|
||||||
|
const reading = useReadingMode();
|
||||||
|
|
||||||
const resolvedSize: PeopleTilesSize = SIZE_FEATURES[size] ? size : "md";
|
const resolvedSize: PeopleTilesSize = SIZE_FEATURES[size] ? size : "md";
|
||||||
const features = SIZE_FEATURES[resolvedSize];
|
const features = SIZE_FEATURES[resolvedSize];
|
||||||
|
|
@ -532,6 +545,8 @@ export function PeopleTilesView({
|
||||||
if (!resolvedGroups.length) {
|
if (!resolvedGroups.length) {
|
||||||
return emptyMessage ? <p className="pl__empty">{emptyMessage}</p> : null;
|
return emptyMessage ? <p className="pl__empty">{emptyMessage}</p> : null;
|
||||||
}
|
}
|
||||||
|
if (reading) return <ReadingPeople groups={resolvedGroups} level={headingLevel} />;
|
||||||
|
const Label = `h${headingLevel}` as "h3";
|
||||||
|
|
||||||
const open = openKey ? findByKey(resolvedGroups, openKey) : null;
|
const open = openKey ? findByKey(resolvedGroups, openKey) : null;
|
||||||
const oneRow =
|
const oneRow =
|
||||||
|
|
@ -598,7 +613,7 @@ export function PeopleTilesView({
|
||||||
>
|
>
|
||||||
{(group.label || group.note) && (
|
{(group.label || group.note) && (
|
||||||
<header className="pl__group-head">
|
<header className="pl__group-head">
|
||||||
{group.label && <h3 className="pl__group-label">{group.label}</h3>}
|
{group.label && <Label className="pl__group-label">{group.label}</Label>}
|
||||||
{group.note && <p className="pl__group-note">{group.note}</p>}
|
{group.note && <p className="pl__group-note">{group.note}</p>}
|
||||||
</header>
|
</header>
|
||||||
)}
|
)}
|
||||||
|
|
@ -883,6 +898,52 @@ function DetailPanel({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reading mode: every person and what their details panel says. */
|
||||||
|
function ReadingPeople({ groups, level }: { groups: PeopleGroup[]; level: 3 | 4 | 5 }) {
|
||||||
|
const Label = `h${level}` as "h3";
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{groups.map((group) => {
|
||||||
|
// Names sit under the group's label, or take its place.
|
||||||
|
const Name = `h${group.label ? level + 1 : level}` as "h4";
|
||||||
|
return (
|
||||||
|
<section key={group.id}>
|
||||||
|
{group.label && <Label>{group.label}</Label>}
|
||||||
|
{group.note && <p>{group.note}</p>}
|
||||||
|
{group.people.map((person, index) => {
|
||||||
|
const href = profileHref(person);
|
||||||
|
const title = titleOf(person);
|
||||||
|
const org = resolveOrg(person.org);
|
||||||
|
const bio = Array.isArray(person.bio) ? person.bio : [person.bio];
|
||||||
|
return (
|
||||||
|
<div key={keyFor(group, person, index)}>
|
||||||
|
<Name>{href ? <Link to={href}>{person.name}</Link> : person.name}</Name>
|
||||||
|
{title && <p>{title}</p>}
|
||||||
|
{person.pronouns && <p>Pronouns: {person.pronouns}</p>}
|
||||||
|
{org && (
|
||||||
|
<p>
|
||||||
|
Home organization: {org.href ? <a href={org.href}>{org.name}</a> : org.name}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{person.location_label && <p>Based in: {person.location_label}</p>}
|
||||||
|
{person.public_email && (
|
||||||
|
<p>
|
||||||
|
Email: <a href={`mailto:${person.public_email}`}>{person.public_email}</a>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{bio.filter(Boolean).map((paragraph, i) => (
|
||||||
|
<p key={i}>{paragraph}</p>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function Chevron() {
|
function Chevron() {
|
||||||
return (
|
return (
|
||||||
<CaretDown size={12} weight="bold" aria-hidden="true" />
|
<CaretDown size={12} weight="bold" aria-hidden="true" />
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export default function PrivacyNotice() {
|
||||||
<div
|
<div
|
||||||
role="region"
|
role="region"
|
||||||
aria-label="Privacy notice"
|
aria-label="Privacy notice"
|
||||||
className="reading-solid fixed bottom-20 left-4 right-4 z-40 sm:bottom-4 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
|
className="fixed bottom-20 left-4 right-4 z-40 sm:bottom-4 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press
|
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press
|
||||||
|
|
|
||||||
309
src/components/ReaderView.tsx
Normal file
309
src/components/ReaderView.tsx
Normal file
|
|
@ -0,0 +1,309 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
READER VIEW: reading mode (AccessibilityPanel.tsx)
|
||||||
|
|
||||||
|
The page as text: its headings, paragraphs, links and pictures,
|
||||||
|
one column, nothing else. No buttons, cards, colors, carousels or
|
||||||
|
forms.
|
||||||
|
|
||||||
|
The real page still renders, hidden (Layout.tsx), so every page
|
||||||
|
and section works without a reading version of its own; this reads
|
||||||
|
what it drew and writes it out plainly, again whenever it changes
|
||||||
|
(data arriving, a new page).
|
||||||
|
|
||||||
|
What's kept:
|
||||||
|
h1 to h6 headings, at their level
|
||||||
|
p, li, td, quote... paragraphs, with their links
|
||||||
|
a links (a card that is one link gives its
|
||||||
|
heading the link, or with none its first
|
||||||
|
line or picture); an icon-only link reads
|
||||||
|
its aria-label
|
||||||
|
br a line break
|
||||||
|
a part drawn on its a line of its own: a row of facts or link
|
||||||
|
own line buttons reads one per line
|
||||||
|
form one line saying it can't be used here
|
||||||
|
img with alt text pictures; one with empty alt is decoration
|
||||||
|
(a card's faded background) and is left out
|
||||||
|
a button that opens its words, as a line: a person's tile, a
|
||||||
|
something schedule row (aria-expanded)
|
||||||
|
What's dropped: other buttons, form fields, navigation lists, video and
|
||||||
|
map frames, drawings, anything hidden from screen readers
|
||||||
|
(aria-hidden, the copies a carousel draws for its turns) and
|
||||||
|
anything CSS hides (display: none, eg. a print-only footer).
|
||||||
|
|
||||||
|
Ids on sections and headings are kept, so #links still land.
|
||||||
|
|
||||||
|
What this can't do well (a carousel showing one card, tabs,
|
||||||
|
details opened by a click, a count waiting to be scrolled to) the
|
||||||
|
component draws as text itself when useReadingMode() is on.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import { Fragment, useEffect, useState, type ReactNode, type RefObject } from 'react'
|
||||||
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
|
import { PAGE_LINKS } from '../navConfig.ts'
|
||||||
|
|
||||||
|
type Inline = string | { href: string; children: Inline[] }
|
||||||
|
|
||||||
|
/* A <br> in the page, kept as a line break (an address, a poem). */
|
||||||
|
const BREAK = '
'
|
||||||
|
/* `ids` are the page's own ids on a section or heading (a section
|
||||||
|
and its heading can both have one), kept so a #link (the side
|
||||||
|
nav, a "Jump to" button) still lands. */
|
||||||
|
type Block = { ids?: string[] } & (
|
||||||
|
| { kind: 'heading'; level: number; content: Inline[] }
|
||||||
|
| { kind: 'text'; content: Inline[] }
|
||||||
|
| { kind: 'image'; src: string; alt: string; href?: string }
|
||||||
|
)
|
||||||
|
|
||||||
|
const SKIP = new Set(['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEMPLATE', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'NAV', 'IFRAME', 'VIDEO', 'AUDIO', 'CANVAS', 'DIALOG', 'svg'])
|
||||||
|
const HEADINGS = new Set(['H1', 'H2', 'H3', 'H4', 'H5', 'H6'])
|
||||||
|
const TEXT_BLOCKS = new Set(['P', 'LI', 'DT', 'DD', 'BLOCKQUOTE', 'FIGCAPTION', 'CAPTION', 'ADDRESS', 'TH', 'TD'])
|
||||||
|
const BLOCK_SELECTOR = 'div,section,article,header,footer,aside,main,p,ul,ol,li,dl,dt,dd,table,tr,figure,blockquote,h1,h2,h3,h4,h5,h6,img,form,fieldset'
|
||||||
|
|
||||||
|
/* A button that opens something (a person's tile, a schedule row):
|
||||||
|
its words name content, so it's read as a line, not dropped. */
|
||||||
|
const opens = (el: Element) => el.tagName === 'BUTTON' && el.hasAttribute('aria-expanded')
|
||||||
|
|
||||||
|
const skipped = (el: Element) =>
|
||||||
|
(SKIP.has(el.tagName) && !opens(el)) ||
|
||||||
|
el.getAttribute('aria-hidden') === 'true' ||
|
||||||
|
el.hasAttribute('hidden') ||
|
||||||
|
['button', 'switch', 'tab', 'slider', 'presentation', 'none'].includes(el.getAttribute('role') ?? '') ||
|
||||||
|
// Hidden by CSS: a print-only footer, a phone-only copy.
|
||||||
|
getComputedStyle(el).display === 'none'
|
||||||
|
|
||||||
|
/* Drawn on a line of its own (a flex row's items, a block link): a
|
||||||
|
row of facts or link buttons reads one per line, not run together. */
|
||||||
|
const ownLine = (el: Element) => {
|
||||||
|
const display = getComputedStyle(el).display
|
||||||
|
return !display.startsWith('inline') && display !== 'contents'
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A link's address as the app routes it: a path for this site, so
|
||||||
|
it opens without reloading; the full address for anywhere else. */
|
||||||
|
function hrefOf(a: HTMLAnchorElement): string | null {
|
||||||
|
const raw = a.getAttribute('href')
|
||||||
|
if (!raw || raw.startsWith('javascript:')) return null
|
||||||
|
try {
|
||||||
|
const url = new URL(raw, location.href)
|
||||||
|
return url.origin === location.origin ? url.pathname + url.search + url.hash : url.href
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function inline(node: Node): Inline[] {
|
||||||
|
if (node.nodeType === Node.TEXT_NODE) return [node.textContent ?? '']
|
||||||
|
if (!(node instanceof Element) || skipped(node) || node.tagName === 'IMG') return []
|
||||||
|
if (node.tagName === 'BR') return [BREAK]
|
||||||
|
let children = [...node.childNodes].flatMap(inline)
|
||||||
|
const href = node instanceof HTMLAnchorElement ? hrefOf(node) : null
|
||||||
|
// An icon-only link (an arrow) names itself in aria-label.
|
||||||
|
const label = node.getAttribute('aria-label')
|
||||||
|
if (href && label && !textOf(children)) children = [label]
|
||||||
|
const parts: Inline[] = href ? [{ href, children }] : children
|
||||||
|
// A part the page draws on its own line (a span set to block, a
|
||||||
|
// flex row's items) has no space in its text: give it one.
|
||||||
|
return getComputedStyle(node).display.startsWith('inline') ? parts : [' ', ...parts, ' ']
|
||||||
|
}
|
||||||
|
|
||||||
|
const textOf = (parts: Inline[]): string =>
|
||||||
|
parts.map((p) => (typeof p === 'string' ? p : textOf(p.children))).join('').replace(/\s+/g, ' ').trim()
|
||||||
|
|
||||||
|
const isBlock = (el: Element) => opens(el) || el.matches(BLOCK_SELECTOR) || el.querySelector(BLOCK_SELECTOR) !== null
|
||||||
|
|
||||||
|
function extract(root: Element): Block[] {
|
||||||
|
const blocks: Block[] = []
|
||||||
|
// Ids waiting for the next block written, which takes them.
|
||||||
|
let pendingIds: string[] = []
|
||||||
|
const push = (block: Block) => {
|
||||||
|
blocks.push(pendingIds.length ? { ...block, ids: pendingIds } : block)
|
||||||
|
pendingIds = []
|
||||||
|
}
|
||||||
|
const text = (content: Inline[]) => {
|
||||||
|
if (textOf(content)) push({ kind: 'text', content })
|
||||||
|
}
|
||||||
|
|
||||||
|
function walk(el: Element, link: string | null) {
|
||||||
|
// The root is the hidden copy of the page itself: read inside it.
|
||||||
|
if (el !== root && skipped(el)) return
|
||||||
|
if (el.id && el !== root) pendingIds.push(el.id)
|
||||||
|
if (opens(el)) {
|
||||||
|
// Each part on its own line in the page (a name, a title) joins
|
||||||
|
// with a comma.
|
||||||
|
const parts = [...el.querySelectorAll('*')]
|
||||||
|
.filter((part) => !part.closest('[aria-hidden="true"]') && [...part.childNodes].some((n) => n.nodeType === Node.TEXT_NODE && n.textContent?.trim()))
|
||||||
|
.map((part) => [...part.childNodes].filter((n) => n.nodeType === Node.TEXT_NODE).map((n) => n.textContent).join('').trim())
|
||||||
|
text([parts.join(', ')])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (el.tagName === 'FORM') {
|
||||||
|
text(['This form can’t be filled in while reading mode is on. Turn it off (the accessibility button) to use it.'])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (HEADINGS.has(el.tagName)) {
|
||||||
|
const content = [...el.childNodes].flatMap(inline)
|
||||||
|
if (textOf(content)) {
|
||||||
|
push({ kind: 'heading', level: Number(el.tagName[1]), content: link ? [{ href: link, children: content }] : content })
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (el.tagName === 'IMG') {
|
||||||
|
const img = el as HTMLImageElement
|
||||||
|
const alt = img.getAttribute('alt')?.trim()
|
||||||
|
const src = img.currentSrc || img.getAttribute('src')
|
||||||
|
if (alt && src) push({ kind: 'image', src, alt, ...(link ? { href: link } : {}) })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (TEXT_BLOCKS.has(el.tagName) && !el.querySelector('p,li,h1,h2,h3,h4,h5,h6,img')) {
|
||||||
|
text([...el.childNodes].flatMap(inline))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (el.tagName === 'TR') {
|
||||||
|
const cells = [...el.children].map((cell) => [...cell.childNodes].flatMap(inline)).map((c) => (textOf(c) ? c : ['-']))
|
||||||
|
text(cells.flatMap((cell, i) => (i ? [' · ', ...cell] : cell)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// A link around a whole card: its parts, with the link on the first
|
||||||
|
// heading; with none, on its aria-label as a line of its own, or
|
||||||
|
// else on its first line of text.
|
||||||
|
const href = el instanceof HTMLAnchorElement ? hrefOf(el) : null
|
||||||
|
if (href && isBlock(el)) {
|
||||||
|
const before = blocks.length
|
||||||
|
for (const child of el.children) walk(child, href)
|
||||||
|
const own = blocks.slice(before)
|
||||||
|
if (!own.some((b) => b.kind === 'heading')) {
|
||||||
|
const label = el.getAttribute('aria-label')
|
||||||
|
const first = own.findIndex((b) => b.kind === 'text')
|
||||||
|
if (label) blocks.splice(before, 0, { kind: 'text', content: [{ href, children: [label] }] })
|
||||||
|
else if (first >= 0) {
|
||||||
|
const block = blocks[before + first] as Extract<Block, { kind: 'text' }>
|
||||||
|
blocks[before + first] = { ...block, content: [{ href, children: block.content }] }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anything else: its loose text and inline parts make paragraphs,
|
||||||
|
// broken where a block of its own comes.
|
||||||
|
let run: Inline[] = []
|
||||||
|
for (const child of el.childNodes) {
|
||||||
|
if (child instanceof Element && !skipped(child) && isBlock(child)) {
|
||||||
|
text(run)
|
||||||
|
run = []
|
||||||
|
walk(child, link)
|
||||||
|
} else if (child instanceof Element && !skipped(child) && ownLine(child)) {
|
||||||
|
text(run)
|
||||||
|
run = []
|
||||||
|
text(inline(child))
|
||||||
|
} else {
|
||||||
|
run.push(...inline(child))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text(run)
|
||||||
|
}
|
||||||
|
|
||||||
|
walk(root, null)
|
||||||
|
// Carousels and repeated strips can say the same line twice in a row.
|
||||||
|
return blocks.filter((b, i) => {
|
||||||
|
const prev = blocks[i - 1]
|
||||||
|
return !prev || prev.kind !== b.kind || JSON.stringify(prev) !== JSON.stringify(b)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function render(parts: Inline[]): ReactNode[] {
|
||||||
|
return parts.map((part, i) => {
|
||||||
|
if (typeof part === 'string') {
|
||||||
|
if (!part.includes(BREAK)) return part
|
||||||
|
return part.split(BREAK).map((line, j) => (
|
||||||
|
<Fragment key={`${i}-${j}`}>
|
||||||
|
{j > 0 && <br />}
|
||||||
|
{line}
|
||||||
|
</Fragment>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Anchor key={i} href={part.href}>
|
||||||
|
{render(part.children)}
|
||||||
|
</Anchor>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A page on this site opens without reloading; a file (an upload,
|
||||||
|
the API) or anywhere else is a plain link. */
|
||||||
|
const isFile = (href: string) => /^\/(uploads|api)\//.test(href)
|
||||||
|
|
||||||
|
function Anchor({ href, children }: { href: string; children: ReactNode }) {
|
||||||
|
return href.startsWith('/') && !isFile(href) ? <Link to={href}>{children}</Link> : <a href={href}>{children}</a>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ReaderView({ source }: { source: RefObject<HTMLElement | null> }) {
|
||||||
|
const [blocks, setBlocks] = useState<Block[]>([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const root = source.current
|
||||||
|
if (!root) return undefined
|
||||||
|
let frame = 0
|
||||||
|
const update = () => {
|
||||||
|
frame = 0
|
||||||
|
setBlocks(extract(root))
|
||||||
|
}
|
||||||
|
const schedule = () => {
|
||||||
|
if (!frame) frame = requestAnimationFrame(update)
|
||||||
|
}
|
||||||
|
update()
|
||||||
|
const observer = new MutationObserver(schedule)
|
||||||
|
observer.observe(root, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['src', 'alt', 'href', 'hidden', 'aria-hidden'] })
|
||||||
|
return () => {
|
||||||
|
observer.disconnect()
|
||||||
|
if (frame) cancelAnimationFrame(frame)
|
||||||
|
}
|
||||||
|
}, [source])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<article className="reader">
|
||||||
|
<p>
|
||||||
|
{PAGE_LINKS.map((page, i) => (
|
||||||
|
<span key={page.path}>
|
||||||
|
{i > 0 && ' · '}
|
||||||
|
<Link to={page.path}>{page.label}</Link>
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</p>
|
||||||
|
{blocks.map((block, i) => {
|
||||||
|
const [id, ...more] = block.ids ?? []
|
||||||
|
const anchors = more.map((other) => <span key={other} id={other} />)
|
||||||
|
if (block.kind === 'image') {
|
||||||
|
return (
|
||||||
|
<Fragment key={i}>
|
||||||
|
{anchors}
|
||||||
|
{block.href ? (
|
||||||
|
<Anchor href={block.href}>
|
||||||
|
<img id={id} src={block.src} alt={block.alt} loading="lazy" />
|
||||||
|
</Anchor>
|
||||||
|
) : (
|
||||||
|
<img id={id} src={block.src} alt={block.alt} loading="lazy" />
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (block.kind === 'text') {
|
||||||
|
return (
|
||||||
|
<p key={i} id={id}>
|
||||||
|
{anchors}
|
||||||
|
{render(block.content)}
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const Heading = `h${block.level}` as 'h1'
|
||||||
|
return (
|
||||||
|
<Heading key={i} id={id}>
|
||||||
|
{anchors}
|
||||||
|
{render(block.content)}
|
||||||
|
</Heading>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</article>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -18,10 +18,14 @@
|
||||||
the place typed in, with a link out to the full map.
|
the place typed in, with a link out to the full map.
|
||||||
|
|
||||||
Tabs follow the ARIA tab pattern: arrow keys move between them.
|
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 { 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 { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import { personHref } from '../lib/hrefs.ts'
|
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 { withAlpha, accentText, readableOn } from '../lib/color.ts'
|
||||||
import { useSmallImage } from '../lib/useSmallImage.ts'
|
import { useSmallImage } from '../lib/useSmallImage.ts'
|
||||||
import { focusOnMount } from '../lib/focus.ts'
|
import { focusOnMount } from '../lib/focus.ts'
|
||||||
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
|
|
||||||
const BODY = 'var(--color-muted)'
|
const BODY = 'var(--color-muted)'
|
||||||
const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
|
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({
|
export default function ScheduleBlock({
|
||||||
items,
|
items,
|
||||||
intro,
|
intro,
|
||||||
|
|
@ -227,8 +280,10 @@ export default function ScheduleBlock({
|
||||||
const days = groupByDay(items)
|
const days = groupByDay(items)
|
||||||
const [active, setActive] = useState(() => todayIndex(days))
|
const [active, setActive] = useState(() => todayIndex(days))
|
||||||
const baseId = useId()
|
const baseId = useId()
|
||||||
|
const reading = useReadingMode()
|
||||||
|
|
||||||
if (days.length === 0) return null
|
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)]
|
const current = days[Math.min(active, days.length - 1)]
|
||||||
|
|
||||||
// Arrows move one tab and wrap; Home and End jump to the ends.
|
// Arrows move one tab and wrap; Home and End jump to the ends.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@
|
||||||
corners, as the only rounded thing besides buttons and dots. A link that embeds.ts can't turn into a
|
corners, as the only rounded thing besides buttons and dots. A link that embeds.ts can't turn into a
|
||||||
player (not https, or not a host it knows how to frame) still
|
player (not https, or not a host it knows how to frame) still
|
||||||
goes somewhere: the still becomes a link to it.
|
goes somewhere: the still becomes a link to it.
|
||||||
|
|
||||||
|
Reading mode (readingMode.ts) gets a link to the video (an
|
||||||
|
uploaded file's own address), named by its title.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { Play } from '@phosphor-icons/react'
|
import { Play } from '@phosphor-icons/react'
|
||||||
|
|
@ -23,6 +26,7 @@ import HomeLink from '../pages/sections/home/HomeLink.tsx'
|
||||||
import { playingSource, videoSource, videoThumbnails } from '../lib/embeds.ts'
|
import { playingSource, videoSource, videoThumbnails } from '../lib/embeds.ts'
|
||||||
import { BRAND } from '../lib/color.ts'
|
import { BRAND } from '../lib/color.ts'
|
||||||
import { focusOnMount } from '../lib/focus.ts'
|
import { focusOnMount } from '../lib/focus.ts'
|
||||||
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
|
|
||||||
|
|
||||||
export default function VideoPlayer({
|
export default function VideoPlayer({
|
||||||
|
|
@ -40,6 +44,16 @@ export default function VideoPlayer({
|
||||||
const [playing, setPlaying] = useState(false)
|
const [playing, setPlaying] = useState(false)
|
||||||
const [skipped, setSkipped] = useState(0)
|
const [skipped, setSkipped] = useState(0)
|
||||||
const source = videoSource(url)
|
const source = videoSource(url)
|
||||||
|
const reading = useReadingMode()
|
||||||
|
|
||||||
|
if (reading) {
|
||||||
|
const href = source?.kind === 'file' ? source.src : url
|
||||||
|
return href ? (
|
||||||
|
<p>
|
||||||
|
<a href={href}>{title || 'Watch the video'}</a>
|
||||||
|
</p>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
|
||||||
if (playing && source) {
|
if (playing && source) {
|
||||||
const live = playingSource(source)
|
const live = playingSource(source)
|
||||||
|
|
@ -90,7 +104,7 @@ export default function VideoPlayer({
|
||||||
className="block aspect-video w-full object-cover"
|
className="block aspect-video w-full object-cover"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<span className="block aspect-video w-full bg-[#003a45]" />
|
<span className="block aspect-video w-full bg-[var(--pal-teal-1)]" />
|
||||||
)}
|
)}
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { jumpTo } from "../../lib/focus.ts";
|
import { jumpTo } from "../../lib/focus.ts";
|
||||||
import { scrollBehavior } from "../../lib/motion.ts";
|
import { scrollBehavior } from "../../lib/motion.ts";
|
||||||
import { accentText } from "../../lib/color.ts";
|
|
||||||
|
|
||||||
export type EditorSection = {
|
export type EditorSection = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -107,7 +106,11 @@ export function SectionNav({ sections, wrap = false }: { sections: EditorSection
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => jumpTo(section.id)}
|
onClick={() => jumpTo(section.id)}
|
||||||
aria-current={lit ? "location" : undefined}
|
aria-current={lit ? "location" : undefined}
|
||||||
style={section.accent ? ({ "--nav-accent": accentText(section.accent) } as React.CSSProperties) : undefined}
|
style={
|
||||||
|
section.accent
|
||||||
|
? ({ "--nav-accent": `color-mix(in srgb, ${section.accent} var(--nav-text-mix), #ffffff)` } as React.CSSProperties)
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
className={`-ml-px flex w-full items-center gap-1.5 border-l-2 px-3 py-1.5 text-left text-sm transition-colors ${
|
className={`-ml-px flex w-full items-center gap-1.5 border-l-2 px-3 py-1.5 text-left text-sm transition-colors ${
|
||||||
section.accent
|
section.accent
|
||||||
? lit
|
? lit
|
||||||
|
|
|
||||||
206
src/index.css
206
src/index.css
|
|
@ -58,6 +58,10 @@
|
||||||
accentText): all of it on light, half (the rest white) on dark. */
|
accentText): all of it on light, half (the rest white) on dark. */
|
||||||
:root {
|
:root {
|
||||||
--accent-text-mix: 100%;
|
--accent-text-mix: 100%;
|
||||||
|
/* The side nav's lit label sits on its circle, the section's darkest
|
||||||
|
shade in dark mode, so it goes further toward white there (6.8:1
|
||||||
|
or better for every accent; 50% left the deep teal at 4.2:1). */
|
||||||
|
--nav-text-mix: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dark mode: the visitor's system setting, unless the header toggle
|
/* Dark mode: the visitor's system setting, unless the header toggle
|
||||||
|
|
@ -81,6 +85,7 @@
|
||||||
--color-danger-tint: #3b1714;
|
--color-danger-tint: #3b1714;
|
||||||
--color-raised: color-mix(in srgb, var(--color-tint) 35%, var(--color-surface));
|
--color-raised: color-mix(in srgb, var(--color-tint) 35%, var(--color-surface));
|
||||||
--accent-text-mix: 50%;
|
--accent-text-mix: 50%;
|
||||||
|
--nav-text-mix: 30%;
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
|
|
@ -99,6 +104,7 @@
|
||||||
--color-danger-tint: #3b1714;
|
--color-danger-tint: #3b1714;
|
||||||
--color-raised: color-mix(in srgb, var(--color-tint) 35%, var(--color-surface));
|
--color-raised: color-mix(in srgb, var(--color-tint) 35%, var(--color-surface));
|
||||||
--accent-text-mix: 50%;
|
--accent-text-mix: 50%;
|
||||||
|
--nav-text-mix: 30%;
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -250,13 +256,10 @@ iframe[src*="churchcenter"] {
|
||||||
font-family: 'OpenDyslexic', sans-serif;
|
font-family: 'OpenDyslexic', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reading mode: the page as plain text. One narrow column of ink on
|
/* Reading mode: the page as text (ReaderView.tsx, which Layout.tsx
|
||||||
white (or the reverse in dark mode): no colors, backgrounds,
|
draws in place of the page). Two colors, ink on white or the
|
||||||
cards, shadows, borders, pictures, motion or decoration, larger
|
reverse in dark mode, unlayered so they win over the admin's
|
||||||
type and underlined links. A picture or video with a description
|
colors (theme.js, in layers); larger type in one column. */
|
||||||
leaves it in its place (AccessibilityPanel.tsx copies it to
|
|
||||||
data-reading-alt on its parent). Unlayered, so it wins over the
|
|
||||||
admin's colors (theme.js, in layers). */
|
|
||||||
:root[data-reading="on"] {
|
:root[data-reading="on"] {
|
||||||
--color-ink: #111111;
|
--color-ink: #111111;
|
||||||
--color-body: #111111;
|
--color-body: #111111;
|
||||||
|
|
@ -269,8 +272,6 @@ iframe[src*="churchcenter"] {
|
||||||
--color-tint: #ffffff;
|
--color-tint: #ffffff;
|
||||||
--color-tint-soft: #ffffff;
|
--color-tint-soft: #ffffff;
|
||||||
--color-raised: #ffffff;
|
--color-raised: #ffffff;
|
||||||
--color-danger: #111111;
|
|
||||||
--color-danger-tint: #ffffff;
|
|
||||||
--accent-text-mix: 100%;
|
--accent-text-mix: 100%;
|
||||||
font-size: 112.5%;
|
font-size: 112.5%;
|
||||||
scroll-behavior: auto;
|
scroll-behavior: auto;
|
||||||
|
|
@ -287,8 +288,6 @@ iframe[src*="churchcenter"] {
|
||||||
--color-tint: #111111;
|
--color-tint: #111111;
|
||||||
--color-tint-soft: #111111;
|
--color-tint-soft: #111111;
|
||||||
--color-raised: #111111;
|
--color-raised: #111111;
|
||||||
--color-danger: #eeeeee;
|
|
||||||
--color-danger-tint: #111111;
|
|
||||||
}
|
}
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
:root[data-reading="on"]:not([data-theme="light"]) {
|
:root[data-reading="on"]:not([data-theme="light"]) {
|
||||||
|
|
@ -303,86 +302,127 @@ iframe[src*="churchcenter"] {
|
||||||
--color-tint: #111111;
|
--color-tint: #111111;
|
||||||
--color-tint-soft: #111111;
|
--color-tint-soft: #111111;
|
||||||
--color-raised: #111111;
|
--color-raised: #111111;
|
||||||
--color-danger: #eeeeee;
|
|
||||||
--color-danger-tint: #111111;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Everything takes the page's two colors, inline styles included. */
|
.reader {
|
||||||
:root[data-reading="on"] body * {
|
max-width: 60rem;
|
||||||
color: var(--color-ink) !important;
|
|
||||||
background-color: transparent !important;
|
|
||||||
background-image: none !important;
|
|
||||||
border-color: transparent !important;
|
|
||||||
box-shadow: none !important;
|
|
||||||
text-shadow: none !important;
|
|
||||||
filter: none !important;
|
|
||||||
mask-image: none !important;
|
|
||||||
-webkit-mask-image: none !important;
|
|
||||||
}
|
|
||||||
:root[data-reading="on"] body,
|
|
||||||
:root[data-reading="on"] header,
|
|
||||||
:root[data-reading="on"] .reading-solid {
|
|
||||||
background-color: var(--color-surface) !important;
|
|
||||||
}
|
|
||||||
:root[data-reading="on"] header {
|
|
||||||
border-bottom: 1px solid var(--color-muted) !important;
|
|
||||||
}
|
|
||||||
:root[data-reading="on"] *,
|
|
||||||
:root[data-reading="on"] *::before,
|
|
||||||
:root[data-reading="on"] *::after {
|
|
||||||
animation: none !important;
|
|
||||||
transition: none !important;
|
|
||||||
}
|
|
||||||
/* Pictures, video, maps and drawings go; the icons inside links and
|
|
||||||
buttons stay, in the text color, so an icon-only button keeps
|
|
||||||
its face. */
|
|
||||||
:root[data-reading="on"] main :is(img, picture, video, iframe, canvas, object),
|
|
||||||
:root[data-reading="on"] main svg:not(:is(a, button, label) svg),
|
|
||||||
:root[data-reading="on"] .page-backdrop,
|
|
||||||
:root[data-reading="on"] .notice::before,
|
|
||||||
:root[data-reading="on"] .notice::after {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
:root[data-reading="on"] [data-reading-alt]::after {
|
|
||||||
content: attr(data-reading-alt);
|
|
||||||
display: block;
|
|
||||||
margin-block: 0.5rem;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
/* Controls keep an outline so they still read as controls. */
|
|
||||||
:root[data-reading="on"] :is(button, input, select, textarea, .btn) {
|
|
||||||
border: 1px solid var(--color-ink) !important;
|
|
||||||
}
|
|
||||||
:root[data-reading="on"] main {
|
|
||||||
max-width: 42rem;
|
|
||||||
margin-inline: auto;
|
margin-inline: auto;
|
||||||
padding-inline: 1rem;
|
padding: 2.5rem 1rem 6rem;
|
||||||
}
|
|
||||||
:root[data-reading="on"] main .grid {
|
|
||||||
grid-template-columns: minmax(0, 1fr) !important;
|
|
||||||
}
|
|
||||||
:root[data-reading="on"] main :is(p, li, dd) {
|
|
||||||
line-height: 1.75;
|
line-height: 1.75;
|
||||||
}
|
}
|
||||||
:root[data-reading="on"] a {
|
.reader > * + * {
|
||||||
text-decoration: underline !important;
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.reader :is(h1, h2, h3, h4, h5, h6) {
|
||||||
|
margin-top: 2rem;
|
||||||
|
font-family: var(--font-display);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
.reader h1 { font-size: 2rem; }
|
||||||
|
.reader h2 { font-size: 1.5rem; }
|
||||||
|
.reader h3 { font-size: 1.25rem; }
|
||||||
|
.reader :is(h4, h5, h6) { font-size: 1.1rem; }
|
||||||
|
.reader a {
|
||||||
|
text-decoration: underline;
|
||||||
text-underline-offset: 0.2em;
|
text-underline-offset: 0.2em;
|
||||||
}
|
}
|
||||||
|
.reader img {
|
||||||
/* Color blind modes (data-vision, color.ts has the reasoning and the
|
display: block;
|
||||||
same swap for colors set from code). The palette's green family
|
max-width: 100%;
|
||||||
as variables, so CSS that uses it swaps too. */
|
height: auto;
|
||||||
:root {
|
}
|
||||||
--green-0: #4a7431;
|
|
||||||
--green-1: #23361a;
|
/* The palette's three color families as variables, [main, darkest,
|
||||||
--green-2: #9cc47c;
|
light, lightest] as in color.ts, so CSS that draws in them follows
|
||||||
--green-3: #e6f0dd;
|
a color blind mode. Ink stays gray in every mode. */
|
||||||
|
:root {
|
||||||
|
--pal-teal-0: #00748a;
|
||||||
|
--pal-teal-1: #003a45;
|
||||||
|
--pal-teal-2: #5cd3e6;
|
||||||
|
--pal-teal-3: #d6f5fa;
|
||||||
|
--pal-green-0: #4a7431;
|
||||||
|
--pal-green-1: #23361a;
|
||||||
|
--pal-green-2: #9cc47c;
|
||||||
|
--pal-green-3: #e6f0dd;
|
||||||
|
--pal-amber-0: #8f5b00;
|
||||||
|
--pal-amber-1: #4a2e00;
|
||||||
|
--pal-amber-2: #f0bd4f;
|
||||||
|
--pal-amber-3: #fdf1d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Color blind modes (data-vision; color.ts has the reasoning and the
|
||||||
|
same values for colors set from code and data). Each mode replaces
|
||||||
|
all three families with ones that stay apart for that type, at the
|
||||||
|
same contrasts (main shades 5.3:1 or more on white, light ones 9:1
|
||||||
|
or more under ink), and the theme tokens below follow them. */
|
||||||
|
:root[data-vision="protanopia"] {
|
||||||
|
--pal-teal-0: #167c16;
|
||||||
|
--pal-teal-1: #0b3c0b;
|
||||||
|
--pal-teal-2: #55ca55;
|
||||||
|
--pal-teal-3: #e3f5e3;
|
||||||
|
--pal-green-0: #921a92;
|
||||||
|
--pal-green-1: #5b105b;
|
||||||
|
--pal-green-2: #e09ce0;
|
||||||
|
--pal-green-3: #f9edf9;
|
||||||
|
--pal-amber-0: #603911;
|
||||||
|
--pal-amber-1: #482a0d;
|
||||||
|
--pal-amber-2: #d7ab7f;
|
||||||
|
--pal-amber-3: #f7efe7;
|
||||||
|
}
|
||||||
|
:root[data-vision="deuteranopia"] {
|
||||||
|
--pal-teal-0: #3939dc;
|
||||||
|
--pal-teal-1: #1b1b9b;
|
||||||
|
--pal-teal-2: #aeaee6;
|
||||||
|
--pal-teal-3: #f0f0fa;
|
||||||
|
--pal-green-0: #11602b;
|
||||||
|
--pal-green-1: #0b3c1b;
|
||||||
|
--pal-green-2: #51c979;
|
||||||
|
--pal-green-3: #e1f5e7;
|
||||||
|
--pal-amber-0: #627214;
|
||||||
|
--pal-amber-1: #30370a;
|
||||||
|
--pal-amber-2: #a7bd3b;
|
||||||
|
--pal-amber-3: #eff3db;
|
||||||
|
}
|
||||||
|
:root[data-vision="tritanopia"] {
|
||||||
|
--pal-teal-0: #167a59;
|
||||||
|
--pal-teal-1: #0a3b2a;
|
||||||
|
--pal-teal-2: #4bc79e;
|
||||||
|
--pal-teal-3: #e1f5ee;
|
||||||
|
--pal-green-0: #a31d33;
|
||||||
|
--pal-green-1: #661220;
|
||||||
|
--pal-green-2: #e2a2ac;
|
||||||
|
--pal-green-3: #f9eef0;
|
||||||
|
--pal-amber-0: #6f6f14;
|
||||||
|
--pal-amber-1: #353509;
|
||||||
|
--pal-amber-2: #b9b93a;
|
||||||
|
--pal-amber-3: #f2f2d8;
|
||||||
|
}
|
||||||
|
/* The theme tokens drawn from the families, light and dark, as in
|
||||||
|
index.css's defaults. Not in reading mode, which has its own two
|
||||||
|
colors. Unlayered, so they win over the admin's colors. */
|
||||||
|
:root:is([data-vision="protanopia"], [data-vision="deuteranopia"], [data-vision="tritanopia"]):not([data-reading="on"]) {
|
||||||
|
--color-body: var(--pal-teal-1);
|
||||||
|
--color-link: var(--pal-teal-0);
|
||||||
|
--color-brand: var(--pal-teal-0);
|
||||||
|
--color-action: var(--pal-teal-0);
|
||||||
|
--color-action-hover: var(--pal-teal-1);
|
||||||
|
--color-tint: var(--pal-teal-3);
|
||||||
|
--color-tint-soft: color-mix(in srgb, var(--pal-teal-3) 50%, #f5f9f8);
|
||||||
|
}
|
||||||
|
:root:is([data-vision="protanopia"], [data-vision="deuteranopia"], [data-vision="tritanopia"]):not([data-reading="on"])[data-theme="dark"] {
|
||||||
|
--color-body: var(--pal-teal-3);
|
||||||
|
--color-link: var(--pal-teal-2);
|
||||||
|
--color-tint: var(--pal-teal-1);
|
||||||
|
--color-tint-soft: color-mix(in srgb, var(--pal-teal-1) 50%, #001011);
|
||||||
|
}
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root:is([data-vision="protanopia"], [data-vision="deuteranopia"], [data-vision="tritanopia"]):not([data-reading="on"]):not([data-theme="light"]) {
|
||||||
|
--color-body: var(--pal-teal-3);
|
||||||
|
--color-link: var(--pal-teal-2);
|
||||||
|
--color-tint: var(--pal-teal-1);
|
||||||
|
--color-tint-soft: color-mix(in srgb, var(--pal-teal-1) 50%, #001011);
|
||||||
}
|
}
|
||||||
:root:is([data-vision="protanopia"], [data-vision="tritanopia"]) {
|
|
||||||
--green-0: #9839dc;
|
|
||||||
--green-1: #4d1575;
|
|
||||||
--green-2: #c9a5e3;
|
|
||||||
--green-3: #f4eef9;
|
|
||||||
}
|
}
|
||||||
/* Monochrome: the whole page in grays. On the root element a filter
|
/* Monochrome: the whole page in grays. On the root element a filter
|
||||||
leaves fixed elements (the header, the panel) where they were. */
|
leaves fixed elements (the header, the panel) where they were. */
|
||||||
|
|
|
||||||
|
|
@ -61,17 +61,26 @@ export const STORED_PALETTE = {
|
||||||
<html data-vision> is set before the first paint (index.html)
|
<html data-vision> is set before the first paint (index.html)
|
||||||
and a change reloads the page, so it's read once here.
|
and a change reloads the page, so it's read once here.
|
||||||
|
|
||||||
Simulated with the Machado (2009) matrices, the palette's green
|
Every color on the site is one of three color families (teal,
|
||||||
and amber families blur together for protanopia and tritanopia,
|
green, amber) or the gray ink. Seen with protanopia or
|
||||||
so there green becomes violet, the same four shades at the same
|
deuteranopia, colors fall on one blue to yellow line plus light
|
||||||
contrasts (5.3:1 on white for the main one, 9:1 or better under
|
and dark; with tritanopia, on a red to cyan one. Three families at
|
||||||
ink for the light ones). For deuteranopia the palette already
|
one darkness can't all stay apart there, so each mode replaces all
|
||||||
stays apart (violet or magenta would be worse), so it's kept.
|
three, at hues and darknesses picked by simulating the type (the
|
||||||
In each of the three, a color an admin picked off the palette
|
Machado 2009 matrices) to keep every pair, and each from the ink,
|
||||||
snaps to the nearest palette color first, so two picked colors
|
far apart for it and for typical vision too. The closest pair of
|
||||||
can't land on one confusable pair. Monochrome is a grayscale
|
main or light shades, in CIELAB distance, goes from 11.4 to 27.9
|
||||||
filter instead (index.css). The same swap for CSS is the
|
(protanopia), 19.5 to 24.7 (deuteranopia) and 6.4 to 21.1
|
||||||
--green-* variables in index.css. */
|
(tritanopia). Contrast holds: main shades 5.3:1 or more on white
|
||||||
|
and under white text, light shades 9:1 or more under ink, so the
|
||||||
|
theme tokens drawn from them (index.css) still read in both modes.
|
||||||
|
Each family keeps its role (teal is still the buttons and links).
|
||||||
|
|
||||||
|
A color an admin picked off the palette snaps to the nearest
|
||||||
|
palette shade first, so two picked colors can't land on one
|
||||||
|
confusable pair. Monochrome is a grayscale filter instead
|
||||||
|
(index.css). The same values for CSS are the --pal-* variables
|
||||||
|
in index.css. */
|
||||||
export const VISIONS = [
|
export const VISIONS = [
|
||||||
{ id: 'protanopia', label: 'Protanopia (red weak)' },
|
{ id: 'protanopia', label: 'Protanopia (red weak)' },
|
||||||
{ id: 'deuteranopia', label: 'Deuteranopia (green weak)' },
|
{ id: 'deuteranopia', label: 'Deuteranopia (green weak)' },
|
||||||
|
|
@ -79,11 +88,22 @@ export const VISIONS = [
|
||||||
{ id: 'monochrome', label: 'Monochrome' },
|
{ id: 'monochrome', label: 'Monochrome' },
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
const VIOLET = ['#9839dc', '#4d1575', '#c9a5e3', '#f4eef9']
|
|
||||||
const SWAPS: Record<string, Partial<Record<keyof typeof STORED_PALETTE, string[]>>> = {
|
const SWAPS: Record<string, Partial<Record<keyof typeof STORED_PALETTE, string[]>>> = {
|
||||||
protanopia: { green: VIOLET },
|
protanopia: {
|
||||||
deuteranopia: {},
|
teal: ['#167c16', '#0b3c0b', '#55ca55', '#e3f5e3'],
|
||||||
tritanopia: { green: VIOLET },
|
green: ['#921a92', '#5b105b', '#e09ce0', '#f9edf9'],
|
||||||
|
amber: ['#603911', '#482a0d', '#d7ab7f', '#f7efe7'],
|
||||||
|
},
|
||||||
|
deuteranopia: {
|
||||||
|
teal: ['#3939dc', '#1b1b9b', '#aeaee6', '#f0f0fa'],
|
||||||
|
green: ['#11602b', '#0b3c1b', '#51c979', '#e1f5e7'],
|
||||||
|
amber: ['#627214', '#30370a', '#a7bd3b', '#eff3db'],
|
||||||
|
},
|
||||||
|
tritanopia: {
|
||||||
|
teal: ['#167a59', '#0a3b2a', '#4bc79e', '#e1f5ee'],
|
||||||
|
green: ['#a31d33', '#661220', '#e2a2ac', '#f9eef0'],
|
||||||
|
amber: ['#6f6f14', '#353509', '#b9b93a', '#f2f2d8'],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const vision = typeof document === 'undefined' ? undefined : document.documentElement.dataset.vision
|
const vision = typeof document === 'undefined' ? undefined : document.documentElement.dataset.vision
|
||||||
|
|
@ -133,9 +153,9 @@ export const BRAND = 'var(--color-action)'
|
||||||
|
|
||||||
export const ACCENTS = {
|
export const ACCENTS = {
|
||||||
teal: BRAND,
|
teal: BRAND,
|
||||||
deep: '#003a45',
|
deep: visionColor('#003a45'),
|
||||||
green: visionColor('#4a7431'),
|
green: visionColor('#4a7431'),
|
||||||
amber: '#8f5b00',
|
amber: visionColor('#8f5b00'),
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A palette fill for something colored by its name, like the
|
/* A palette fill for something colored by its name, like the
|
||||||
|
|
|
||||||
|
|
@ -151,18 +151,3 @@ export function refHref(
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Where "back" goes from a record page. A group belongs to
|
|
||||||
/community, a retreat to /retreats. */
|
|
||||||
export function orgListHref(kind?: string | null): { to: string; label: string } {
|
|
||||||
switch (kind) {
|
|
||||||
case 'region':
|
|
||||||
return { to: '/community#regions', label: 'All regions' }
|
|
||||||
case 'group':
|
|
||||||
return { to: '/community#groups', label: 'All groups' }
|
|
||||||
case 'partner':
|
|
||||||
return { to: '/community#partners', label: 'All partner organizations' }
|
|
||||||
default:
|
|
||||||
return { to: '/community', label: 'Community' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
15
src/lib/readingMode.ts
Normal file
15
src/lib/readingMode.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
/* Whether the accessibility panel's reading mode is on: <html
|
||||||
|
data-reading="on">, set before the first paint (index.html) and by
|
||||||
|
the panel. A hook, so the layout redraws the moment it changes. */
|
||||||
|
|
||||||
|
import { useSyncExternalStore } from 'react'
|
||||||
|
|
||||||
|
const read = () => document.documentElement.dataset.reading === 'on'
|
||||||
|
|
||||||
|
function subscribe(onChange: () => void) {
|
||||||
|
const observer = new MutationObserver(onChange)
|
||||||
|
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-reading'] })
|
||||||
|
return () => observer.disconnect()
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useReadingMode = (): boolean => useSyncExternalStore(subscribe, read, () => false)
|
||||||
|
|
@ -7,4 +7,4 @@
|
||||||
box or a build banner can read the same value later.
|
box or a build banner can read the same value later.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
export const SITE_VERSION = "NGU-Web.v1.12.0-accessibility";
|
export const SITE_VERSION = "NGU-Web.v1.12.1-accessibility";
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,15 @@ function GivingPanel() {
|
||||||
"
|
"
|
||||||
style={{ backgroundColor: BRAND, "--tw-ring-color": BRAND } as React.CSSProperties}
|
style={{ backgroundColor: BRAND, "--tw-ring-color": BRAND } as React.CSSProperties}
|
||||||
>
|
>
|
||||||
Give
|
Give through Church Center
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<p className="mt-4 text-sm text-muted">
|
<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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@
|
||||||
record (GET /directory), scored by suggest.ts against the
|
record (GET /directory), scored by suggest.ts against the
|
||||||
address. So /organisation offers Organization, /retreat offers
|
address. So /organisation offers Organization, /retreat offers
|
||||||
Retreats, and an old /chapters/lynnwood offers the Lynnwood group.
|
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
|
The server sends this same page with a 404 status for an unknown
|
||||||
address (routes/pages.js), so search engines drop it.
|
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 { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts'
|
||||||
import { suggest, type Candidate } from '../lib/suggest.ts'
|
import { suggest, type Candidate } from '../lib/suggest.ts'
|
||||||
import { ACCENTS, BRAND } from '../lib/color.ts'
|
import { ACCENTS, BRAND } from '../lib/color.ts'
|
||||||
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
|
|
||||||
const ORG_KIND_LABEL: Record<string, string> = {
|
const ORG_KIND_LABEL: Record<string, string> = {
|
||||||
national: 'Organization',
|
national: 'Organization',
|
||||||
|
|
@ -64,6 +66,7 @@ export default function NotFound() {
|
||||||
const { pathname } = useLocation()
|
const { pathname } = useLocation()
|
||||||
const { data: directory, loading } = useDirectory()
|
const { data: directory, loading } = useDirectory()
|
||||||
const matches = useMemo(() => suggest(pathname, candidates(directory ?? null)), [pathname, directory])
|
const matches = useMemo(() => suggest(pathname, candidates(directory ?? null)), [pathname, directory])
|
||||||
|
const reading = useReadingMode()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageShell
|
<PageShell
|
||||||
|
|
@ -103,13 +106,13 @@ export default function NotFound() {
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
<p className="notice max-w-xl p-6 text-body">
|
<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>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
...(reading ? [] : [{
|
||||||
id: 'start',
|
id: 'start',
|
||||||
title: 'Start from',
|
title: 'Start from',
|
||||||
accent: ACCENTS.green,
|
accent: ACCENTS.green,
|
||||||
|
|
@ -126,7 +129,7 @@ export default function NotFound() {
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
}]),
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,12 @@ import {
|
||||||
useOrganization,
|
useOrganization,
|
||||||
type OrganizationRecord,
|
type OrganizationRecord,
|
||||||
} from '../lib/useContent.ts'
|
} from '../lib/useContent.ts'
|
||||||
import { orgHref, orgListHref } from '../lib/hrefs.ts'
|
import { orgHref } from '../lib/hrefs.ts'
|
||||||
import { mediaUrl } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import { initialsFor } from '../lib/organizations.ts'
|
import { initialsFor } from '../lib/organizations.ts'
|
||||||
import Logo from '../components/Logo.tsx'
|
import Logo from '../components/Logo.tsx'
|
||||||
import { withAlpha, accentText, readableOn, BRAND } from '../lib/color.ts'
|
import { withAlpha, accentText, readableOn, BRAND } from '../lib/color.ts'
|
||||||
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
|
|
||||||
const BODY = 'var(--color-muted)'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
|
|
@ -38,6 +39,7 @@ export default function OrganizationDetail() {
|
||||||
const { id } = useParams()
|
const { id } = useParams()
|
||||||
const { pathname } = useLocation()
|
const { pathname } = useLocation()
|
||||||
const { data: org, loading, error, notFound, reload } = useOrganization(id)
|
const { data: org, loading, error, notFound, reload } = useOrganization(id)
|
||||||
|
const reading = useReadingMode()
|
||||||
|
|
||||||
if (!org) {
|
if (!org) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -70,7 +72,6 @@ export default function OrganizationDetail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const accent = org.color || BRAND
|
const accent = org.color || BRAND
|
||||||
const back = orgListHref(org.kind)
|
|
||||||
|
|
||||||
const sections: any[] = [
|
const sections: any[] = [
|
||||||
{
|
{
|
||||||
|
|
@ -79,7 +80,7 @@ export default function OrganizationDetail() {
|
||||||
accent,
|
accent,
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
||||||
<Facts org={org} accent={accent} back={back} />
|
<Facts org={org} accent={accent} />
|
||||||
|
|
||||||
{org.description.map((paragraph, index) => (
|
{org.description.map((paragraph, index) => (
|
||||||
<p key={index} className="leading-relaxed max-w-3xl" style={{ color: BODY }}>
|
<p key={index} className="leading-relaxed max-w-3xl" style={{ color: BODY }}>
|
||||||
|
|
@ -144,12 +145,25 @@ export default function OrganizationDetail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (org.awards.length > 0) {
|
if (org.awards.length > 0) {
|
||||||
|
const recipients = (count: number) =>
|
||||||
|
count === 0 ? 'No recipients yet' : `${count} recipient${count === 1 ? '' : 's'}`
|
||||||
sections.push({
|
sections.push({
|
||||||
id: 'awards',
|
id: 'awards',
|
||||||
title: 'Awards',
|
title: 'Awards',
|
||||||
blurb: `Given by ${org.short_name || org.name}.`,
|
blurb: `Given by ${org.short_name || org.name}.`,
|
||||||
accent,
|
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">
|
<div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2">
|
||||||
{org.awards.map((award) => (
|
{org.awards.map((award) => (
|
||||||
<Link
|
<Link
|
||||||
|
|
@ -167,9 +181,7 @@ export default function OrganizationDetail() {
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<span className="mt-3 block text-xs uppercase tracking-wide opacity-70" style={{ color: BODY }}>
|
<span className="mt-3 block text-xs uppercase tracking-wide opacity-70" style={{ color: BODY }}>
|
||||||
{award.recipient_count === 0
|
{recipients(award.recipient_count)}
|
||||||
? 'No recipients yet'
|
|
||||||
: `${award.recipient_count} recipient${award.recipient_count === 1 ? '' : 's'}`}
|
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
|
|
@ -211,11 +223,9 @@ export default function OrganizationDetail() {
|
||||||
function Facts({
|
function Facts({
|
||||||
org,
|
org,
|
||||||
accent,
|
accent,
|
||||||
back,
|
|
||||||
}: {
|
}: {
|
||||||
org: OrganizationRecord
|
org: OrganizationRecord
|
||||||
accent: string
|
accent: string
|
||||||
back: { to: string; label: string }
|
|
||||||
}) {
|
}) {
|
||||||
const where =
|
const where =
|
||||||
org.location_label || [org.locality, org.state_code].filter(Boolean).join(', ')
|
org.location_label || [org.locality, org.state_code].filter(Boolean).join(', ')
|
||||||
|
|
@ -248,10 +258,6 @@ function Facts({
|
||||||
<span style={{ color: BODY }}>Since {org.details.started}</span>
|
<span style={{ color: BODY }}>Since {org.details.started}</span>
|
||||||
)}
|
)}
|
||||||
{org.is_online && <span style={{ color: BODY }}>Online</span>}
|
{org.is_online && <span style={{ color: BODY }}>Online</span>}
|
||||||
|
|
||||||
<Link to={back.to} className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
|
|
||||||
{back.label}
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ import { mediaUrl, initials } from '../lib/media.ts'
|
||||||
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
||||||
import { capitalize } from '../lib/text.ts'
|
import { capitalize } from '../lib/text.ts'
|
||||||
import { accentText, BRAND } from '../lib/color.ts'
|
import { accentText, BRAND } from '../lib/color.ts'
|
||||||
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
|
|
||||||
const BODY = 'var(--color-muted)'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
|
|
@ -205,7 +206,7 @@ export default function PersonDetail() {
|
||||||
{(posts) => (
|
{(posts) => (
|
||||||
<ul className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
<ul className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||||
{posts.map((post) => (
|
{posts.map((post) => (
|
||||||
<PostCard key={post.id} post={post} accent={accent} />
|
<PostCard key={post.id} post={post} accent={accent} level={3} />
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
|
|
@ -231,7 +232,9 @@ function Capped<T>({
|
||||||
children: (shown: T[]) => ReactNode
|
children: (shown: T[]) => ReactNode
|
||||||
}) {
|
}) {
|
||||||
const [all, setAll] = useState(false)
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
{children(more ? items.slice(0, SHOW_FIRST) : items)}
|
{children(more ? items.slice(0, SHOW_FIRST) : items)}
|
||||||
|
|
@ -253,6 +256,8 @@ function Capped<T>({
|
||||||
|
|
||||||
function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||||
const photo = mediaUrl(person.photo)
|
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 (
|
return (
|
||||||
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
||||||
|
|
@ -274,9 +279,16 @@ function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{person.pronouns && <span style={{ color: BODY }}>{person.pronouns}</span>}
|
{person.pronouns && (
|
||||||
|
<span style={{ color: BODY }}>
|
||||||
|
{reading && 'Pronouns: '}
|
||||||
|
{person.pronouns}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
|
||||||
{person.org && (
|
{person.org && (
|
||||||
|
<span>
|
||||||
|
{reading && 'Home organization: '}
|
||||||
<Link
|
<Link
|
||||||
to={orgHref(person.org.id, person.org.kind)}
|
to={orgHref(person.org.id, person.org.kind)}
|
||||||
className="font-medium hover:underline"
|
className="font-medium hover:underline"
|
||||||
|
|
@ -284,12 +296,18 @@ function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||||
>
|
>
|
||||||
{person.org.name}
|
{person.org.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{person.location_label && <span style={{ color: BODY }}>{person.location_label}</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) }}>
|
<Link to="/organization#leadership" className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
|
||||||
Leadership
|
{reading ? 'All leadership' : 'Leadership'}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const PAGE = sitePage("/privacy");
|
||||||
'privacy', in Admin → Forms → Data requests.
|
'privacy', in Admin → Forms → Data requests.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
const LAST_UPDATED = "September 30, 2026";
|
const LAST_UPDATED = "October 3, 2026";
|
||||||
|
|
||||||
const link = "underline underline-offset-2 text-link";
|
const link = "underline underline-offset-2 text-link";
|
||||||
|
|
||||||
|
|
@ -137,11 +137,28 @@ const PARTS: LegalPart[] = [
|
||||||
id: "cookies",
|
id: "cookies",
|
||||||
heading: "Cookies and browser storage",
|
heading: "Cookies and browser storage",
|
||||||
body: [
|
body: [
|
||||||
"This site doesn't use advertising or tracking cookies, and doesn't use Google Analytics. To see which pages are read, we use Plausible Analytics, which we host ourselves on our own server: it sets no cookies, doesn't follow you across sites, and keeps no personal information, only counts of visits to each page; nothing from it is shared or sold. The site also keeps a few small things in your own browser so it works the way you left it:",
|
<>
|
||||||
|
This site doesn't use advertising or tracking cookies, and doesn't use Google Analytics. To see which
|
||||||
|
pages are read, we use{" "}
|
||||||
|
<a href="https://plausible.io" className="text-link underline underline-offset-2">
|
||||||
|
Plausible Analytics
|
||||||
|
</a>
|
||||||
|
, which we host ourselves on our own server using its free, open-source{" "}
|
||||||
|
<a
|
||||||
|
href="https://github.com/plausible/community-edition/"
|
||||||
|
className="text-link underline underline-offset-2"
|
||||||
|
>
|
||||||
|
Community Edition
|
||||||
|
</a>
|
||||||
|
: it sets no cookies, doesn't follow you across sites, and keeps no personal information, only counts
|
||||||
|
of visits to each page; nothing from it is shared or sold. The site also keeps a few small things in
|
||||||
|
your own browser so it works the way you left it:
|
||||||
|
</>,
|
||||||
],
|
],
|
||||||
list: [
|
list: [
|
||||||
"That you closed the announcement banner or the privacy notice.",
|
"That you closed the announcement banner or the privacy notice.",
|
||||||
"Whether you chose the light or dark look.",
|
"Whether you chose the light or dark look.",
|
||||||
|
"Your accessibility choices: the dyslexia-friendly font, reading mode and color blind mode.",
|
||||||
"For staff who sign in: a sign-in cookie that keeps you signed in, and a short-lived one used while signing in with Google.",
|
"For staff who sign in: a sign-in cookie that keeps you signed in, and a short-lived one used while signing in with Google.",
|
||||||
],
|
],
|
||||||
after: [
|
after: [
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ export default function TeamDetail() {
|
||||||
|
|
||||||
sections.push({
|
sections.push({
|
||||||
id: 'members',
|
id: 'members',
|
||||||
title: hasAbout ? 'Members' : team.name,
|
title: 'Members',
|
||||||
accent,
|
accent,
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-6">
|
<div className="max-w-6xl mx-auto px-6 space-y-6">
|
||||||
|
|
@ -142,14 +142,6 @@ function Facts({
|
||||||
{orgName}
|
{orgName}
|
||||||
</Link>
|
</Link>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<Link
|
|
||||||
to={orgHref(orgId, orgKind)}
|
|
||||||
className="ml-auto hover:underline"
|
|
||||||
style={{ color: accentText(accent) }}
|
|
||||||
>
|
|
||||||
Back to {orgName}
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,12 @@ const DEFAULTS = {
|
||||||
|
|
||||||
const EXCERPT_CHARS = 180
|
const EXCERPT_CHARS = 180
|
||||||
|
|
||||||
/* One post as a card; person pages list their posts with it too. */
|
/* One post as a card; person pages list their posts with it too.
|
||||||
export function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
`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 cover = useSmallImage(mediaUrl(post.cover_image))
|
||||||
const date = postDate(post.published_on)
|
const date = postDate(post.published_on)
|
||||||
const authors = post.authors.map((author) => author.name).join(', ')
|
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="aspect-video w-full bg-tint" />
|
||||||
)}
|
)}
|
||||||
<div className="flex flex-1 flex-col p-6">
|
<div className="flex flex-1 flex-col p-6">
|
||||||
{(date || post.tags.length > 0) && (
|
<Title className="mt-2 font-display text-xl font-bold leading-snug text-ink">
|
||||||
<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">
|
|
||||||
<Link
|
<Link
|
||||||
to={blogHref(post.id)}
|
to={blogHref(post.id)}
|
||||||
className="after:absolute after:inset-0 after:content-[''] hover:underline"
|
className="after:absolute after:inset-0 after:content-[''] hover:underline"
|
||||||
>
|
>
|
||||||
{post.title}
|
{post.title}
|
||||||
</Link>
|
</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 && (
|
{post.excerpt && (
|
||||||
<p className="mt-2 leading-relaxed text-muted">{preview(post.excerpt, EXCERPT_CHARS)}</p>
|
<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>
|
</div>
|
||||||
{external.cards.length > 0 && (
|
{external.cards.length > 0 && (
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
<FeaturedCards cards={external.cards} />
|
<FeaturedCards cards={external.cards} level={4} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,9 @@
|
||||||
Below md the grid would be seven unreadable slivers, so the month
|
Below md the grid would be seven unreadable slivers, so the month
|
||||||
view shows the list there instead. The toggle still works; it
|
view shows the list there instead. The toggle still works; it
|
||||||
just has one answer on a phone.
|
just has one answer on a phone.
|
||||||
|
|
||||||
|
Reading mode (readingMode.ts) gets no grid or controls: the next
|
||||||
|
six weeks from today as a list, one line per event (ReadingList).
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { ArrowRight, ArrowLeft, CaretRight, CaretLeft } from '@phosphor-icons/react'
|
import { ArrowRight, ArrowLeft, CaretRight, CaretLeft } from '@phosphor-icons/react'
|
||||||
|
|
@ -52,6 +55,7 @@ import { eventHref } from '../../lib/hrefs.ts'
|
||||||
import type { EventListItem } from '../../lib/useContent.ts'
|
import type { EventListItem } from '../../lib/useContent.ts'
|
||||||
import { withAlpha, accentText, readableOn, BRAND } from '../../lib/color.ts'
|
import { withAlpha, accentText, readableOn, BRAND } from '../../lib/color.ts'
|
||||||
import { localISO } from '../../lib/timeline.ts'
|
import { localISO } from '../../lib/timeline.ts'
|
||||||
|
import { useReadingMode } from '../../lib/readingMode.ts'
|
||||||
|
|
||||||
export type CalendarControl = 'scope' | 'type' | 'online' | 'search'
|
export type CalendarControl = 'scope' | 'type' | 'online' | 'search'
|
||||||
export type CalendarView = 'month' | 'list'
|
export type CalendarView = 'month' | 'list'
|
||||||
|
|
@ -225,7 +229,43 @@ function nextDateAfter(events: EventListItem[], after: string): string | null {
|
||||||
|
|
||||||
/* ── Component ───────────────────────────────────────────────── */
|
/* ── Component ───────────────────────────────────────────────── */
|
||||||
|
|
||||||
export default function EventCalendar({
|
export default function EventCalendar(props: EventCalendarProps) {
|
||||||
|
return useReadingMode() ? <ReadingList {...props} /> : <CalendarGrid {...props} />
|
||||||
|
}
|
||||||
|
|
||||||
|
/* How many days from today the reading mode list covers. */
|
||||||
|
const READING_DAYS = 42
|
||||||
|
|
||||||
|
/* Reading mode: what's on from today for six weeks, as text. */
|
||||||
|
function ReadingList({ scope, host, status, type }: EventCalendarProps) {
|
||||||
|
const today = iso(new Date())
|
||||||
|
const to = addDays(today, READING_DAYS - 1)
|
||||||
|
const { events, loading, error } = useEvents({ scope, host, status, type, from: today, to })
|
||||||
|
const items = useMemo(() => occurrencesIn(events, today, to), [events, today, to])
|
||||||
|
|
||||||
|
if (error) return <p>Couldn’t load the calendar. {error}</p>
|
||||||
|
if (loading && items.length === 0) return <p>Loading the calendar…</p>
|
||||||
|
if (items.length === 0) return <p>Nothing on the calendar in the next six weeks.</p>
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ul>
|
||||||
|
{items.map((item) => {
|
||||||
|
const { event } = item
|
||||||
|
const when = item.start !== item.end ? rangeLabel(item.start, item.end) : longDay(item.start)
|
||||||
|
const where = event.location_label || (event.is_online ? 'Online' : null)
|
||||||
|
return (
|
||||||
|
<li key={item.key}>
|
||||||
|
{when}: <Link to={eventHref(event.id)}>{event.title}</Link>
|
||||||
|
{event.status === 'cancelled' && ' (canceled)'}
|
||||||
|
{[item.time, eventTypeLabel(event.event_type), where].filter(Boolean).map((part) => `, ${part}`)}
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarGrid({
|
||||||
scope,
|
scope,
|
||||||
host,
|
host,
|
||||||
status,
|
status,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { mediaUrl } from "../../lib/media.ts";
|
||||||
import { useSmallImage } from "../../lib/useSmallImage.ts";
|
import { useSmallImage } from "../../lib/useSmallImage.ts";
|
||||||
import Logo from "../../components/Logo.tsx";
|
import Logo from "../../components/Logo.tsx";
|
||||||
import { accentText, withAlpha, readableOn, BRAND } from '../../lib/color.ts'
|
import { accentText, withAlpha, readableOn, BRAND } from '../../lib/color.ts'
|
||||||
|
import { useReadingMode } from "../../lib/readingMode.ts";
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
EVENT LIST: CARDS
|
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
|
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
|
to narrow by, but only once it holds more than one, so a band of
|
||||||
nothing but retreats shows no control at all.
|
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
|
`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.
|
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({
|
export function Card({
|
||||||
ev,
|
ev,
|
||||||
|
|
@ -161,7 +171,10 @@ export function Card({
|
||||||
interactive = true,
|
interactive = true,
|
||||||
linked = true,
|
linked = true,
|
||||||
showType = false,
|
showType = false,
|
||||||
|
level = 3,
|
||||||
}) {
|
}) {
|
||||||
|
const reading = useReadingMode();
|
||||||
|
const Title = level === 4 ? "h4" : "h3";
|
||||||
const past = ev.status === "past";
|
const past = ev.status === "past";
|
||||||
const color = ev.color || defaultColor;
|
const color = ev.color || defaultColor;
|
||||||
const orgLogo = mediaUrl(ev.org_logo) || DEFAULT_ORG_LOGO;
|
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
|
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. */
|
the card can't tell on its own, it only ever sees one event. */
|
||||||
const typeBadge =
|
const typeBadge =
|
||||||
showType && ev.event_type ? (
|
showType && ev.event_type && !reading ? (
|
||||||
<span
|
<span
|
||||||
className="inline-block px-3 py-0.5 mb-2 text-xs font-bold uppercase tracking-wide"
|
className="inline-block px-3 py-0.5 mb-2 text-xs font-bold uppercase tracking-wide"
|
||||||
style={{ border: `1px solid ${color}`, color: INK }}
|
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" />
|
<Logo src={orgLogo} className="ev-org h-11 w-auto mb-4" />
|
||||||
<div className="ev-info">
|
<div className="ev-info">
|
||||||
{typeBadge}
|
{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}>
|
<TitleLink ev={ev} linked={linked}>
|
||||||
{ev.title}
|
{ev.title}
|
||||||
</TitleLink>
|
</TitleLink>
|
||||||
</h3>
|
</Title>
|
||||||
{ev.theme && (
|
{ev.theme && (
|
||||||
<p className="text-lg sm:text-xl font-bold">"{ev.theme}"</p>
|
<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">
|
<div className="md:col-span-2">
|
||||||
<Logo src={orgLogo} className="h-15 w-auto mb-6" />
|
<Logo src={orgLogo} className="h-15 w-auto mb-6" />
|
||||||
{typeBadge}
|
{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}>
|
<TitleLink ev={ev} linked={linked}>
|
||||||
{ev.title}
|
{ev.title}
|
||||||
</TitleLink>
|
</TitleLink>
|
||||||
</h3>
|
</Title>
|
||||||
{ev.theme && (
|
{ev.theme && (
|
||||||
<p className="text-lg sm:text-2xl font-bold">"{ev.theme}"</p>
|
<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. */}
|
{/* Last, so Register reads first when there is one. */}
|
||||||
{linked && (
|
{linked && !reading && (
|
||||||
<Link
|
<Link
|
||||||
to={eventHref(ev.id)}
|
to={eventHref(ev.id)}
|
||||||
className={`font-bold transition-all duration-200 hover:scale-105 text-center ${
|
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 [showPast, setShowPast] = useState(false);
|
||||||
const [pastShown, setPastShown] = useState(PAST_PAGE);
|
const [pastShown, setPastShown] = useState(PAST_PAGE);
|
||||||
const [activeType, setActiveType] = useState("all");
|
const [activeType, setActiveType] = useState("all");
|
||||||
|
const reading = useReadingMode();
|
||||||
|
|
||||||
/* What this band holds, which is what the chips offer, not the
|
/* What this band holds, which is what the chips offer, not the
|
||||||
full list of declared types, three quarters of which would be
|
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.
|
// The list comes oldest first; the past grid reads newest first.
|
||||||
const { upcoming, past } = splitByStatus(events);
|
const { upcoming, past } = splitByStatus(events);
|
||||||
const pastEvents = past.reverse();
|
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 prev = () => setIndex(i => Math.max(0, i - 1));
|
||||||
const next = () => setIndex(i => Math.min(events.length - 1, i + 1));
|
const next = () => setIndex(i => Math.min(events.length - 1, i + 1));
|
||||||
|
|
@ -595,7 +611,7 @@ export default function EventListCards({
|
||||||
? empty
|
? empty
|
||||||
: `· No ${eventTypeLabel(activeType).toLowerCase()} events in this section yet ·`,
|
: `· No ${eventTypeLabel(activeType).toLowerCase()} events in this section yet ·`,
|
||||||
)
|
)
|
||||||
) : view === "grid" ? (
|
) : view === "grid" || reading ? (
|
||||||
/* ── GRID VIEW: upcoming first, past events collapsed below ── */
|
/* ── GRID VIEW: upcoming first, past events collapsed below ── */
|
||||||
<div className="mx-auto px-8 md:px-12 lg:px-16" style={{ maxWidth: GRID_MAX }}>
|
<div className="mx-auto px-8 md:px-12 lg:px-16" style={{ maxWidth: GRID_MAX }}>
|
||||||
{upcoming.length > 0 && (
|
{upcoming.length > 0 && (
|
||||||
|
|
@ -630,16 +646,16 @@ export default function EventListCards({
|
||||||
<div
|
<div
|
||||||
className="relative transition-all duration-500 ease-out"
|
className="relative transition-all duration-500 ease-out"
|
||||||
style={{
|
style={{
|
||||||
maxHeight: showPast ? "none" : PAST_PEEK,
|
maxHeight: pastOpen ? "none" : PAST_PEEK,
|
||||||
overflow: showPast ? "visible" : "hidden",
|
overflow: pastOpen ? "visible" : "hidden",
|
||||||
maskImage: showPast ? "none" : PAST_FADE,
|
maskImage: pastOpen ? "none" : PAST_FADE,
|
||||||
WebkitMaskImage: showPast ? "none" : PAST_FADE,
|
WebkitMaskImage: pastOpen ? "none" : PAST_FADE,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="grid gap-6 items-stretch"
|
className="grid gap-6 items-stretch"
|
||||||
style={{ gridTemplateColumns: GRID_TEMPLATE }}
|
style={{ gridTemplateColumns: GRID_TEMPLATE }}
|
||||||
aria-hidden={!showPast}
|
aria-hidden={!pastOpen}
|
||||||
>
|
>
|
||||||
{pastDrawn.map(ev => (
|
{pastDrawn.map(ev => (
|
||||||
<Card
|
<Card
|
||||||
|
|
@ -648,13 +664,15 @@ export default function EventListCards({
|
||||||
defaultColor={cardColor}
|
defaultColor={cardColor}
|
||||||
accent={accent}
|
accent={accent}
|
||||||
compact
|
compact
|
||||||
interactive={showPast}
|
interactive={pastOpen}
|
||||||
showType={mixed}
|
showType={mixed}
|
||||||
|
level={4}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{!reading && (
|
||||||
<div className="flex flex-wrap justify-center gap-3 mt-6">
|
<div className="flex flex-wrap justify-center gap-3 mt-6">
|
||||||
{showPast && pastShown < pastEvents.length && (
|
{showPast && pastShown < pastEvents.length && (
|
||||||
<button
|
<button
|
||||||
|
|
@ -677,6 +695,7 @@ export default function EventListCards({
|
||||||
<CaretDown className="h-4 w-4 transition-transform duration-300" style={{ transform: showPast ? "rotate(180deg)" : "none" }} weight="bold" aria-hidden="true" />
|
<CaretDown className="h-4 w-4 transition-transform duration-300" style={{ transform: showPast ? "rotate(180deg)" : "none" }} weight="bold" aria-hidden="true" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { ArrowUpRight } from '@phosphor-icons/react';
|
import { ArrowUpRight } from '@phosphor-icons/react';
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||||
import OrgLogo from "../../components/OrgLogo.tsx";
|
import OrgLogo from "../../components/OrgLogo.tsx";
|
||||||
import {
|
import {
|
||||||
|
|
@ -7,6 +8,7 @@ import {
|
||||||
byName,
|
byName,
|
||||||
} from "../../lib/organizations.ts";
|
} from "../../lib/organizations.ts";
|
||||||
import { accentText } from '../../lib/color.ts'
|
import { accentText } from '../../lib/color.ts'
|
||||||
|
import { useReadingMode } from '../../lib/readingMode.ts'
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ORGANIZATION LIST: CARDS
|
ORGANIZATION LIST: CARDS
|
||||||
|
|
@ -33,9 +35,12 @@ const FALLBACK_COLOR = "#3b5456";
|
||||||
const CARD_MIN = "20rem";
|
const CARD_MIN = "20rem";
|
||||||
const GRID_MAX = "88rem";
|
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 color = org.color || accent;
|
||||||
const path = orgPath(org);
|
const path = orgPath(org);
|
||||||
|
const reading = useReadingMode();
|
||||||
|
const Name = titled ? "h4" : "h3";
|
||||||
|
|
||||||
// Tagline first, then where they are. Partners often have one and
|
// 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
|
// 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" />
|
<OrgLogo org={org} color={color} size="h-10 w-10 sm:h-14 sm:w-14" />
|
||||||
|
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<h3 className="text-lg sm:text-xl font-bold leading-tight [overflow-wrap:anywhere]" style={{ color }}>
|
<Name className="text-lg sm:text-xl font-bold leading-tight [overflow-wrap:anywhere]" style={{ color }}>
|
||||||
{org.name}
|
{path ? <Link to={path}>{org.name}</Link> : org.name}
|
||||||
</h3>
|
</Name>
|
||||||
{subtitle && (
|
{subtitle && (
|
||||||
<p className="text-sm mt-0.5" style={{ color: MUTED }}>
|
<p className="text-sm mt-0.5" style={{ color: MUTED }}>
|
||||||
{subtitle}
|
{subtitle}
|
||||||
|
|
@ -63,8 +68,9 @@ function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
||||||
|
|
||||||
{/* Top-right rather than in the footer: the footer holds
|
{/* Top-right rather than in the footer: the footer holds
|
||||||
outbound links, and the arrow goes somewhere different
|
outbound links, and the arrow goes somewhere different
|
||||||
in kind, deeper into this site. */}
|
in kind, deeper into this site. Reading mode has the
|
||||||
{path && (
|
name's link and leaves it out. */}
|
||||||
|
{path && !reading && (
|
||||||
<ArrowLink
|
<ArrowLink
|
||||||
to={path}
|
to={path}
|
||||||
label={`${org.name}: ${pageLabel}`}
|
label={`${org.name}: ${pageLabel}`}
|
||||||
|
|
@ -135,6 +141,7 @@ function Block({ title, orgs, accent, pageLabel, siteLabel }) {
|
||||||
accent={accent}
|
accent={accent}
|
||||||
pageLabel={pageLabel}
|
pageLabel={pageLabel}
|
||||||
siteLabel={siteLabel}
|
siteLabel={siteLabel}
|
||||||
|
titled={!!title}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { CaretRight, MagnifyingGlass, X } from '@phosphor-icons/react';
|
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 { useCommunity } from "../../lib/useCommunity.ts";
|
||||||
import { useOrganization } from "../../lib/useContent.ts";
|
import { useOrganization } from "../../lib/useContent.ts";
|
||||||
import { Link } from "react-router-dom";
|
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 { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
||||||
import { accentText, readableOn } from '../../lib/color.ts'
|
import { accentText, readableOn } from '../../lib/color.ts'
|
||||||
import { scrollBehavior } from "../../lib/motion.ts";
|
import { scrollBehavior } from "../../lib/motion.ts";
|
||||||
|
import { useReadingMode } from "../../lib/readingMode.ts";
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ORGANIZATION LIST: MAP
|
ORGANIZATION LIST: MAP
|
||||||
|
|
@ -58,6 +59,7 @@ const GRID_CAP = 12;
|
||||||
|
|
||||||
const US_TITLE = "US Unity Regions";
|
const US_TITLE = "US Unity Regions";
|
||||||
const INTL_TITLE = "International Unity Regions";
|
const INTL_TITLE = "International Unity Regions";
|
||||||
|
const ONLINE_TITLE = "Online Unity Regions";
|
||||||
|
|
||||||
/* ── Body content ──────────────────────────────────────────────
|
/* ── Body content ──────────────────────────────────────────────
|
||||||
A group's description is ordered blocks rather than one
|
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. */
|
/* The control for the section heading's action bar. */
|
||||||
export function OrgMapToggle({ view, setView, accent }) {
|
export function OrgMapToggle({ view, setView, accent }) {
|
||||||
const btn = active => ({
|
const btn = active => ({
|
||||||
|
|
@ -806,6 +867,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
||||||
const [hovered, setHovered] = useState<any>(null);
|
const [hovered, setHovered] = useState<any>(null);
|
||||||
const [openId, setOpenId] = useState<any>(null); // no card open on arrival
|
const [openId, setOpenId] = useState<any>(null); // no card open on arrival
|
||||||
const [query, setQuery] = useState("");
|
const [query, setQuery] = useState("");
|
||||||
|
const reading = useReadingMode();
|
||||||
|
|
||||||
// The list scrolls itself to whatever the map or legend points at.
|
// The list scrolls itself to whatever the map or legend points at.
|
||||||
const listRef = useRef<any>(null);
|
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") {
|
if (view === "grid") {
|
||||||
return (
|
return (
|
||||||
<GroupGrid
|
<GroupGrid
|
||||||
|
|
@ -960,18 +1034,14 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-[1.45fr_1fr] gap-10 items-stretch">
|
<div className="grid grid-cols-1 lg:grid-cols-[1.45fr_1fr] gap-10 items-stretch">
|
||||||
{/* Map */}
|
{/* Map */}
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
{/* On a phone the map keeps a readable size (tiles big enough
|
{/* Scales to the column's width at every size; on a phone the
|
||||||
to read and tap) and scrolls sideways in its own box. */}
|
legend and the list below are the easier way in. */}
|
||||||
<div className="-mx-6 overflow-x-auto px-6 sm:mx-0 sm:px-0">
|
|
||||||
<div className="min-w-[34rem] sm:min-w-0">
|
|
||||||
<RegionMap
|
<RegionMap
|
||||||
slices={slices}
|
slices={slices}
|
||||||
groupCounts={groupCounts}
|
groupCounts={groupCounts}
|
||||||
onPick={pickArea}
|
onPick={pickArea}
|
||||||
{...shared}
|
{...shared}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Legend
|
<Legend
|
||||||
domestic={domestic}
|
domestic={domestic}
|
||||||
international={international}
|
international={international}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { ArrowUpRight, CaretRight } from '@phosphor-icons/react';
|
import { ArrowUpRight, CaretRight } from '@phosphor-icons/react';
|
||||||
import { useId, useState } from "react";
|
import { useId, useState } from "react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||||
import { mediaUrl } from "../../lib/media.ts";
|
import { mediaUrl } from "../../lib/media.ts";
|
||||||
import Logo from "../../components/Logo.tsx";
|
import Logo from "../../components/Logo.tsx";
|
||||||
|
|
@ -12,6 +13,7 @@ import {
|
||||||
byName,
|
byName,
|
||||||
} from "../../lib/organizations.ts";
|
} from "../../lib/organizations.ts";
|
||||||
import { accentText } from '../../lib/color.ts'
|
import { accentText } from '../../lib/color.ts'
|
||||||
|
import { useReadingMode } from '../../lib/readingMode.ts'
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ORGANIZATION LIST: VERTICAL
|
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} />;
|
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 [open, setOpen] = useState(false);
|
||||||
const panelId = useId();
|
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 color = org.color || FALLBACK_COLOR;
|
||||||
const path = orgPath(org);
|
const path = orgPath(org);
|
||||||
|
|
@ -102,6 +107,14 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
||||||
return (
|
return (
|
||||||
<div className="py-3" style={{ borderTop: `1px solid ${RULE}` }}>
|
<div className="py-3" style={{ borderTop: `1px solid ${RULE}` }}>
|
||||||
<div className="flex flex-wrap items-center gap-3">
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
{/* 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
|
<button
|
||||||
onClick={() => setOpen(v => !v)}
|
onClick={() => setOpen(v => !v)}
|
||||||
aria-expanded={open}
|
aria-expanded={open}
|
||||||
|
|
@ -122,8 +135,8 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{org.website && (
|
{org.website && (
|
||||||
|
|
@ -140,7 +153,7 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
||||||
|
|
||||||
{/* Last in the row, so the arrow lines up down the right
|
{/* Last in the row, so the arrow lines up down the right
|
||||||
edge whether or not a row has an outbound site. */}
|
edge whether or not a row has an outbound site. */}
|
||||||
{path && (
|
{path && !reading && (
|
||||||
<ArrowLink
|
<ArrowLink
|
||||||
to={path}
|
to={path}
|
||||||
label={`${org.name}: ${pageLabel}`}
|
label={`${org.name}: ${pageLabel}`}
|
||||||
|
|
@ -219,7 +232,7 @@ function Block({ title, orgs, pageLabel, siteLabel }) {
|
||||||
</h3>
|
</h3>
|
||||||
)}
|
)}
|
||||||
{orgs.map(org => (
|
{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>
|
</section>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { MONTH_LABELS, type PersonRef, type TimelineItem } from '../../../lib/ti
|
||||||
import { hrefFor, logoSrc } from '../../../lib/timelineRefs.ts'
|
import { hrefFor, logoSrc } from '../../../lib/timelineRefs.ts'
|
||||||
import { initials, mediaUrl } from '../../../lib/media.ts'
|
import { initials, mediaUrl } from '../../../lib/media.ts'
|
||||||
import { useSmallImage } from '../../../lib/useSmallImage.ts'
|
import { useSmallImage } from '../../../lib/useSmallImage.ts'
|
||||||
|
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||||
|
|
||||||
const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
||||||
milestone: 'Milestone',
|
milestone: 'Milestone',
|
||||||
|
|
@ -57,6 +58,7 @@ type Props = {
|
||||||
|
|
||||||
export default function TimelineEntry({ item, variant = 'inline' }: Props) {
|
export default function TimelineEntry({ item, variant = 'inline' }: Props) {
|
||||||
const featured = variant === 'featured'
|
const featured = variant === 'featured'
|
||||||
|
const reading = useReadingMode()
|
||||||
const href = hrefFor(item)
|
const href = hrefFor(item)
|
||||||
const logo = logoSrc(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.
|
// An explicit href may point off-site; Link is for in-app routes only.
|
||||||
const external = !!href && /^(https?:)?\/\//.test(href)
|
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 (
|
return (
|
||||||
<li className="site-tl__entryWrap">
|
<li className="site-tl__entryWrap">
|
||||||
{href && external ? (
|
{href && external ? (
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import { CaretDown, CaretUp } from '@phosphor-icons/react'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import type { GroupedYear, SortDirection } from '../../../lib/timeline.ts'
|
import type { GroupedYear, SortDirection } from '../../../lib/timeline.ts'
|
||||||
import TimelineYear from './TimelineYear.tsx'
|
import TimelineYear from './TimelineYear.tsx'
|
||||||
|
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
years: GroupedYear[]
|
years: GroupedYear[]
|
||||||
|
|
@ -28,7 +29,11 @@ export default function TimelineUpcoming({
|
||||||
openYears,
|
openYears,
|
||||||
onToggleYear,
|
onToggleYear,
|
||||||
}: Props) {
|
}: 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
|
if (count === 0) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -36,6 +41,7 @@ export default function TimelineUpcoming({
|
||||||
className={`site-tl__upcoming${open ? ' site-tl__upcoming--open' : ''}`}
|
className={`site-tl__upcoming${open ? ' site-tl__upcoming--open' : ''}`}
|
||||||
aria-label="Upcoming"
|
aria-label="Upcoming"
|
||||||
>
|
>
|
||||||
|
{reading ? <h3>Still to come</h3> : (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="site-tl__upcomingBtn"
|
className="site-tl__upcomingBtn"
|
||||||
|
|
@ -52,6 +58,7 @@ export default function TimelineUpcoming({
|
||||||
{open ? <CaretDown weight="bold" /> : <CaretUp weight="bold" />}
|
{open ? <CaretDown weight="bold" /> : <CaretUp weight="bold" />}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
{open ? (
|
{open ? (
|
||||||
<div className="site-tl__upcomingList">
|
<div className="site-tl__upcomingList">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type { CSSProperties } from 'react'
|
import type { CSSProperties } from 'react'
|
||||||
import type { GroupedYear } from '../../../lib/timeline.ts'
|
import type { GroupedYear } from '../../../lib/timeline.ts'
|
||||||
import TimelineEntry from './TimelineEntry.tsx'
|
import TimelineEntry from './TimelineEntry.tsx'
|
||||||
|
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||||
|
|
||||||
/** A solid teal dot per year, its size growing with the year's
|
/** 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
|
* entries so the rail reads as a density chart. (A vine or tree
|
||||||
|
|
@ -15,8 +16,13 @@ type Props = {
|
||||||
onToggle: (year: number) => void
|
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 empty = year.count === 0
|
||||||
|
const MonthLabel = reading ? 'h5' : 'h4'
|
||||||
const panelId = `site-tl-year-${year.year}`
|
const panelId = `site-tl-year-${year.year}`
|
||||||
|
|
||||||
const className = [
|
const className = [
|
||||||
|
|
@ -28,8 +34,13 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(' ')
|
.join(' ')
|
||||||
|
|
||||||
|
if (reading && empty) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
|
{reading ? (
|
||||||
|
<h4>{year.year}</h4>
|
||||||
|
) : (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="site-tl__yearBtn"
|
className="site-tl__yearBtn"
|
||||||
|
|
@ -47,6 +58,7 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
||||||
{empty ? '-' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
{empty ? '-' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
{open ? (
|
{open ? (
|
||||||
empty ? (
|
empty ? (
|
||||||
|
|
@ -65,7 +77,7 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
||||||
|
|
||||||
{year.months.map((month) => (
|
{year.months.map((month) => (
|
||||||
<section className="site-tl__month" key={month.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">
|
<ul className="site-tl__list">
|
||||||
{month.items.map((item) => (
|
{month.items.map((item) => (
|
||||||
<TimelineEntry key={item.id} item={item} />
|
<TimelineEntry key={item.id} item={item} />
|
||||||
|
|
@ -76,7 +88,7 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
||||||
|
|
||||||
{year.undated.length > 0 ? (
|
{year.undated.length > 0 ? (
|
||||||
<section className="site-tl__month site-tl__undated">
|
<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">
|
<ul className="site-tl__list">
|
||||||
{year.undated.map((item) => (
|
{year.undated.map((item) => (
|
||||||
<TimelineEntry key={item.id} item={item} />
|
<TimelineEntry key={item.id} item={item} />
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@
|
||||||
doesn't open it.
|
doesn't open it.
|
||||||
|
|
||||||
Nothing featured, and the section doesn't render at all.
|
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';
|
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 { MONTH_LABELS, type TimelineItem } from '../../../lib/timeline.ts'
|
||||||
import { accentText, BRAND } from '../../../lib/color.ts'
|
import { accentText, BRAND } from '../../../lib/color.ts'
|
||||||
import { scrollBehavior } from '../../../lib/motion.ts';
|
import { scrollBehavior } from '../../../lib/motion.ts';
|
||||||
|
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||||
|
|
||||||
const DRAG_SLOP = 6
|
const DRAG_SLOP = 6
|
||||||
|
|
||||||
|
|
@ -43,9 +47,29 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
||||||
const railRef = useRef<HTMLOListElement>(null)
|
const railRef = useRef<HTMLOListElement>(null)
|
||||||
const drag = useRef({ x: 0, left: 0, moved: false, active: false })
|
const drag = useRef({ x: 0, left: 0, moved: false, active: false })
|
||||||
const [dragging, setDragging] = useState(false)
|
const [dragging, setDragging] = useState(false)
|
||||||
|
const reading = useReadingMode()
|
||||||
|
|
||||||
if (!loading && !error && featured.length === 0) return null
|
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 step = (direction: number) => {
|
||||||
const rail = railRef.current
|
const rail = railRef.current
|
||||||
const card = rail?.querySelector('li')
|
const card = rail?.querySelector('li')
|
||||||
|
|
@ -182,6 +206,17 @@ function dateLabel(item: TimelineItem): string {
|
||||||
return y
|
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 }) {
|
function RailCard({ item, showYear }: { item: TimelineItem; showYear: boolean }) {
|
||||||
const href = hrefFor(item)
|
const href = hrefFor(item)
|
||||||
const logo = logoSrc(item)
|
const logo = logoSrc(item)
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@
|
||||||
`hero` is null while the page config loads or when it failed; the
|
`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
|
stage still draws, empty, so the page doesn't jump when it
|
||||||
arrives. The error itself is shown by Home, not here.
|
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'
|
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 { mediaUrl } from '../../../lib/media.ts'
|
||||||
import { prefersLessMotion } from '../../../lib/motion.ts'
|
import { prefersLessMotion } from '../../../lib/motion.ts'
|
||||||
import { focusOnMount } from '../../../lib/focus.ts'
|
import { focusOnMount } from '../../../lib/focus.ts'
|
||||||
|
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||||
import { eventHref } from '../../../lib/hrefs.ts'
|
import { eventHref } from '../../../lib/hrefs.ts'
|
||||||
import { seriesLabel } from '../../../lib/eventSeries.ts'
|
import { seriesLabel } from '../../../lib/eventSeries.ts'
|
||||||
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.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.
|
// Every feature shares a layout: words left, feature right.
|
||||||
const beside = feature !== 'none'
|
const beside = feature !== 'none'
|
||||||
|
|
||||||
|
if (useReadingMode()) {
|
||||||
|
return (
|
||||||
|
<section id="hero">
|
||||||
|
{hero && <ReadingHero hero={hero} feature={feature} slides={backdrop === 'photos' ? slides : []} video={video} />}
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
id="hero"
|
id="hero"
|
||||||
|
|
@ -134,12 +147,12 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
||||||
</p>
|
</p>
|
||||||
) : feature === 'event' ? (
|
) : feature === 'event' ? (
|
||||||
<p className="mb-6 inline-flex items-center gap-3 bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
|
<p className="mb-6 inline-flex items-center gap-3 bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
|
||||||
<Star className="text-[#f0bd4f]" weight="fill" aria-hidden="true" />
|
<Star className="text-[var(--pal-amber-2)]" weight="fill" aria-hidden="true" />
|
||||||
Featured event
|
Featured event
|
||||||
</p>
|
</p>
|
||||||
) : feature === 'video' ? (
|
) : feature === 'video' ? (
|
||||||
<p className="mb-6 inline-flex items-center gap-3 bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
|
<p className="mb-6 inline-flex items-center gap-3 bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
|
||||||
<Play className="text-[#f0bd4f]" weight="fill" aria-hidden="true" />
|
<Play className="text-[var(--pal-amber-2)]" weight="fill" aria-hidden="true" />
|
||||||
Featured video
|
Featured video
|
||||||
{hero.video?.title && (
|
{hero.video?.title && (
|
||||||
<span className="normal-case tracking-normal text-white/75">
|
<span className="normal-case tracking-normal text-white/75">
|
||||||
|
|
@ -149,7 +162,7 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
hero.eyebrow && (
|
hero.eyebrow && (
|
||||||
<p className="mb-6 inline-block border border-white/20 px-4 py-1.5 text-xs font-semibold uppercase tracking-[0.25em] text-[#f0bd4f]">
|
<p className="mb-6 inline-block border border-white/20 px-4 py-1.5 text-xs font-semibold uppercase tracking-[0.25em] text-[var(--pal-amber-2)]">
|
||||||
{hero.eyebrow}
|
{hero.eyebrow}
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
|
|
@ -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 ──────────────────────────────────────────
|
/* ── The hero's buttons ──────────────────────────────────────────
|
||||||
Both set: one cell in two halves, the primary filled on the left
|
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
|
and the secondary clear on the right, split by a slash (the
|
||||||
|
|
@ -194,7 +274,7 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
||||||
labels side by side don't fit; the slash starts at sm (home.css,
|
labels side by side don't fit; the slash starts at sm (home.css,
|
||||||
.hp-split). One set: that one alone, in its own style. */
|
.hp-split). One set: that one alone, in its own style. */
|
||||||
|
|
||||||
const PRIMARY_FILL = '#f0bd4f'
|
const PRIMARY_FILL = 'var(--pal-amber-2)'
|
||||||
const PRIMARY_TEXT = '#001011'
|
const PRIMARY_TEXT = '#001011'
|
||||||
const HALF = 'relative flex items-center justify-center gap-2 px-8 py-4 text-lg transition-colors duration-200 focus-visible:outline-offset-[-6px]'
|
const HALF = 'relative flex items-center justify-center gap-2 px-8 py-4 text-lg transition-colors duration-200 focus-visible:outline-offset-[-6px]'
|
||||||
|
|
||||||
|
|
@ -244,7 +324,7 @@ function HeroActions({ primary, secondary }: { primary: HeroLink; secondary: Her
|
||||||
|
|
||||||
/* ── Brand backdrop ──────────────────────────────────────────── */
|
/* ── Brand backdrop ──────────────────────────────────────────── */
|
||||||
|
|
||||||
const BRAND_FILL = '#003a45'
|
const BRAND_FILL = 'var(--pal-teal-1)'
|
||||||
|
|
||||||
function BrandBackdrop() {
|
function BrandBackdrop() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -489,7 +569,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
|
||||||
{event.title}
|
{event.title}
|
||||||
</Link>
|
</Link>
|
||||||
</h2>
|
</h2>
|
||||||
{event.theme && <p className="mt-1 text-lg font-semibold text-[#f0bd4f]">"{event.theme}"</p>}
|
{event.theme && <p className="mt-1 text-lg font-semibold text-[var(--pal-amber-2)]">"{event.theme}"</p>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(when || where) && (
|
{(when || where) && (
|
||||||
|
|
@ -505,7 +585,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
|
||||||
className={`inline-flex items-center gap-2 btn px-6 py-3 transition-transform hover:scale-105 ${
|
className={`inline-flex items-center gap-2 btn px-6 py-3 transition-transform hover:scale-105 ${
|
||||||
index === 0 ? 'text-[#001011]' : 'border border-white/35 text-white hover:bg-white/10'
|
index === 0 ? 'text-[#001011]' : 'border border-white/35 text-white hover:bg-white/10'
|
||||||
}`}
|
}`}
|
||||||
style={index === 0 ? { background: '#f0bd4f' } : undefined}
|
style={index === 0 ? { background: 'var(--pal-amber-2)' } : undefined}
|
||||||
>
|
>
|
||||||
<PlatformIcon platform={link.platform} />
|
<PlatformIcon platform={link.platform} />
|
||||||
{link.label}
|
{link.label}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import { eventHref } from '../../../lib/hrefs.ts'
|
||||||
import { upcomingOccurrences } from '../../../lib/eventSeries.ts'
|
import { upcomingOccurrences } from '../../../lib/eventSeries.ts'
|
||||||
import type { CountdownEvent } from '../../../lib/useFrontPage.ts'
|
import type { CountdownEvent } from '../../../lib/useFrontPage.ts'
|
||||||
import { withAlpha, accentText, BRAND } from '../../../lib/color.ts'
|
import { withAlpha, accentText, BRAND } from '../../../lib/color.ts'
|
||||||
|
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||||
|
|
||||||
|
|
||||||
/* Local midnight (or HH:MM) on a 'YYYY-MM-DD'. */
|
/* Local midnight (or HH:MM) on a 'YYYY-MM-DD'. */
|
||||||
|
|
@ -63,6 +64,7 @@ export default function NextEventCountdown({
|
||||||
event: CountdownEvent
|
event: CountdownEvent
|
||||||
overlap: boolean
|
overlap: boolean
|
||||||
}) {
|
}) {
|
||||||
|
const reading = useReadingMode()
|
||||||
const now = useNow(1000)
|
const now = useNow(1000)
|
||||||
const when = target(event)
|
const when = target(event)
|
||||||
const accent = event.color || BRAND
|
const accent = event.color || BRAND
|
||||||
|
|
@ -79,6 +81,9 @@ export default function NextEventCountdown({
|
||||||
|
|
||||||
const where = event.location_label || (event.is_online ? 'Online' : null)
|
const where = event.location_label || (event.is_online ? 'Online' : null)
|
||||||
|
|
||||||
|
// Reading mode: the event is already in the retreats band.
|
||||||
|
if (reading) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
aria-label="Next event"
|
aria-label="Next event"
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@
|
||||||
paths are a strip of cells along the top, the chosen one filled
|
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
|
flat in its accent; under it, the path's blurb and its actions
|
||||||
are cells of the same block.
|
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'
|
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 HomeLink, { isExternal } from './HomeLink.tsx'
|
||||||
import type { FrontPagePath } from '../../../lib/useFrontPage.ts'
|
import type { FrontPagePath } from '../../../lib/useFrontPage.ts'
|
||||||
import { ACCENTS, accentText, readableOn } from '../../../lib/color.ts'
|
import { ACCENTS, accentText, readableOn } from '../../../lib/color.ts'
|
||||||
|
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||||
|
|
||||||
type PathfinderProps = {
|
type PathfinderProps = {
|
||||||
id: string
|
id: string
|
||||||
|
|
@ -69,9 +73,33 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
||||||
const [selected, setSelected] = useState(0)
|
const [selected, setSelected] = useState(0)
|
||||||
const tabs = useRef<Array<HTMLButtonElement | null>>([])
|
const tabs = useRef<Array<HTMLButtonElement | null>>([])
|
||||||
const base = useId().replace(/:/g, '')
|
const base = useId().replace(/:/g, '')
|
||||||
|
const reading = useReadingMode()
|
||||||
|
|
||||||
if (paths.length === 0) return null
|
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 path = paths[Math.min(selected, paths.length - 1)]
|
||||||
const accent = PATH_ACCENTS[selected % PATH_ACCENTS.length]
|
const accent = PATH_ACCENTS[selected % PATH_ACCENTS.length]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,15 @@
|
||||||
band scrolls into view; a value that isn't a plain number
|
band scrolls into view; a value that isn't a plain number
|
||||||
("Since 2004", "Coast to coast") just appears.
|
("Since 2004", "Coast to coast") just appears.
|
||||||
|
|
||||||
Reduced motion skips the count and shows the number.
|
Reduced motion skips the count and shows the number. Reading mode
|
||||||
|
(readingMode.ts) gets one line per number: "1,200+ Members".
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
|
|
||||||
import type { FrontPageStat } from '../../../lib/useFrontPage.ts'
|
import type { FrontPageStat } from '../../../lib/useFrontPage.ts'
|
||||||
import { prefersLessMotion } from '../../../lib/motion.ts'
|
import { prefersLessMotion } from '../../../lib/motion.ts'
|
||||||
|
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||||
|
|
||||||
const COUNT_MS = 1400
|
const COUNT_MS = 1400
|
||||||
|
|
||||||
|
|
@ -25,7 +27,9 @@ type StatsBandProps = {
|
||||||
|
|
||||||
export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
||||||
const ref = useRef<HTMLElement>(null)
|
const ref = useRef<HTMLElement>(null)
|
||||||
const [seen, setSeen] = useState(false)
|
// Less motion: no wait for the band to scroll into view (reading
|
||||||
|
// mode's hidden page never does).
|
||||||
|
const [seen, setSeen] = useState(prefersLessMotion)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const el = ref.current
|
const el = ref.current
|
||||||
|
|
@ -43,12 +47,30 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
||||||
return () => observer.disconnect()
|
return () => observer.disconnect()
|
||||||
}, [seen])
|
}, [seen])
|
||||||
|
|
||||||
|
if (useReadingMode()) {
|
||||||
|
return (
|
||||||
|
<section id={id}>
|
||||||
|
<h2>{title}</h2>
|
||||||
|
{blurb && <p>{blurb}</p>}
|
||||||
|
<ul>
|
||||||
|
{stats.map((stat, index) => (
|
||||||
|
<li key={`${stat.label}-${index}`}>
|
||||||
|
{stat.value}
|
||||||
|
{stat.suffix} {stat.label}
|
||||||
|
{stat.note && `: ${stat.note}`}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
id={id}
|
id={id}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className="relative overflow-hidden py-24"
|
className="relative overflow-hidden py-24"
|
||||||
style={{ background: '#003a45' }}
|
style={{ background: 'var(--pal-teal-1)' }}
|
||||||
>
|
>
|
||||||
<div className="relative mx-auto max-w-6xl px-6">
|
<div className="relative mx-auto max-w-6xl px-6">
|
||||||
<h2 className="font-display text-3xl font-bold text-white md:text-4xl">
|
<h2 className="font-display text-3xl font-bold text-white md:text-4xl">
|
||||||
|
|
@ -65,7 +87,7 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
||||||
>
|
>
|
||||||
<dd className="font-display text-4xl font-extrabold leading-none text-white sm:text-5xl md:text-6xl">
|
<dd className="font-display text-4xl font-extrabold leading-none text-white sm:text-5xl md:text-6xl">
|
||||||
<CountUp value={stat.value} run={seen} />
|
<CountUp value={stat.value} run={seen} />
|
||||||
{stat.suffix && <span className="text-[#f0bd4f]">{stat.suffix}</span>}
|
{stat.suffix && <span className="text-[var(--pal-amber-2)]">{stat.suffix}</span>}
|
||||||
</dd>
|
</dd>
|
||||||
<dt className="mt-3 text-sm font-semibold uppercase tracking-widest text-white/70">
|
<dt className="mt-3 text-sm font-semibold uppercase tracking-widest text-white/70">
|
||||||
{stat.label}
|
{stat.label}
|
||||||
|
|
@ -107,7 +129,7 @@ function CountUp({ value, run }: { value: string; run: boolean }) {
|
||||||
|
|
||||||
if (!numeric) return <>{value}</>
|
if (!numeric) return <>{value}</>
|
||||||
|
|
||||||
const n = reduced || !run ? (run ? target : 0) : shown
|
const n = reduced ? target : run ? shown : 0
|
||||||
return (
|
return (
|
||||||
<span className="tabular-nums">
|
<span className="tabular-nums">
|
||||||
{n.toLocaleString(undefined, {
|
{n.toLocaleString(undefined, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue