Clean up code found in the audit
- Replace every em-dash in src and server/src with a colon, comma or hyphen - Give every relative import its file extension (.jsx imports of .tsx fixed) - Delete old-historyMock.ts, unused exports, unused CSS utilities, the unused @ alias and the fallback option nothing passed - One copy each of initials, capitalize, byName and the server's marks() - Move the organization, chapter and event hooks from src/data to src/lib - Schema sync always throws on a mismatch (strict was never turned off) - Replace the placeholder README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4066e9ec61
commit
5274e09571
75 changed files with 282 additions and 688 deletions
|
|
@ -12,7 +12,7 @@ export default function Banner() {
|
|||
try {
|
||||
if (!localStorage.getItem(storageKey)) setVisible(true);
|
||||
} catch {
|
||||
setVisible(true); // storage blocked — show it anyway
|
||||
setVisible(true); // storage blocked, show it anyway
|
||||
}
|
||||
}, [storageKey]);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
NGU's dove, lifted from the original home page. The path and its
|
||||
two transforms are the drawing as exported, untouched; only the
|
||||
wrapper changed — sized by the caller, coloured by currentColor,
|
||||
wrapper changed, sized by the caller, coloured by currentColor,
|
||||
and hidden from screen readers since it's decoration wherever
|
||||
it appears.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useState, useEffect, useRef } from "react";
|
||||
import { NavLink, Link, Outlet, useLocation } from "react-router-dom";
|
||||
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
|
||||
import Banner from "./Banner.jsx";
|
||||
import Banner from "./Banner.tsx";
|
||||
import nguLogo from "../assets/logos/NGU_Logo.svg";
|
||||
import Footer from "./Footer.tsx";
|
||||
|
||||
|
|
@ -147,10 +147,10 @@ export default function Layout() {
|
|||
className="fixed top-0 left-0 right-0 z-50 backdrop-blur-md"
|
||||
>
|
||||
|
||||
{/* Tier 0 — site-wide announcement */}
|
||||
{/* Tier 0, site-wide announcement */}
|
||||
<Banner />
|
||||
|
||||
{/* Tier 1 — site navigation */}
|
||||
{/* Tier 1, site navigation */}
|
||||
<nav
|
||||
className="flex items-center justify-between px-6 py-4"
|
||||
aria-label="Site"
|
||||
|
|
@ -201,7 +201,7 @@ export default function Layout() {
|
|||
</div>
|
||||
</nav>
|
||||
|
||||
{/* Tier 2 — sections of the current page */}
|
||||
{/* Tier 2, sections of the current page */}
|
||||
{sections.length > 0 && (
|
||||
<nav
|
||||
className="hidden md:flex items-center px-6 py-2"
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
sections with a thin accent banner between them, alternating
|
||||
backgrounds, and a left-aligned heading with a blurb and rule.
|
||||
|
||||
Whatever goes inside a section is passed as `content` — the shell
|
||||
Whatever goes inside a section is passed as `content`, the shell
|
||||
doesn't care what it is.
|
||||
|
||||
No <main> and no footer here — Layout provides both, so a page
|
||||
No <main> and no footer here, Layout provides both, so a page
|
||||
using this shell drops straight into the router's Outlet.
|
||||
|
||||
Usage:
|
||||
|
|
@ -58,7 +58,7 @@ export function Section({ section }: { section: ShellSection }) {
|
|||
blurb,
|
||||
accent,
|
||||
background,
|
||||
// Optional action bar for this section's heading row — a view
|
||||
// Optional action bar for this section's heading row, a view
|
||||
// toggle, a filter, a link. Whatever the section needs; the
|
||||
// shell just gives it a place to sit.
|
||||
actions,
|
||||
|
|
@ -71,7 +71,7 @@ export function Section({ section }: { section: ShellSection }) {
|
|||
className="py-20"
|
||||
style={{ background, scrollMarginTop: "5rem" }}
|
||||
>
|
||||
{/* Heading — left aligned, optional actions on the right */}
|
||||
{/* Heading, left aligned, optional actions on the right */}
|
||||
<div className="max-w-6xl mx-auto px-6 mb-10">
|
||||
<div className="flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
PAGE STATE
|
||||
|
||||
The three ways a detail page can fail to be a detail page. All
|
||||
four of them need the same thing, and it should be the same thing
|
||||
— a visitor who hits a dead retreat link and a dead chapter link
|
||||
four of them need the same thing, and it should be the same thing:
|
||||
a visitor who hits a dead retreat link and a dead chapter link
|
||||
shouldn't get two different pages.
|
||||
|
||||
Rendered inside PageShell so the chrome doesn't flicker in and
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* PeopleTiles — polaroid-style people list.
|
||||
/* PeopleTiles, polaroid-style people list.
|
||||
Everything is scoped under .pl and driven by custom properties, so a section
|
||||
can retune it inline: <PeopleTiles style={{ "--pl-base-w": "150px" }} /> */
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ import { Link } from "react-router-dom";
|
|||
|
||||
import { get } from "../lib/api.ts";
|
||||
import { isBadId, personHref } from "../lib/hrefs.ts";
|
||||
import { personPhoto } from "../lib/media.ts";
|
||||
import { initials, personPhoto } from "../lib/media.ts";
|
||||
import "./PeopleTiles.css";
|
||||
|
||||
/**
|
||||
* PeopleTiles — a horizontal, polaroid-style people list.
|
||||
* PeopleTiles, a horizontal, polaroid-style people list.
|
||||
*
|
||||
* Supply data any of four ways:
|
||||
*
|
||||
|
|
@ -33,7 +33,7 @@ import "./PeopleTiles.css";
|
|||
* is_owner flag.
|
||||
*
|
||||
* With `peopleslug`, the person is fetched by id and any other key
|
||||
* on the entry overrides what came back — so a title can be given
|
||||
* on the entry overrides what came back, so a title can be given
|
||||
* per placement, and is blank when it isn't. A slug entry can sit
|
||||
* beside a fully-written person in the same array.
|
||||
*
|
||||
|
|
@ -42,7 +42,7 @@ import "./PeopleTiles.css";
|
|||
* md photo + name + title
|
||||
* lg photo + name + title, and a chevron on anyone who has
|
||||
* something to expand: pronouns, home organization, location,
|
||||
* public email or a bio. Not bio alone — the details panel is
|
||||
* public email or a bio. Not bio alone, the details panel is
|
||||
* worth opening before anyone has written prose.
|
||||
*
|
||||
* Field names follow the API (is_owner, location_label), so a row
|
||||
|
|
@ -51,8 +51,8 @@ import "./PeopleTiles.css";
|
|||
* Profiles
|
||||
* A person with a string id is taken to be a people row and links
|
||||
* to /people/:id. A tile with nothing to expand is that link; an
|
||||
* expandable one stays the button that opens its panel — a link
|
||||
* can't sit inside a button — and the panel carries the link
|
||||
* expandable one stays the button that opens its panel, a link
|
||||
* can't sit inside a button, and the panel carries the link
|
||||
* instead. A hand-written entry with no id links nowhere.
|
||||
*/
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ const SIZE_FEATURES: Record<PeopleTilesSize, { title: boolean; details: boolean
|
|||
|
||||
/* ── Data ──────────────────────────────────────────────────────
|
||||
Fetching lives here rather than in every section, but the view
|
||||
below stays pure — it only ever sees resolved groups, whatever
|
||||
below stays pure, it only ever sees resolved groups, whatever
|
||||
produced them.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ function collectSlugs(
|
|||
}
|
||||
|
||||
/* The fetched record is the base; anything else on the entry wins,
|
||||
including an explicit null — that's how a title is deliberately
|
||||
including an explicit null, that's how a title is deliberately
|
||||
left blank rather than inherited. */
|
||||
function resolveAll(
|
||||
list: PersonInput[],
|
||||
|
|
@ -741,7 +741,7 @@ function findByKey(groups: PeopleGroup[], key: string | null) {
|
|||
}
|
||||
|
||||
/* The seat they hold here, or what they're called when there is no
|
||||
seat — the same fallback content.js applies to leadership rows. */
|
||||
seat, the same fallback content.js applies to leadership rows. */
|
||||
function titleOf(person: Person): string | null {
|
||||
return person.title || person.tagline || null;
|
||||
}
|
||||
|
|
@ -762,15 +762,6 @@ function hasDetails(person: Person): boolean {
|
|||
}
|
||||
|
||||
|
||||
function initials(name = ""): string {
|
||||
return name
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.slice(0, 2)
|
||||
.map((word) => word[0] || "")
|
||||
.join("")
|
||||
.toUpperCase();
|
||||
}
|
||||
|
||||
function resolveOrg(org: Person["org"]) {
|
||||
if (!org) return null;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Site-wide announcement banner. Set `enabled: false` to hide it entirely.
|
||||
// Bump `id` whenever the message changes — that re-shows the banner to
|
||||
// Bump `id` whenever the message changes, that re-shows the banner to
|
||||
// people who dismissed the previous one.
|
||||
|
||||
export const SITE_BANNER = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Used by the public form (to render the tiles) and the admin
|
||||
triage view (to label them). The ids must match TYPES in
|
||||
server/src/routes/feedback.js — that list stays separate because
|
||||
server/src/routes/feedback.js, that list stays separate because
|
||||
the server isn't in this workspace, and it's the thing that
|
||||
decides what's storable.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Decade headers for the history page.
|
||||
*
|
||||
* Not in the database on purpose. There are four of them, they change
|
||||
* about never, and they're editorial voice rather than record — the same
|
||||
* about never, and they're editorial voice rather than record, the same
|
||||
* reasoning that keeps the map grid config in code. A table for four
|
||||
* rows that nobody edits is a migration and an admin page for nothing.
|
||||
*
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
* date is ever revised.
|
||||
*/
|
||||
|
||||
import type { DecadeMeta } from '../lib/timeline'
|
||||
import type { DecadeMeta } from '../lib/timeline.ts'
|
||||
|
||||
export const HISTORY_DECADES: DecadeMeta[] = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Pure layout. Where each tile sits, what it's called, and how to
|
||||
work out which tile a chapter belongs to. None of this is in the
|
||||
database because none of it changes — Rhode Island will not be
|
||||
database because none of it changes, Rhode Island will not be
|
||||
moving, and no admin form should offer to move it.
|
||||
|
||||
What IS in the database is which regions cover which areas, and
|
||||
|
|
@ -13,8 +13,6 @@
|
|||
as regions with no tile.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export const GRID_COLS = 13;
|
||||
export const GRID_ROWS = 7;
|
||||
|
||||
/* ── States ────────────────────────────────────────────────────
|
||||
[column, row], both 1-based. A tile grid rather than true
|
||||
|
|
@ -86,8 +84,8 @@ export const AREAS = Object.freeze([
|
|||
export const AREA_BY_CODE = Object.fromEntries(AREAS.map((a) => [a.code, a]));
|
||||
|
||||
/* ── Which tile a chapter sits on ──────────────────────────────
|
||||
The database stores a real address — state_code for US, and a
|
||||
country code otherwise — rather than a tile name. This is the
|
||||
The database stores a real address, state_code for US, and a
|
||||
country code otherwise, rather than a tile name. This is the
|
||||
one place that translates between the two, so adding a Mexico
|
||||
band later means a line here and nothing in SQL.
|
||||
|
||||
|
|
@ -115,7 +113,7 @@ export function areaForChapter(chapter) {
|
|||
A region with share 1 and no edge fills the tile. A shared
|
||||
tile has one row per region, each declaring its own slice, so
|
||||
California is two entries of 0.5 rather than a primary plus a
|
||||
remainder — no arithmetic, and the renderer doesn't need to
|
||||
remainder, no arithmetic, and the renderer doesn't need to
|
||||
know which region "really" owns it.
|
||||
|
||||
regionAreas [{ region_id, area_code, share, edge, note }]
|
||||
|
|
@ -165,10 +163,3 @@ export function countChaptersByArea(chapters: any[] = []) {
|
|||
from the row rather than being looked up in a splits table and
|
||||
branched on whether this region is the primary.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
export function areasLabel(regionId, regionAreas: any[] = []) {
|
||||
return regionAreas
|
||||
.filter((row) => row.region_id === regionId && row.area_code !== "CANADA")
|
||||
.map((row) => (row.note ? `${row.area_code} (${row.note})` : row.area_code))
|
||||
.sort()
|
||||
.join(", ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,299 +0,0 @@
|
|||
/**
|
||||
* PLACEHOLDER DATA — delete this file once `GET /api/history` lands.
|
||||
*
|
||||
* Shaped exactly like the aggregation route's payload, so swapping it out
|
||||
* is a two-line change in History.tsx.
|
||||
*
|
||||
* Note what is and isn't here. Entries that point at a record carry a
|
||||
* `ref` and little else: no venue, no host name, no copy that also lives
|
||||
* in `events`. The few that do carry a title are overriding it on
|
||||
* purpose. Titles and blurbs below are invented scaffolding, not real NGU
|
||||
* history — replace them before anyone sees this.
|
||||
*
|
||||
* Decade headers are not here — they live in historyDecades.ts and stay
|
||||
* in code even after the API lands.
|
||||
*
|
||||
* Upcoming items are not flagged. `partitionByDate` decides what's
|
||||
* upcoming by comparing dates to the wall clock, so nothing here needs
|
||||
* editing as dates pass.
|
||||
*/
|
||||
|
||||
import type { TimelineItem } from '../lib/timeline'
|
||||
|
||||
export const MOCK_ITEMS: TimelineItem[] = [
|
||||
// ——— Upcoming (relative to the wall clock, not a flag) ———
|
||||
{
|
||||
id: 'tl-0001',
|
||||
date: '2027-06',
|
||||
precision: 'month',
|
||||
kind: 'event',
|
||||
title: 'Summer Conference 2027',
|
||||
meta: 'Unity Village, MO',
|
||||
ref: { kind: 'event', id: 'summer-2027' },
|
||||
logo: { file: 'summer-conference.svg', kind: 'event' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0002',
|
||||
date: '2026-11-14',
|
||||
precision: 'day',
|
||||
kind: 'event',
|
||||
title: 'Fall Regional Rally',
|
||||
meta: 'Southeast',
|
||||
ref: { kind: 'event', id: 'fall-rally-2026' },
|
||||
logo: { file: 'regional-rally.svg', kind: 'event' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0003',
|
||||
date: '2026-10-03',
|
||||
precision: 'day',
|
||||
kind: 'event',
|
||||
title: 'Chapter Leads Intensive',
|
||||
meta: 'Online',
|
||||
ref: { kind: 'event', id: 'leads-intensive-2026' },
|
||||
},
|
||||
|
||||
// ——— 2020s ———
|
||||
{
|
||||
id: 'tl-0010',
|
||||
date: '2026-03',
|
||||
precision: 'month',
|
||||
kind: 'organization',
|
||||
title: 'Twentieth chapter chartered',
|
||||
blurb:
|
||||
'The first new charter in the region since 2017, started by three people who met at a rally two summers earlier.',
|
||||
featured: true,
|
||||
ref: { kind: 'organization', id: 'boise', orgKind: 'chapter' },
|
||||
logo: { file: 'boise.svg', kind: 'organization' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0011',
|
||||
date: '2026-04-17',
|
||||
precision: 'day',
|
||||
kind: 'event',
|
||||
title: 'Spring Regional Rally',
|
||||
ref: { kind: 'event', id: 'spring-rally-2026' },
|
||||
logo: { file: 'regional-rally.svg', kind: 'event' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0012',
|
||||
date: '2026-01',
|
||||
precision: 'month',
|
||||
kind: 'people',
|
||||
title: 'New leadership team seated',
|
||||
blurb: 'A four-person exec on a two-year term, the first under the 2024 bylaws.',
|
||||
ref: { kind: 'team', id: 'ngu-leadership' },
|
||||
team: { id: 'ngu-leadership', name: 'Leadership Team', orgId: 'ngu', orgName: 'NGU National' },
|
||||
people: [
|
||||
{ id: 'jane-doe', name: 'Jane Doe', title: 'Chair', photo: 'jane-doe.jpg' },
|
||||
{ id: 'sam-ruiz', name: 'Sam Ruiz', title: 'Vice Chair', photo: 'sam-ruiz.jpg' },
|
||||
{ id: 'ada-mensah', name: 'Ada Mensah', title: 'Secretary' },
|
||||
{ id: 'tom-baird', name: 'Tom Baird', title: 'Treasurer', photo: 'tom-baird.jpg' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'tl-0013',
|
||||
date: '2025-12-28',
|
||||
precision: 'day',
|
||||
kind: 'event',
|
||||
title: 'Winter Gathering',
|
||||
ref: { kind: 'event', id: 'winter-gathering-2025' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0014',
|
||||
date: '2025-07-19',
|
||||
precision: 'day',
|
||||
kind: 'award',
|
||||
title: 'Service Award',
|
||||
meta: 'Presented to the Southeast chapter leads',
|
||||
ref: { kind: 'award', id: 'service' },
|
||||
logo: { file: 'service-award.svg', kind: 'award' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0015',
|
||||
date: '2025-07-17',
|
||||
precision: 'day',
|
||||
kind: 'event',
|
||||
title: 'Summer Conference',
|
||||
meta: 'Three days, 140 attendees',
|
||||
ref: { kind: 'event', id: 'summer-2025' },
|
||||
logo: { file: 'summer-conference.svg', kind: 'event' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0016',
|
||||
date: '2025',
|
||||
precision: 'year',
|
||||
kind: 'milestone',
|
||||
title: 'Photo archive digitized',
|
||||
blurb: 'Roughly 4,000 images from 2003 onward, scanned by volunteers.',
|
||||
href: 'https://archive.nextgenerationofunity.org',
|
||||
},
|
||||
{
|
||||
id: 'tl-0017',
|
||||
date: '2024-09',
|
||||
precision: 'month',
|
||||
kind: 'milestone',
|
||||
title: 'Bylaws rewritten',
|
||||
blurb:
|
||||
'Term limits, a defined handoff window, and the first written process for chartering a chapter.',
|
||||
featured: true,
|
||||
},
|
||||
{
|
||||
id: 'tl-0018',
|
||||
date: '2024-07-11',
|
||||
precision: 'day',
|
||||
kind: 'event',
|
||||
title: 'Summer Conference',
|
||||
ref: { kind: 'event', id: 'summer-2024' },
|
||||
logo: { file: 'summer-conference.svg', kind: 'event' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0019',
|
||||
date: '2024-07-13',
|
||||
precision: 'day',
|
||||
kind: 'award',
|
||||
title: 'Emerging Leader Award',
|
||||
meta: 'First year the award was given',
|
||||
ref: { kind: 'award', id: 'emerging-leader' },
|
||||
logo: { file: 'emerging-leader.svg', kind: 'award' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0020',
|
||||
date: '2022-06',
|
||||
precision: 'month',
|
||||
kind: 'event',
|
||||
title: 'First in-person rally since 2019',
|
||||
blurb: 'Sixty-one people, most of whom had only ever met on a video call.',
|
||||
featured: true,
|
||||
ref: { kind: 'event', id: 'return-rally-2022' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0021',
|
||||
date: '2021-08',
|
||||
precision: 'month',
|
||||
kind: 'event',
|
||||
title: 'Online Summer Intensive',
|
||||
meta: 'Six sessions across two weeks',
|
||||
ref: { kind: 'event', id: 'online-intensive-2021' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0022',
|
||||
date: '2020-03',
|
||||
precision: 'month',
|
||||
kind: 'milestone',
|
||||
title: 'All gatherings suspended',
|
||||
blurb: 'Weekly online rooms started the following week and ran for 118 weeks.',
|
||||
},
|
||||
|
||||
// ——— 2010s ———
|
||||
{
|
||||
id: 'tl-0030',
|
||||
date: '2018-05',
|
||||
precision: 'month',
|
||||
kind: 'organization',
|
||||
title: 'Eighth region recognized',
|
||||
featured: true,
|
||||
ref: { kind: 'organization', id: 'northwest', orgKind: 'region' },
|
||||
logo: { file: 'northwest.svg', kind: 'organization' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0031',
|
||||
date: '2018-07-20',
|
||||
precision: 'day',
|
||||
kind: 'event',
|
||||
title: 'Summer Conference',
|
||||
ref: { kind: 'event', id: 'summer-2018' },
|
||||
logo: { file: 'summer-conference.svg', kind: 'event' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0032',
|
||||
date: '2016-02',
|
||||
precision: 'month',
|
||||
kind: 'people',
|
||||
title: 'Retreat Team formed',
|
||||
blurb:
|
||||
'Programming had been whoever volunteered. This made it a standing team with a handoff.',
|
||||
ref: { kind: 'team', id: 'ngu-retreat-team' },
|
||||
team: { id: 'ngu-retreat-team', name: 'Retreat Team', orgId: 'ngu', orgName: 'NGU National' },
|
||||
people: [
|
||||
{ id: 'marcus-hale', name: 'Marcus Hale', title: 'Founding lead', photo: 'marcus-hale.jpg' },
|
||||
{ id: 'priya-nair', name: 'Priya Nair', photo: 'priya-nair.jpg' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'tl-0033',
|
||||
date: '2015-07',
|
||||
precision: 'month',
|
||||
kind: 'award',
|
||||
title: 'First Service Award presented',
|
||||
blurb: 'Created to name the work that had been going unnamed for a decade.',
|
||||
featured: true,
|
||||
ref: { kind: 'award', id: 'service' },
|
||||
logo: { file: 'service-award.svg', kind: 'award' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0034',
|
||||
date: '2015-02',
|
||||
precision: 'month',
|
||||
kind: 'milestone',
|
||||
title: 'Shared calendar goes live',
|
||||
blurb: 'Regions stop scheduling on top of each other.',
|
||||
},
|
||||
{
|
||||
id: 'tl-0035',
|
||||
date: '2012-06',
|
||||
precision: 'month',
|
||||
kind: 'event',
|
||||
title: 'Summer Conference',
|
||||
meta: 'The year attendance first passed 100',
|
||||
ref: { kind: 'event', id: 'summer-2012' },
|
||||
logo: { file: 'summer-conference.svg', kind: 'event' },
|
||||
},
|
||||
{
|
||||
id: 'tl-0036',
|
||||
date: '2012',
|
||||
precision: 'year',
|
||||
kind: 'milestone',
|
||||
title: 'Adopted the name Next Generation of Unity',
|
||||
},
|
||||
|
||||
// ——— 2000s ———
|
||||
{
|
||||
id: 'tl-0040',
|
||||
date: '2009',
|
||||
precision: 'year',
|
||||
kind: 'milestone',
|
||||
title: 'Four regions drawn on a map for the first time',
|
||||
},
|
||||
{
|
||||
id: 'tl-0041',
|
||||
date: '2005-08',
|
||||
precision: 'month',
|
||||
kind: 'milestone',
|
||||
title: 'The gathering becomes annual',
|
||||
blurb: 'Before this it happened when someone had the energy to organize it.',
|
||||
featured: true,
|
||||
},
|
||||
{
|
||||
id: 'tl-0042',
|
||||
date: '2002-08',
|
||||
precision: 'month',
|
||||
kind: 'event',
|
||||
title: 'First young adult retreat',
|
||||
meta: 'Nineteen attendees',
|
||||
blurb:
|
||||
'Organized over six weeks at a borrowed retreat center. Everything else on this page follows from it.',
|
||||
featured: true,
|
||||
ref: { kind: 'event', id: 'first-retreat-2002' },
|
||||
},
|
||||
|
||||
// ——— Pre-program ———
|
||||
{
|
||||
id: 'tl-0050',
|
||||
date: '1997',
|
||||
precision: 'year',
|
||||
kind: 'milestone',
|
||||
title: 'Regional youth programs running independently',
|
||||
blurb:
|
||||
'Not NGU, and not connected to each other — but the people who started NGU came out of these.',
|
||||
},
|
||||
]
|
||||
|
|
@ -30,38 +30,11 @@ h1, h2, h3, h4, h5, h6 {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Gradient utilities */
|
||||
.grad-brand {
|
||||
background: linear-gradient(135deg, #073d4a 0%, #138ba0 45%, #10d48a 100%);
|
||||
}
|
||||
|
||||
.grad-brand-light {
|
||||
background: linear-gradient(135deg, #0a5260 0%, #17aac4 50%, #00e676 100%);
|
||||
}
|
||||
|
||||
.grad-dark {
|
||||
background: linear-gradient(135deg, #042f3a 0%, #073d4a 60%, #0a5260 100%);
|
||||
}
|
||||
|
||||
.grad-hero-text {
|
||||
background: linear-gradient(90deg, #88b668 0%, #008fa8 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
/* Scrollbar hide */
|
||||
::-webkit-scrollbar { width: 6px; }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
::-webkit-scrollbar-thumb { background: rgba(19, 139, 160, 0.4); border-radius: 3px; }
|
||||
|
||||
/* Float animation */
|
||||
@keyframes float {
|
||||
0%, 100% { transform: translateY(0px); }
|
||||
50% { transform: translateY(-12px); }
|
||||
}
|
||||
|
||||
.float-anim { display: inline-block; animation: float 4s ease-in-out infinite; will-change: transform;}
|
||||
|
||||
|
||||
.ig-icon { fill: currentColor; transition: fill 200ms ease; }
|
||||
|
|
|
|||
|
|
@ -2,21 +2,14 @@
|
|||
API CLIENT
|
||||
|
||||
One place that knows how to talk to the server, so components
|
||||
never call fetch directly and swapping the transport later is a
|
||||
single-file change.
|
||||
|
||||
Two things worth knowing about the design:
|
||||
never call fetch directly.
|
||||
|
||||
The cache is a module-level Map of in-flight and settled
|
||||
promises. Two components asking for /events during the same
|
||||
render pass share one request, and a remount inside the TTL
|
||||
costs nothing. It resets on page load, which is the right
|
||||
lifetime for content that changes weekly.
|
||||
|
||||
Every reader can pass a `fallback`. If the request fails, that
|
||||
value is used instead. This is what keeps the Figma preview
|
||||
working: pass the old static module as the fallback and the
|
||||
preview renders real content with no server in sight.
|
||||
lifetime for content that changes weekly. A failure isn't
|
||||
cached, and surfaces as an error rather than empty data.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
const BASE = import.meta.env?.VITE_API_BASE ?? "/api";
|
||||
|
|
@ -68,20 +61,15 @@ async function request(path, options: RequestInit = {}) {
|
|||
/* ── Reads ─────────────────────────────────────────────────────
|
||||
get("/events") → cached for 60s
|
||||
get("/events", { ttl: 0 }) → always fresh
|
||||
get("/events", { fallback }) → fallback on any failure
|
||||
───────────────────────────────────────────────────────────── */
|
||||
|
||||
export function get(path, { ttl = DEFAULT_TTL, fallback }: { ttl?: number; fallback?: any } = {}) {
|
||||
export function get(path, { ttl = DEFAULT_TTL }: { ttl?: number } = {}) {
|
||||
const hit = cache.get(path);
|
||||
|
||||
if (hit && Date.now() - hit.at < ttl) return hit.promise;
|
||||
|
||||
const promise = request(path).catch((err) => {
|
||||
cache.delete(path); // a failure shouldn't be cached
|
||||
if (fallback !== undefined) {
|
||||
console.warn(`api: ${path} failed, using fallback`, err);
|
||||
return fallback;
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
RequireAuth guards routes. Worth being clear about what that
|
||||
does and doesn't do: it hides the interface, not the data. The
|
||||
protection is the 401 from /api/admin — this only stops someone
|
||||
protection is the 401 from /api/admin, this only stops someone
|
||||
staring at an empty table.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ export function useAuth() {
|
|||
return value;
|
||||
}
|
||||
|
||||
/* Signals a session that ended while the page was open — the
|
||||
/* Signals a session that ended while the page was open, the
|
||||
admin pages call this when a request comes back 401. */
|
||||
export function isUnauthorized(error) {
|
||||
return error instanceof ApiError && error.status === 401;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
The chapter map's view of the organization list. Regions and
|
||||
chapters are the same table and the same endpoint; this hook
|
||||
reshapes them into what a map needs — slices per tile, counts
|
||||
reshapes them into what a map needs, slices per tile, counts
|
||||
per tile, chapters grouped by region.
|
||||
|
||||
Its return shape is unchanged from the version that called
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
the tile grid src/data/mapGrid.ts. Where a state sits never
|
||||
changes, so it isn't worth a round trip.
|
||||
|
||||
the fetch src/data/organizations.ts. One endpoint for
|
||||
the fetch src/lib/organizations.ts. One endpoint for
|
||||
every kind, so a section listing regions and
|
||||
a section listing partners read alike.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
|
@ -23,18 +23,14 @@ import { useMemo } from "react";
|
|||
|
||||
import {
|
||||
areasSentence,
|
||||
initialsFor,
|
||||
byName,
|
||||
useOrganizations,
|
||||
} from "./organizations.ts";
|
||||
import {
|
||||
areaForChapter,
|
||||
buildAreaSlices,
|
||||
countChaptersByArea,
|
||||
} from "./mapGrid.ts";
|
||||
|
||||
const byName = (a, b) => a.name.localeCompare(b.name);
|
||||
|
||||
export { initialsFor };
|
||||
} from "../data/mapGrid.ts";
|
||||
|
||||
export function useCommunity() {
|
||||
const regionsQuery = useOrganizations("region");
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
EVENT DATA
|
||||
|
||||
One request, filtered per band. The Retreats page has three
|
||||
bands of events, and all three call this hook — the cache in
|
||||
bands of events, and all three call this hook, the cache in
|
||||
api.ts keys on the path, so they share a single fetch and each
|
||||
narrows the result to what it shows.
|
||||
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { useResource } from "../lib/useResource.ts";
|
||||
import { useResource } from "./useResource.ts";
|
||||
|
||||
/* One shared empty list, so a memo keyed on `scopes` doesn't
|
||||
restart on every render before the data arrives. */
|
||||
|
|
@ -54,7 +54,7 @@ export function useEvents({ scope, host, status, type }: any = {}) {
|
|||
let list = all ?? [];
|
||||
if (scope) list = list.filter(e => e.scope_id === scope);
|
||||
// `host` is an organization or a person slug, and an event can
|
||||
// have several of either — co-hosting puts one event on both
|
||||
// have several of either, co-hosting puts one event on both
|
||||
// hosts' lists, which is the point.
|
||||
if (host) list = list.filter(e => e.hosts?.some(h => h.id === host));
|
||||
if (status) list = list.filter(e => e.status === status);
|
||||
|
|
@ -68,9 +68,9 @@ export function useEvents({ scope, host, status, type }: any = {}) {
|
|||
return { events, scopes, loading, error };
|
||||
}
|
||||
|
||||
/* Past and upcoming, split. `status` arrives already resolved — the
|
||||
explicit value when there is one, otherwise derived from ends_on
|
||||
— so nothing here needs to know which of the two it got. */
|
||||
/* Past and upcoming, split. `status` arrives already resolved, the
|
||||
explicit value when there is one, otherwise derived from ends_on,
|
||||
so nothing here needs to know which of the two it got. */
|
||||
export function splitByStatus(events: any[] = []) {
|
||||
const upcoming: any[] = [];
|
||||
const past: any[] = [];
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
Dates are 'YYYY-MM-DD' and are handled as UTC midnights so that
|
||||
stepping a day never lands on a DST gap. They are calendar dates,
|
||||
not instants — nothing here converts timezones.
|
||||
not instants, nothing here converts timezones.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export type SeriesFrequency = 'weekly' | 'monthly_date' | 'monthly_weekday'
|
||||
|
|
@ -76,7 +76,7 @@ const daysInMonth = (year: number, month: number) =>
|
|||
new Date(Date.UTC(year, month + 1, 0)).getUTCDate()
|
||||
|
||||
/* 1st–4th, or 5 for a date in the month's fifth week, which the
|
||||
schedule treats as "last" — every month has a last Tuesday, not
|
||||
schedule treats as "last", every month has a last Tuesday, not
|
||||
every month has a fifth. */
|
||||
const weekOfMonth = (date: Date) => Math.ceil(date.getUTCDate() / 7)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
means the site offers a filter the database will refuse to store.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { capitalize } from './text.ts'
|
||||
|
||||
export type EventType = 'retreat' | 'class' | 'workshop' | 'meeting' | 'other'
|
||||
|
||||
export const EVENT_TYPES: { id: EventType; label: string; plural: string }[] = [
|
||||
|
|
@ -29,14 +31,10 @@ export const EVENT_TYPES: { id: EventType; label: string; plural: string }[] = [
|
|||
{ id: 'other', label: 'Other', plural: 'Other' },
|
||||
]
|
||||
|
||||
export const EVENT_TYPE_IDS: EventType[] = EVENT_TYPES.map((entry) => entry.id)
|
||||
|
||||
const BY_ID = new Map<string, { label: string; plural: string }>(
|
||||
EVENT_TYPES.map((entry) => [entry.id as string, entry]),
|
||||
)
|
||||
|
||||
const capitalize = (word: string) =>
|
||||
word ? word.charAt(0).toUpperCase() + word.slice(1) : ''
|
||||
|
||||
/* A value the CHECK has gained since this file was written renders
|
||||
as itself rather than vanishing, the same rule EventDetail's
|
||||
|
|
@ -44,5 +42,3 @@ const capitalize = (word: string) =>
|
|||
export const eventTypeLabel = (id?: string | null): string =>
|
||||
(id ? BY_ID.get(id)?.label : null) ?? capitalize(id ?? '')
|
||||
|
||||
export const eventTypePlural = (id?: string | null): string =>
|
||||
(id ? BY_ID.get(id)?.plural : null) ?? capitalize(id ?? '')
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
PUBLIC HREFS
|
||||
|
||||
One place that turns a record into a URL. The API deliberately
|
||||
never sends paths — it sends `{ kind, id }` and, for an
|
||||
never sends paths, it sends `{ kind, id }` and, for an
|
||||
organization, the `org_kind` that decides which of the three
|
||||
routes a slug belongs to. Deciding that in each component is how
|
||||
/regions/x and /chapters/x end up both existing for the same
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
Every builder takes an id the caller believed it had. When it
|
||||
doesn't, the old behaviour was to interpolate the string
|
||||
"undefined" into a path, render a link to it, mount a page and
|
||||
fetch /api/organizations/undefined — four steps between the
|
||||
fetch /api/organizations/undefined, four steps between the
|
||||
mistake and any sign of it, none of which name the component
|
||||
that made it.
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ export type RefKind = 'event' | 'organization' | 'team' | 'award' | 'person'
|
|||
|
||||
/* A region, a chapter and a partner read as different things to a
|
||||
visitor even though they are one table, so they get one route
|
||||
each. 'national' is NGU itself — one record, no listing to sit
|
||||
each. 'national' is NGU itself, one record, no listing to sit
|
||||
under, so it falls through to the generic path. */
|
||||
const ORG_BASE: Record<string, string> = {
|
||||
region: '/regions',
|
||||
|
|
@ -49,7 +49,7 @@ const ORG_BASE: Record<string, string> = {
|
|||
* /events/:id, not /retreats/:id. The listing page is called
|
||||
* Retreats because that's what NGU calls the gatherings it hosts,
|
||||
* but the records are `events`, the API route is /api/events, and
|
||||
* plenty of them — partner events, conferences — aren't retreats
|
||||
* plenty of them, partner events, conferences, aren't retreats
|
||||
* at all. Naming the record route after one page's editorial
|
||||
* framing would have been wrong the first time a non-retreat got
|
||||
* its own page.
|
||||
|
|
@ -73,7 +73,7 @@ function checkId(id: unknown, what: string): string {
|
|||
|
||||
if (DEV) {
|
||||
// console.error rather than warn: this is always a bug, and the
|
||||
// stack is the whole point — it names the component that passed
|
||||
// stack is the whole point, it names the component that passed
|
||||
// nothing.
|
||||
console.error(
|
||||
`hrefs: ${what}() was given ${JSON.stringify(id)}. ` +
|
||||
|
|
@ -93,7 +93,7 @@ function checkId(id: unknown, what: string): string {
|
|||
* have to agree about what counts as an id.
|
||||
*
|
||||
* It lives here rather than next to the hook that calls it because
|
||||
* it is a path, and paths are this file's job — and because a
|
||||
* it is a path, and paths are this file's job, and because a
|
||||
* component that interpolates a missing route param produces the
|
||||
* literal string "undefined", which the server cannot tell apart
|
||||
* from a slug somebody genuinely typed. It answers 404 either way,
|
||||
|
|
@ -122,8 +122,8 @@ export function orgHref(id?: string | null, kind?: string | null): string {
|
|||
return `${ORG_BASE[kind ?? ''] ?? '/organizations'}/${checkId(id, 'orgHref')}`
|
||||
}
|
||||
|
||||
/* For anything holding a polymorphic reference — timeline entries,
|
||||
content blocks — where the kind arrives as data rather than being
|
||||
/* For anything holding a polymorphic reference, timeline entries,
|
||||
content blocks, where the kind arrives as data rather than being
|
||||
known at the call site.
|
||||
|
||||
Returns null for a kind with no page AND for a reference with no
|
||||
|
|
@ -153,12 +153,6 @@ export function refHref(
|
|||
}
|
||||
|
||||
/* What to call the kind in a breadcrumb or a back link. */
|
||||
export const ORG_KIND_LABEL: Record<string, string> = {
|
||||
national: 'Next Generation of Unity',
|
||||
region: 'Region',
|
||||
chapter: 'Chapter',
|
||||
partner: 'Partner organization',
|
||||
}
|
||||
|
||||
/* Where "back" goes from a record page. A chapter belongs to
|
||||
/community, a retreat to /retreats. */
|
||||
|
|
|
|||
|
|
@ -24,10 +24,6 @@
|
|||
|
||||
const ABSOLUTE = /^(https?:|\/|data:)/
|
||||
|
||||
/* An uploaded file ('/uploads/…'), a path anywhere on the site, or
|
||||
a full URL: something to use as it is rather than resolve. */
|
||||
export const isAbsoluteMedia = (file?: string | null) => Boolean(file && ABSOLUTE.test(file))
|
||||
|
||||
function inDir(dir: string) {
|
||||
return (file?: string | null): string | null => {
|
||||
if (!file) return null
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
const { organizations } = useOrganizations("partner");
|
||||
const { organizations } = useOrganizations(); // all
|
||||
|
||||
Every organization has the same card surface — name, colour,
|
||||
Every organization has the same card surface, name, colour,
|
||||
logo, description, links. What differs by kind sits under
|
||||
`details`, so a list component can render the common parts
|
||||
without knowing what it's holding:
|
||||
|
|
@ -23,9 +23,8 @@
|
|||
fetch.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useResource } from "../lib/useResource.ts";
|
||||
import { useResource } from "./useResource.ts";
|
||||
|
||||
const EMPTY = { organizations: [] };
|
||||
|
||||
export function useOrganizations(kind) {
|
||||
const path = kind
|
||||
|
|
@ -79,6 +78,8 @@ export function areasSentence(areas: any[] = []) {
|
|||
|
||||
/* Initials for a card with no logo. "NGU Lynnwood" → "NL", dropping
|
||||
the org prefix so every card doesn't read "NG". */
|
||||
export const byName = (a, b) => a.name.localeCompare(b.name);
|
||||
|
||||
export function initialsFor(name = "") {
|
||||
return name
|
||||
.replace(/^NGU\s+/i, "")
|
||||
|
|
@ -24,7 +24,7 @@ import { useState } from "react";
|
|||
}
|
||||
|
||||
Sections fetch their own data. The page never does, which is why
|
||||
there's no loading or error state here — each view handles its
|
||||
there's no loading or error state here, each view handles its
|
||||
own, and one section failing doesn't blank the page.
|
||||
|
||||
Every Component receives `accent` so its empty and error notices
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@ export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href
|
|||
const PAGES: Record<string, PageText> = { ...siteConfiguration.pages, ...fromServer.pages }
|
||||
|
||||
/** The static pages site.json knows, for the admin's page list. */
|
||||
export const SITE_PAGE_PATHS: string[] = Object.keys(siteConfiguration.pages)
|
||||
|
||||
/** A static page's title and intro, from site.json's "pages". */
|
||||
export function sitePage(path: string): PageText {
|
||||
const page = PAGES[path]
|
||||
|
|
|
|||
|
|
@ -21,3 +21,6 @@ export function preview(text: string | null | undefined, max: number): string {
|
|||
const clean = lastSpace > max / 2 ? cut.slice(0, lastSpace) : cut
|
||||
return `${clean.replace(/[\s.,;:!?]+$/, '')}…`
|
||||
}
|
||||
|
||||
export const capitalize = (word: string) =>
|
||||
word ? word.charAt(0).toUpperCase() + word.slice(1) : ''
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
* date are read back from `events` at query time. Editing the event
|
||||
* therefore edits the timeline, and there is no second copy to drift.
|
||||
*
|
||||
* Hand-authored entries — "bylaws rewritten", "the gathering becomes
|
||||
* annual" — carry no ref and supply their own title and blurb. An entry
|
||||
* Hand-authored entries, "bylaws rewritten", "the gathering becomes
|
||||
* annual", carry no ref and supply their own title and blurb. An entry
|
||||
* may also do both: reference an event but override its title, for when
|
||||
* the timeline wants to say something the event card doesn't.
|
||||
*
|
||||
* ── What the server resolves, and what it doesn't ──────────────────────
|
||||
* The server resolves *data*: title, date, logo filename, the members of
|
||||
* a referenced team. It does not resolve *routes* or *asset paths* —
|
||||
* a referenced team. It does not resolve *routes* or *asset paths*,
|
||||
* those are presentation, and live in `timelineRefs.ts` so React Router
|
||||
* and the public/ layout stay the frontend's business.
|
||||
*/
|
||||
|
|
@ -41,7 +41,7 @@ export type RefKind = 'event' | 'organization' | 'award' | 'person' | 'team'
|
|||
|
||||
export type TimelineRef = {
|
||||
kind: RefKind
|
||||
/** The row's TEXT primary key — an event id, org slug, team slug. */
|
||||
/** The row's TEXT primary key, an event id, org slug, team slug. */
|
||||
id: string
|
||||
/** Only on organizations: history.js copies v_timeline.org_kind. */
|
||||
orgKind?: OrgKind
|
||||
|
|
@ -59,7 +59,7 @@ export type TimelineLogo = {
|
|||
export type PersonRef = {
|
||||
id: string
|
||||
name: string
|
||||
/** people.photo — filename only. */
|
||||
/** people.photo, filename only. */
|
||||
photo?: string
|
||||
/** Their affiliation title at the time, if it's worth printing. */
|
||||
title?: string
|
||||
|
|
@ -78,7 +78,7 @@ export type TimelineItem = {
|
|||
id: string
|
||||
/** "2014" | "2014-06" | "2014-06-12" */
|
||||
date: string
|
||||
/** How much of `date` is trustworthy. Authoritative — a backfilled row
|
||||
/** How much of `date` is trustworthy. Authoritative, a backfilled row
|
||||
* may hold a full date while only the year is actually known. */
|
||||
precision: DatePrecision
|
||||
kind: TimelineKind
|
||||
|
|
@ -127,7 +127,7 @@ export type GroupedYear = {
|
|||
featured: boolean
|
||||
count: number
|
||||
featuredItems: TimelineItem[]
|
||||
/** Year-precision items — known to be this year, month unknown. */
|
||||
/** Year-precision items, known to be this year, month unknown. */
|
||||
undated: TimelineItem[]
|
||||
months: GroupedMonth[]
|
||||
}
|
||||
|
|
@ -238,7 +238,7 @@ export type GroupOptions = {
|
|||
programStartYear?: number
|
||||
/**
|
||||
* Repeat featured items inside their month node as well as in the
|
||||
* featured block. Off by default — in a sparse year it just prints the
|
||||
* featured block. Off by default, in a sparse year it just prints the
|
||||
* same line twice. A month left with nothing but featured items drops
|
||||
* out entirely.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
Turns a timeline item into a destination and an image. Both were
|
||||
answered locally here before, which is how the timeline came to
|
||||
link events at /event/:id while the router only knew about
|
||||
/retreats/:id — two files holding the same opinion, one of them
|
||||
/retreats/:id, two files holding the same opinion, one of them
|
||||
wrong, neither aware of the other.
|
||||
|
||||
Now this file knows about timeline items and nothing else. Where
|
||||
|
|
@ -13,9 +13,9 @@
|
|||
── The shape this reads, from history.js ──
|
||||
|
||||
item.href explicit link_url override, may be off-site
|
||||
item.ref { kind, id, orgKind? } — orgKind only on
|
||||
item.ref { kind, id, orgKind? }, orgKind only on
|
||||
organizations, because only they have it
|
||||
item.logo { file, kind } — v_timeline COALESCEs the
|
||||
item.logo { file, kind }, v_timeline COALESCEs the
|
||||
filename across five tables, so the kind is
|
||||
what says which directory it came from
|
||||
item.team { id, name, orgId? } on a team ref
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
Every one of those is optional. An entry is a standalone
|
||||
milestone until proven otherwise, and the two accessors below
|
||||
return null rather than assuming a shape that isn't there —
|
||||
return null rather than assuming a shape that isn't there,
|
||||
which is the other half of the /organizations/undefined bug:
|
||||
reaching into a ref that wasn't sent yields undefined, and
|
||||
undefined interpolates into a path perfectly happily.
|
||||
|
|
@ -44,7 +44,7 @@ import type { TimelineItem } from './timeline.ts'
|
|||
* Otherwise the reference decides, and refHref returns null for a
|
||||
* kind with no page yet ('person', until /people/:id exists) as
|
||||
* well as for a ref that didn't resolve. Null means the entry
|
||||
* renders as a plain <div> — right for a milestone, and right for
|
||||
* renders as a plain <div>, right for a milestone, and right for
|
||||
* a reference that's missing an id, which used to render as a link
|
||||
* to a 404.
|
||||
*/
|
||||
|
|
@ -67,7 +67,7 @@ export function logoSrc(item: TimelineItem): string | null {
|
|||
}
|
||||
|
||||
/**
|
||||
* A roster member's photo. Same rule as everywhere else — the API
|
||||
* A roster member's photo. Same rule as everywhere else, the API
|
||||
* sends a bare filename.
|
||||
*/
|
||||
export function photoSrc(photo?: string | null): string | null {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* The four detail endpoints, typed.
|
||||
*
|
||||
* Adding a fifth is a type and a one-line hook — useRecord owns
|
||||
* Adding a fifth is a type and a one-line hook, useRecord owns
|
||||
* the fetching, the caching and the 404.
|
||||
*
|
||||
* An id that is missing — or the literal string "undefined", which
|
||||
* is what a template literal makes of a missing route param — never
|
||||
* An id that is missing, or the literal string "undefined", which
|
||||
* is what a template literal makes of a missing route param, never
|
||||
* reaches the network. detailPath returns null and the hook reports
|
||||
* notFound, which is what the visitor should see anyway, and
|
||||
* hrefs.ts has already logged the component that produced it.
|
||||
|
|
@ -145,8 +145,6 @@ export type EventListItem = Omit<EventRecord, 'blocks' | 'people' | 'awards'>
|
|||
/** An event_scopes row, as GET /events sends it beside the list. */
|
||||
export type EventScope = { id: string; name: string; sort_order: number }
|
||||
|
||||
export type EventsResponse = { scopes: EventScope[]; events: EventListItem[] }
|
||||
|
||||
export const useEvent = (id?: string): Resource<EventRecord> =>
|
||||
useRecord<EventRecord>(detailPath('/events', id), 'event')
|
||||
|
||||
|
|
@ -251,14 +249,12 @@ export type OrganizationListItem = Omit<OrganizationRecord, 'teams' | 'awards' |
|
|||
sort_order: number
|
||||
}
|
||||
|
||||
export type OrganizationsResponse = { organizations: OrganizationListItem[] }
|
||||
|
||||
export const useOrganization = (id?: string): Resource<OrganizationRecord> =>
|
||||
useRecord<OrganizationRecord>(detailPath('/organizations', id), 'organization')
|
||||
|
||||
/* ── Teams ───────────────────────────────────────────────────── */
|
||||
|
||||
/** No members here on purpose — PeopleTiles fetches
|
||||
/** No members here on purpose, PeopleTiles fetches
|
||||
* /teams/:id/people itself. See the note in content.js. */
|
||||
export type TeamRecord = {
|
||||
id: string
|
||||
|
|
|
|||
|
|
@ -14,20 +14,16 @@
|
|||
* callers, so aborting on unmount would cancel someone else's
|
||||
* request. The `live` flag drops the result instead.
|
||||
*
|
||||
* No `fallback` on purpose. Handing this the mock data would render a
|
||||
* plausible-looking history with no indication the server is down, and
|
||||
* the wrong history is worse than a visible error — the same reason
|
||||
* `fallback: EMPTY` came out elsewhere.
|
||||
*
|
||||
* `undated` is the number of published entries the API left out because
|
||||
* nothing gave them a date. Not rendered publicly — a visitor can't act
|
||||
* on it — but returned so it's reachable if you want a warning in the
|
||||
* nothing gave them a date. Not rendered publicly, a visitor can't act
|
||||
* on it, but returned so it's reachable if you want a warning in the
|
||||
* admin later.
|
||||
*/
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { get, invalidate, ApiError } from './api.ts'
|
||||
import type { TimelineItem } from './timeline'
|
||||
import type { TimelineItem } from './timeline.ts'
|
||||
|
||||
const PATH = '/history'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* useRecord — one record from one endpoint, on the useHistory
|
||||
* useRecord, one record from one endpoint, on the useHistory
|
||||
* pattern.
|
||||
*
|
||||
* Named for what it returns, and deliberately not useResource:
|
||||
* src/lib/useResource.ts is a different hook — it hands back the
|
||||
* whole response body and takes an options object — and a .ts file
|
||||
* src/lib/useResource.ts is a different hook, it hands back the
|
||||
* whole response body and takes an options object, and a .ts file
|
||||
* of the same name would sit one extension away from it. An import
|
||||
* whose target goes missing then resolves to the other file without
|
||||
* a word, and every detail page renders the wrapper object instead
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
* A null `path` means there is nothing to ask for, and the hook
|
||||
* reports notFound rather than loading forever. Callers build the
|
||||
* path with detailPath() from hrefs.ts, which returns null for an
|
||||
* id that could never be real — "undefined" chief among them.
|
||||
* id that could never be real, "undefined" chief among them.
|
||||
*/
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
|
|
|
|||
|
|
@ -3,13 +3,7 @@
|
|||
|
||||
The read hook every page uses:
|
||||
|
||||
const { data, error, loading } = useResource("/events", {
|
||||
fallback: { events: EVENTS }, // the old static module
|
||||
});
|
||||
|
||||
Deliberately small. If the site ever needs mutation, refetch on
|
||||
focus, or pagination, that's the point to reach for TanStack
|
||||
Query rather than growing this file.
|
||||
const { data, error, loading } = useResource("/events");
|
||||
|
||||
Note the `ignore` flag rather than an AbortController: the
|
||||
request is shared and cached, so cancelling it would throw away
|
||||
|
|
@ -20,22 +14,15 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { get } from "./api.ts";
|
||||
|
||||
export function useResource(path, { ttl, fallback }: { ttl?: number; fallback?: any } = {}) {
|
||||
// Seed with the fallback so the first paint has content when one
|
||||
// is available, rather than flashing a spinner and then the same
|
||||
// data a moment later.
|
||||
const [state, setState] = useState<any>(() => ({
|
||||
data: fallback,
|
||||
error: null,
|
||||
loading: true,
|
||||
}));
|
||||
export function useResource(path, { ttl }: { ttl?: number } = {}) {
|
||||
const [state, setState] = useState<any>({ data: undefined, error: null, loading: true });
|
||||
|
||||
useEffect(() => {
|
||||
let ignore = false;
|
||||
|
||||
setState((prev) => ({ ...prev, loading: true, error: null }));
|
||||
|
||||
get(path, { ttl, fallback })
|
||||
get(path, { ttl })
|
||||
.then((data) => {
|
||||
if (!ignore) setState({ data, error: null, loading: false });
|
||||
})
|
||||
|
|
@ -46,7 +33,7 @@ export function useResource(path, { ttl, fallback }: { ttl?: number; fallback?:
|
|||
return () => {
|
||||
ignore = true;
|
||||
};
|
||||
}, [path, ttl]); // fallback is intentionally not a dependency
|
||||
}, [path, ttl]);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
SITE VERSION — src/lib/version.ts
|
||||
SITE VERSION: src/lib/version.ts
|
||||
|
||||
One string, bumped by hand when the working directory name
|
||||
changes. The admin footer is the only thing reading it today;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App'
|
||||
import App from './App.tsx'
|
||||
import './index.css'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
AWARD DETAIL — /awards/:id
|
||||
AWARD DETAIL: /awards/:id
|
||||
|
||||
The thinnest of the four, by design. `awards` has no links and no
|
||||
content blocks — 'award' isn't in the owner_kind CHECK on either
|
||||
content blocks, 'award' isn't in the owner_kind CHECK on either
|
||||
polymorphic table, and widening it means rebuilding two STRICT
|
||||
tables. `description` is the prose.
|
||||
|
||||
So the recipients are the page. They're rendered as a list rather
|
||||
than as PeopleTiles because each one carries a citation, and a
|
||||
citation is the point of an award — it doesn't belong folded
|
||||
citation is the point of an award, it doesn't belong folded
|
||||
behind a chevron.
|
||||
|
||||
Note also that `awards` has no is_published column: every row
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
EVENT DETAIL — /retreats/:id
|
||||
EVENT DETAIL: /retreats/:id
|
||||
|
||||
Reached from the cards on Retreats.tsx. The API has already
|
||||
resolved the fallbacks — `color` is the event's own or its first
|
||||
host's, `status` is derived from the dates when nobody set it —
|
||||
resolved the fallbacks, `color` is the event's own or its first
|
||||
host's, `status` is derived from the dates when nobody set it,
|
||||
so nothing here reimplements those rules.
|
||||
|
||||
Hosts arrive as a list in billing order, each one either an
|
||||
|
|
@ -33,12 +33,13 @@ import { awardHref, personHref, refHref } from '../lib/hrefs.ts'
|
|||
import { personPhoto } from '../lib/media.ts'
|
||||
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
||||
import { occurrenceLabel, seriesLabel, seriesTimes, upcomingOccurrences } from '../lib/eventSeries.ts'
|
||||
import { capitalize } from '../lib/text.ts'
|
||||
|
||||
const TEAL = '#138ba0'
|
||||
const BODY = '#4a6b72'
|
||||
|
||||
/* Billing order. A role missing from here still renders, at the
|
||||
end, under its own name — better than a speaker vanishing
|
||||
end, under its own name, better than a speaker vanishing
|
||||
because somebody added a role to the CHECK and not to this list. */
|
||||
const ROLE_ORDER = [
|
||||
'speaker',
|
||||
|
|
@ -262,7 +263,7 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
|
|||
{/* Outlined rather than filled: the status pill is the one
|
||||
thing in this strip that should read as loud, and two
|
||||
solid blocks side by side would compete. Shown
|
||||
unconditionally — a card suppresses its own type badge in
|
||||
unconditionally, a card suppresses its own type badge in
|
||||
a band of one kind, but here there is no band to make it
|
||||
redundant. */}
|
||||
{event.event_type && (
|
||||
|
|
@ -297,7 +298,7 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
|
|||
/* One host reads as "Hosted by Northwest"; several read as a
|
||||
sentence, so they're joined with commas and an "and" rather than
|
||||
stacked. A host whose id didn't resolve to a route renders as
|
||||
plain text — refHref returns null for that — because a dead link
|
||||
plain text, refHref returns null for that, because a dead link
|
||||
is worse than a name. */
|
||||
function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
|
||||
return (
|
||||
|
|
@ -327,7 +328,7 @@ function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
|
|||
)
|
||||
}
|
||||
|
||||
/* date_label is what a card shows and is free text — "March/April
|
||||
/* date_label is what a card shows and is free text, "March/April
|
||||
2026" is legitimate. This is only the fallback for an event that
|
||||
has dates and no label. */
|
||||
function dateRange(start?: string | null, end?: string | null): string | null {
|
||||
|
|
@ -398,4 +399,3 @@ function peopleGroups(people: EventPerson[], accent: string): PeopleGroupInput[]
|
|||
}))
|
||||
}
|
||||
|
||||
const capitalize = (word: string) => word.charAt(0).toUpperCase() + word.slice(1)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import PageShell from "../components/PageShell";
|
||||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
import FeedbackForm from "./sections/FeedbackForm";
|
||||
import FeedbackForm from "./sections/FeedbackForm.tsx";
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
const PAGE = sitePage("/feedback");
|
||||
|
|
@ -9,7 +9,7 @@ const PAGE = sitePage("/feedback");
|
|||
Feedback page.
|
||||
|
||||
Section ids match the nav hashes. Right now there's one:
|
||||
#website. Add more entries to SECTIONS as the page grows —
|
||||
#website. Add more entries to SECTIONS as the page grows,
|
||||
program feedback, retreat surveys, etc.
|
||||
|
||||
The form itself lives in sections/FeedbackForm, including its
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import PageShell from "../components/PageShell";
|
||||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
import HistoryTimeline from "./sections/history/HistoryTimeline";
|
||||
import { HISTORY_DECADES } from "../data/historyDecades";
|
||||
import { useHistory } from "../lib/useHistory";
|
||||
import HistoryTimeline from "./sections/history/HistoryTimeline.tsx";
|
||||
import { HISTORY_DECADES } from "../data/historyDecades.ts";
|
||||
import { useHistory } from "../lib/useHistory.ts";
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
const PAGE = sitePage("/history");
|
||||
|
|
@ -10,7 +10,7 @@ const PAGE = sitePage("/history");
|
|||
/**
|
||||
* Year the program starts. Decades ending before this render with the
|
||||
* pre-program treatment, so the gap moves if the founding date is ever
|
||||
* corrected — no hardcoded 2000 anywhere in the components.
|
||||
* corrected, no hardcoded 2000 anywhere in the components.
|
||||
*/
|
||||
const PROGRAM_START_YEAR = 2000;
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ export default function History() {
|
|||
|
||||
// Section renders `content` outside its own max-width wrapper, so the
|
||||
// container lives here. The custom properties bind the timeline to
|
||||
// this section's accent and background — --tl-surface must match
|
||||
// this section's accent and background, --tl-surface must match
|
||||
// `background` or the rail will show through the year dots.
|
||||
const wrap = (children: React.ReactNode) => (
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
HOME — /
|
||||
HOME: /
|
||||
|
||||
Not a PageShell page: the front page has no title bar, and each
|
||||
band draws its own heading in its own style.
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
The hero comes first, always. After it, the bands in the order
|
||||
the admin dragged them into, minus any they hid. Which component
|
||||
draws a band is decided here, in SECTIONS, keyed on the same list
|
||||
the CHECK on front_page_sections holds — the database says "retreats,
|
||||
the CHECK on front_page_sections holds, the database says "retreats,
|
||||
third, called National Retreats"; this file says what a retreats
|
||||
band looks like.
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ type BandProps = {
|
|||
}
|
||||
|
||||
/* Default headings for a band the admin didn't title, and how each
|
||||
one renders. The ids are the page anchors — #connect is what the
|
||||
one renders. The ids are the page anchors, #connect is what the
|
||||
hero's second button points at out of the box. */
|
||||
const SECTIONS: Record<
|
||||
FrontPageSectionKey,
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
One component behind four routes, because organizations are one
|
||||
table. The kind decides which extras render, not which file runs.
|
||||
|
||||
The URL kind is decoration — the slug is what identifies the
|
||||
record — so a request for /chapters/great-lakes when that slug is
|
||||
The URL kind is decoration, the slug is what identifies the
|
||||
record, so a request for /chapters/great-lakes when that slug is
|
||||
a region redirects to the canonical path rather than rendering a
|
||||
correct page at a wrong address.
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ export default function OrganizationDetail() {
|
|||
// /chapters/x when x is a region: same record, wrong address.
|
||||
//
|
||||
// useLocation, not window.location: the latter is outside the
|
||||
// router's awareness — always "/" under HashRouter, and free to
|
||||
// router's awareness, always "/" under HashRouter, and free to
|
||||
// be stale mid-navigation, either of which turns this into a
|
||||
// redirect loop rather than a one-shot correction.
|
||||
//
|
||||
|
|
@ -232,7 +232,7 @@ export default function OrganizationDetail() {
|
|||
})
|
||||
}
|
||||
|
||||
// EventList-Cards fetches and renders this itself — its own
|
||||
// EventList-Cards fetches and renders this itself, its own
|
||||
// docstring offers `host` for exactly this case, and a card there
|
||||
// already knows about gradients, logos, past-event collapsing and
|
||||
// the carousel. A second grid here was the same component written
|
||||
|
|
@ -414,7 +414,7 @@ function groupLeadership(org: OrganizationRecord): TeamBlock[] {
|
|||
const blocks: TeamBlock[] = []
|
||||
|
||||
// People who hold a role in the organization without sitting on a
|
||||
// team. Usually the leads. No heading — they are the page.
|
||||
// team. Usually the leads. No heading, they are the page.
|
||||
if (loose.length > 0) {
|
||||
blocks.push({ key: 'loose', teamId: null, label: null, people: loose })
|
||||
}
|
||||
|
|
@ -432,7 +432,7 @@ function groupLeadership(org: OrganizationRecord): TeamBlock[] {
|
|||
}
|
||||
|
||||
// Whatever is left is filed under an unpublished team. Its page
|
||||
// isn't reachable, so the heading is plain text — but the people
|
||||
// isn't reachable, so the heading is plain text, but the people
|
||||
// are real and shouldn't silently vanish from the org.
|
||||
for (const [teamId, people] of byTeam) {
|
||||
blocks.push({
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
PERSON DETAIL — /people/:id
|
||||
PERSON DETAIL: /people/:id
|
||||
|
||||
Everything public that points at one person, gathered by
|
||||
GET /people/:id in people.js. Visibility is decided there, the
|
||||
|
|
@ -33,6 +33,7 @@ import {
|
|||
import { awardHref, eventHref, orgHref, teamHref } from '../lib/hrefs.ts'
|
||||
import { initials, personPhoto } from '../lib/media.ts'
|
||||
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
||||
import { capitalize } from '../lib/text.ts'
|
||||
|
||||
const TEAL = '#138ba0'
|
||||
const BODY = '#4a6b72'
|
||||
|
|
@ -47,8 +48,6 @@ const ROLE_LABEL: Record<string, string> = {
|
|||
member: 'Member',
|
||||
}
|
||||
|
||||
const capitalize = (word: string) =>
|
||||
word ? word.charAt(0).toUpperCase() + word.slice(1) : ''
|
||||
|
||||
export default function PersonDetail() {
|
||||
const { id } = useParams()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import PageShell from "../components/PageShell.jsx";
|
||||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import PageShell from "../components/PageShell.jsx";
|
||||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const PAGE = sitePage("/retreats");
|
|||
RETREATS PAGE
|
||||
|
||||
Three bands, all the same view of the same table with a
|
||||
different filter. The page declares them and does nothing else —
|
||||
different filter. The page declares them and does nothing else,
|
||||
each section fetches its own slice.
|
||||
|
||||
Two filters per band now, and they answer different questions:
|
||||
|
|
@ -29,7 +29,7 @@ const PAGE = sitePage("/retreats");
|
|||
What this page deliberately does not show: local, international
|
||||
and other scopes, and every non-retreat type. Those are reachable
|
||||
from their host's page and by URL, and get a band here when
|
||||
there's enough of them to fill one — see the block at the bottom.
|
||||
there's enough of them to fill one, see the block at the bottom.
|
||||
|
||||
To reorder the page, move a line. To add a different kind of
|
||||
section, add an entry with another Component.
|
||||
|
|
@ -74,7 +74,7 @@ const SECTIONS = [
|
|||
},
|
||||
|
||||
/* The other three scopes, ready to uncomment. Each needs an accent
|
||||
and a background of its own — those are presentation and live
|
||||
and a background of its own, those are presentation and live
|
||||
here, not in event_scopes.
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
TEAM DETAIL — /teams/:id
|
||||
TEAM DETAIL: /teams/:id
|
||||
|
||||
teams.id is a global primary key rather than scoped to the
|
||||
organization, which is what lets this route be flat: 'ngu-board'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import PageShell from "../components/PageShell.jsx";
|
||||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
edge and marked as continuing
|
||||
series every meeting the schedule produces in view (see
|
||||
eventSeries.ts), one day each, with its time
|
||||
undated nowhere — there's no day to put it on. Counted
|
||||
undated nowhere, there's no day to put it on. Counted
|
||||
under the grid so it doesn't vanish without a word.
|
||||
|
||||
Bars are laid out per week in lanes, so a long event keeps its
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
import { useMemo, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import { typesPresent, useEvents } from '../../data/eventData.ts'
|
||||
import { typesPresent, useEvents } from '../../lib/eventData.ts'
|
||||
import { EVENT_TYPES, eventTypeLabel, type EventType } from '../../lib/eventTypes.ts'
|
||||
import { firstOccurrenceFrom, occurrencesBetween, seriesTimes } from '../../lib/eventSeries.ts'
|
||||
import { eventHref } from '../../lib/hrefs.ts'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { splitByStatus, typesPresent, useEvents } from "../../data/eventData.ts";
|
||||
import { splitByStatus, typesPresent, useEvents } from "../../lib/eventData.ts";
|
||||
import { eventHref } from "../../lib/hrefs.ts";
|
||||
import { EVENT_TYPES, eventTypeLabel } from "../../lib/eventTypes.ts";
|
||||
import { seriesLabel } from "../../lib/eventSeries.ts";
|
||||
|
|
@ -8,7 +8,7 @@ import PlatformIcon from "../../components/PlatformIcon.tsx";
|
|||
import { eventBackground, eventLogo as eventLogoSrc, orgLogo as orgLogoSrc } from "../../lib/media.ts";
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
EVENT LIST — CARDS
|
||||
EVENT LIST: CARDS
|
||||
|
||||
A band of event cards, as a peek carousel or a grid. Self
|
||||
contained: give it a filter and it fetches, so the same section
|
||||
|
|
@ -23,7 +23,7 @@ import { eventBackground, eventLogo as eventLogoSrc, orgLogo as orgLogoSrc } fro
|
|||
|
||||
`type` pre-filters the band the way `scope` and `host` do. Left
|
||||
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.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ const PAST_FADE = "linear-gradient(to bottom, black 0%, black 45%, transparent 1
|
|||
|
||||
/* ── Carousel sizing ──────────────────────────────────────────
|
||||
CARD the card itself
|
||||
GAP space between cards — raise to push neighbors out
|
||||
GAP space between cards, raise to push neighbors out
|
||||
FADE_DIST how far past the card's edge neighbors fade to nothing
|
||||
───────────────────────────────────────────────────────────── */
|
||||
const CARD = "min(48rem, 90vw)";
|
||||
|
|
@ -113,7 +113,7 @@ const EDGE_FADE = `linear-gradient(to right,
|
|||
A link on the title rather than a wrapper around the whole card:
|
||||
the footer already holds anchors, and an anchor inside an anchor
|
||||
is invalid markup that every browser resolves by guessing. The
|
||||
carousel has the same constraint — it needs the card's click to
|
||||
carousel has the same constraint, it needs the card's click to
|
||||
mean "bring this one to the front" on anything that isn't the
|
||||
active slide. */
|
||||
function TitleLink({ ev, linked, children }) {
|
||||
|
|
@ -126,7 +126,7 @@ function TitleLink({ ev, linked, children }) {
|
|||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
EVENT CARD — one component, two sizes.
|
||||
EVENT CARD: one component, two sizes.
|
||||
compact=false → the full card used in the carousel
|
||||
compact=true → the grid card: details left, text right, and a
|
||||
footer pinned to the bottom so every card in a
|
||||
|
|
@ -136,9 +136,9 @@ function TitleLink({ ev, linked, children }) {
|
|||
page or a home strip can render one without the section around
|
||||
it.
|
||||
|
||||
Fields arrive pre-resolved from the API — `color` is the event's
|
||||
Fields arrive pre-resolved from the API: `color` is the event's
|
||||
own or its host's, `status` is derived from the dates when it
|
||||
isn't set — so nothing here reimplements those rules.
|
||||
isn't set, so nothing here reimplements those rules.
|
||||
|
||||
`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.
|
||||
|
|
@ -165,7 +165,7 @@ export function Card({
|
|||
|
||||
/* Off unless the caller says the band is mixed. A "Retreat" badge
|
||||
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 =
|
||||
showType && ev.event_type ? (
|
||||
<span
|
||||
|
|
@ -262,14 +262,14 @@ export function Card({
|
|||
</>
|
||||
)}
|
||||
|
||||
{/* Footer — mt-auto pins the whole block to the bottom so
|
||||
{/* Footer, mt-auto pins the whole block to the bottom so
|
||||
buttons line up across every card in a grid row.
|
||||
|
||||
Three registration states, as before: links to follow, a
|
||||
past event, or an announcement still to come. What's new
|
||||
is that all three end in the same row, because every
|
||||
event now has a page and a past one is often the more
|
||||
worth reading — speakers, awards, what actually
|
||||
worth reading, speakers, awards, what actually
|
||||
happened. The notice is what changes; the way in
|
||||
doesn't. */}
|
||||
<div className={`mt-auto ${compact ? "pt-6" : "pt-8"}`}>
|
||||
|
|
@ -306,7 +306,7 @@ export function Card({
|
|||
))}
|
||||
|
||||
{/* Only when there's nothing to register for and the
|
||||
event hasn't happened — the same condition as before,
|
||||
event hasn't happened, the same condition as before,
|
||||
just no longer nested inside that branch. */}
|
||||
{igHandle && !past && links.length === 0 && (
|
||||
<a
|
||||
|
|
@ -346,7 +346,7 @@ export function Card({
|
|||
TYPE FILTER
|
||||
|
||||
Drawn only when a band actually holds more than one kind, so it
|
||||
costs nothing today — every event is a retreat — and appears on
|
||||
costs nothing today, every event is a retreat, and appears on
|
||||
its own the first time a class or a workshop lands in that band.
|
||||
Nothing on Retreats.tsx has to be reconfigured for it.
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ export function TypeFilter({ types, active, setActive, accent }) {
|
|||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
TOGGLE — the control for the section heading's action bar
|
||||
TOGGLE: the control for the section heading's action bar
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
export function EventCardsToggle({ view, setView, accent }) {
|
||||
const btn = active => ({
|
||||
|
|
@ -437,8 +437,8 @@ export function EventCardsToggle({ view, setView, accent }) {
|
|||
Fetches its own slice of the events, then draws it as a carousel
|
||||
or a grid.
|
||||
|
||||
An empty list means three different things now — still loading,
|
||||
failed, or genuinely nothing scheduled — and they read very
|
||||
An empty list means three different things now, still loading,
|
||||
failed, or genuinely nothing scheduled, and they read very
|
||||
differently to someone waiting, so they're distinguished rather
|
||||
than all falling through to "coming soon".
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
|
@ -464,7 +464,7 @@ export default function EventListCards({
|
|||
const [showPast, setShowPast] = useState(false);
|
||||
const [activeType, setActiveType] = useState("all");
|
||||
|
||||
/* 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
|
||||
dead buttons. */
|
||||
const availableTypes = useMemo(
|
||||
|
|
@ -483,7 +483,7 @@ export default function EventListCards({
|
|||
);
|
||||
|
||||
/* Open on the first upcoming event. The list is empty on the
|
||||
first render, so this can't be a useState initialiser — it has
|
||||
first render, so this can't be a useState initialiser, it has
|
||||
to wait for the data and then run once. Clearing the guard when
|
||||
the list empties means a refetch re-seeds. */
|
||||
const seeded = useRef(false);
|
||||
|
|
@ -546,7 +546,7 @@ export default function EventListCards({
|
|||
if (error && events.length === 0) {
|
||||
return (
|
||||
<div className="overflow-hidden">
|
||||
{notice("· Events couldn't be loaded just now — please try again shortly ·")}
|
||||
{notice("· Events couldn't be loaded just now, please try again shortly ·")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -572,7 +572,7 @@ export default function EventListCards({
|
|||
: `· No ${eventTypeLabel(activeType).toLowerCase()} events in this section yet ·`,
|
||||
)
|
||||
) : view === "grid" ? (
|
||||
/* ── 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 }}>
|
||||
{upcoming.length > 0 && (
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ export default function FeedbackForm() {
|
|||
className="rounded-2xl border border-[#138ba0]/20 bg-white p-8 sm:p-10"
|
||||
>
|
||||
<h3 className="text-2xl font-bold" style={{ color: ACCENT }}>
|
||||
Thanks — we've got it
|
||||
Thanks, we've got it
|
||||
</h3>
|
||||
{where && (
|
||||
<p className="mt-3 text-sm" style={{ color: MUTED }}>
|
||||
|
|
@ -301,7 +301,7 @@ export default function FeedbackForm() {
|
|||
<p className="mt-3 max-w-prose" style={{ color: MUTED }}>
|
||||
{email
|
||||
? `We'll follow up at ${email} if we have questions.`
|
||||
: "You sent this anonymously, so we won't be able to reply — but we read everything that comes in."}
|
||||
: "You sent this anonymously, so we won't be able to reply, but we read everything that comes in."}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -375,7 +375,7 @@ export default function FeedbackForm() {
|
|||
</div>
|
||||
<p className="mt-1 max-w-prose text-sm" style={{ color: MUTED }}>
|
||||
Leave these blank and your feedback comes through anonymously. Fill
|
||||
them in only if you'd like a reply — we won't add you to any list.
|
||||
them in only if you'd like a reply, we won't add you to any list.
|
||||
</p>
|
||||
|
||||
<div className="mt-5 grid gap-4 sm:grid-cols-2">
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ import {
|
|||
initialsFor,
|
||||
orgPath,
|
||||
useOrganizations,
|
||||
} from "../../data/organizations.ts";
|
||||
byName,
|
||||
} from "../../lib/organizations.ts";
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
ORGANIZATION LIST — CARDS
|
||||
ORGANIZATION LIST: CARDS
|
||||
|
||||
A grid of organization cards. No toggle: this view is the grid,
|
||||
which is why the section that uses it declares no `views` in the
|
||||
|
|
@ -19,7 +20,7 @@ import {
|
|||
Where the vertical list expands in place, a card links out. The
|
||||
card carries as much as fits at a glance and the organization's
|
||||
own page carries the rest, so nothing here reads a `blocks`
|
||||
array — only the short card description.
|
||||
array, only the short card description.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
const MUTED = "#7a9299";
|
||||
|
|
@ -87,11 +88,11 @@ function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
|||
|
||||
{/* Top-right rather than in the footer: the footer holds
|
||||
outbound links, and the arrow goes somewhere different
|
||||
in kind — deeper into this site. */}
|
||||
in kind, deeper into this site. */}
|
||||
{path && (
|
||||
<ArrowLink
|
||||
to={path}
|
||||
label={`${org.name} — ${pageLabel}`}
|
||||
label={`${org.name}: ${pageLabel}`}
|
||||
color={color}
|
||||
/>
|
||||
)}
|
||||
|
|
@ -166,7 +167,6 @@ function Block({ title, orgs, accent, pageLabel, siteLabel }) {
|
|||
);
|
||||
}
|
||||
|
||||
const byName = (a, b) => a.name.localeCompare(b.name);
|
||||
|
||||
export default function OrgListCards({
|
||||
kind,
|
||||
|
|
@ -196,7 +196,7 @@ export default function OrgListCards({
|
|||
if (error && organizations.length === 0) {
|
||||
return shell(
|
||||
<p className="font-600" style={{ color: accent }}>
|
||||
· This list couldn't be loaded just now — please try again shortly ·
|
||||
· This list couldn't be loaded just now, please try again shortly ·
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { useEffect, useRef, useState } from "react";
|
||||
import { useCommunity } from "../../data/chapters.ts";
|
||||
import { useCommunity } from "../../lib/chapters.ts";
|
||||
import { Link } from "react-router-dom";
|
||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||
import { orgLogo } from "../../lib/media.ts";
|
||||
import { initialsFor, orgPath } from "../../data/organizations.ts";
|
||||
import { initialsFor, orgPath } from "../../lib/organizations.ts";
|
||||
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
ORGANIZATION LIST — MAP
|
||||
ORGANIZATION LIST: MAP
|
||||
|
||||
Organizations placed on a tile grid: the map on the left, the
|
||||
list on the right, selecting on either side filtering both.
|
||||
|
|
@ -15,7 +15,7 @@ import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
|||
Filtered to chapters, and unlike the other sections that isn't
|
||||
a prop. A map only makes sense for organizations that sit
|
||||
somewhere, and it reads regions off the same data to colour the
|
||||
tiles — so "plot partners instead" isn't a filter change, it's a
|
||||
tiles, so "plot partners instead" isn't a filter change, it's a
|
||||
different component. Named for the view rather than the filter
|
||||
so that stays visible.
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
|||
stays legible on a phone, it needs no map library or GeoJSON,
|
||||
and a state split between two regions is just a tile painted in
|
||||
two colors. If you later want true geography, the swap point is
|
||||
<RegionMap> — everything else works off the data.
|
||||
<RegionMap>, everything else works off the data.
|
||||
|
||||
The tile layout comes from mapGrid.ts; who paints what comes
|
||||
from the API. A state and the Canada band are the same shape
|
||||
|
|
@ -109,7 +109,7 @@ function Blocks({ blocks = [] as any[], color }) {
|
|||
{item.detail && (
|
||||
<span className="text-sm" style={{ color: MUTED }}>
|
||||
{" "}
|
||||
— {item.detail}
|
||||
({item.detail})
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
|
|
@ -180,7 +180,7 @@ function Tile({
|
|||
className="transition-opacity duration-200"
|
||||
>
|
||||
<title>
|
||||
{AREA_NAMES[code] || code} — {slices.map(s => s.name).join(" / ")}
|
||||
{AREA_NAMES[code] || code}: {slices.map(s => s.name).join(" / ")}
|
||||
{count ? ` · ${count} chapter${count > 1 ? "s" : ""}` : ""}
|
||||
</title>
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ function RegionMap({ slices, chapterCounts, ...props }: any) {
|
|||
role="group"
|
||||
aria-label="Chapters by Unity region"
|
||||
>
|
||||
{/* States and bands are the same shape — a tile with a span —
|
||||
{/* States and bands are the same shape, a tile with a span,
|
||||
so this is one loop rather than two. */}
|
||||
{AREAS.map(area => (
|
||||
<Tile
|
||||
|
|
@ -386,7 +386,7 @@ function RegionBlock({
|
|||
{region.name}
|
||||
</h4>
|
||||
<span className="text-sm ml-auto" style={{ color: MUTED }}>
|
||||
{chapters.length || "—"}
|
||||
{chapters.length || "-"}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ function RegionBlock({
|
|||
|
||||
{chapters.length === 0 ? (
|
||||
<p className="text-sm ml-5 mb-4" style={{ color: MUTED }}>
|
||||
No chapters yet — interested in starting one?
|
||||
No chapters yet. Interested in starting one?
|
||||
</p>
|
||||
) : (
|
||||
<ul className="ml-5 mb-4 flex flex-col gap-3">
|
||||
|
|
@ -444,7 +444,7 @@ function RegionBlock({
|
|||
{orgPath(c) && (
|
||||
<ArrowLink
|
||||
to={orgPath(c)}
|
||||
label={`${c.name} — chapter page`}
|
||||
label={`${c.name}: chapter page`}
|
||||
color={colorOf(region)}
|
||||
size="h-8 w-8"
|
||||
/>
|
||||
|
|
@ -545,7 +545,7 @@ function ChapterCard({ chapter, color, open, onOpen }) {
|
|||
{orgPath(chapter) && (
|
||||
<ArrowLink
|
||||
to={orgPath(chapter)}
|
||||
label={`${chapter.name} — chapter page`}
|
||||
label={`${chapter.name}: chapter page`}
|
||||
color={color}
|
||||
/>
|
||||
)}
|
||||
|
|
@ -711,7 +711,7 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
|
|||
|
||||
{empty.length > 0 && (
|
||||
<p className="text-sm" style={{ color: MUTED }}>
|
||||
No chapters yet in {empty.map(r => r.name).join(", ")} — interested in
|
||||
No chapters yet in {empty.map(r => r.name).join(", ")}. Interested in
|
||||
starting one?
|
||||
</p>
|
||||
)}
|
||||
|
|
@ -835,7 +835,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
if (error && regions.length === 0) {
|
||||
return shell(
|
||||
<p className="font-600" style={{ color: accent }}>
|
||||
· Chapters couldn't be loaded just now — please try again shortly ·
|
||||
· Chapters couldn't be loaded just now, please try again shortly ·
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
|
@ -871,7 +871,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
);
|
||||
|
||||
return (
|
||||
/* Wider than the section heading above it — the map needs the
|
||||
/* Wider than the section heading above it, the map needs the
|
||||
room. CONTENT_MAX is the knob; drop it toward 72rem to pull
|
||||
the whole block back in line with the heading. */
|
||||
shell(
|
||||
|
|
@ -897,7 +897,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
</p>
|
||||
</div>
|
||||
|
||||
{/* List — h-0 + min-h-full makes this column take its height
|
||||
{/* List, h-0 + min-h-full makes this column take its height
|
||||
from the map column rather than the other way round, so a
|
||||
long list scrolls instead of stretching the section. */}
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@ import {
|
|||
initialsFor,
|
||||
orgPath,
|
||||
useOrganizations,
|
||||
} from "../../data/organizations.ts";
|
||||
byName,
|
||||
} from "../../lib/organizations.ts";
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
ORGANIZATION LIST — VERTICAL
|
||||
ORGANIZATION LIST: VERTICAL
|
||||
|
||||
A stack of organizations, each collapsed to a line and
|
||||
expandable for the rest. Every row carries two ways out: an
|
||||
|
|
@ -44,7 +45,7 @@ const FALLBACK_COLOR = "#4a6b72";
|
|||
|
||||
/* ── Row button ───────────────────────────────────────────────
|
||||
Deliberately a sibling of the summary button rather than inside
|
||||
it — a link nested in a button is invalid, and a screen reader
|
||||
it, a link nested in a button is invalid, and a screen reader
|
||||
announces the whole row as one confused control.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
function RowButton({ as: As = "button", color, children, ...rest }: any) {
|
||||
|
|
@ -107,7 +108,7 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
|||
const chapterCount = (org.details?.chapters ?? []).length;
|
||||
const note = org.details?.map_note;
|
||||
|
||||
/* Collapsed, a row says who it is and nothing else — the areas
|
||||
/* Collapsed, a row says who it is and nothing else, the areas
|
||||
sentence runs long and lives in the panel, where it appears
|
||||
exactly once rather than in both places. */
|
||||
const summary = org.tagline;
|
||||
|
|
@ -181,7 +182,7 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
|||
{path && (
|
||||
<ArrowLink
|
||||
to={path}
|
||||
label={`${org.name} — ${pageLabel}`}
|
||||
label={`${org.name}: ${pageLabel}`}
|
||||
color={color}
|
||||
/>
|
||||
)}
|
||||
|
|
@ -263,7 +264,6 @@ function Block({ title, orgs, pageLabel, siteLabel }) {
|
|||
);
|
||||
}
|
||||
|
||||
const byName = (a, b) => a.name.localeCompare(b.name);
|
||||
|
||||
export default function OrgListVertical({
|
||||
kind,
|
||||
|
|
@ -291,7 +291,7 @@ export default function OrgListVertical({
|
|||
if (error && organizations.length === 0) {
|
||||
return shell(
|
||||
<p className="font-600" style={{ color: accent }}>
|
||||
· This list couldn't be loaded just now — please try again shortly ·
|
||||
· This list couldn't be loaded just now, please try again shortly ·
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import {
|
|||
type DecadeMeta,
|
||||
type SortDirection,
|
||||
type TimelineItem,
|
||||
} from '../../../lib/timeline'
|
||||
import TimelineDecade from './TimelineDecade'
|
||||
import TimelineUpcoming from './TimelineUpcoming'
|
||||
} from '../../../lib/timeline.ts'
|
||||
import TimelineDecade from './TimelineDecade.tsx'
|
||||
import TimelineUpcoming from './TimelineUpcoming.tsx'
|
||||
import './timeline.css'
|
||||
|
||||
const PARAM = 'y'
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import {
|
|||
withGapYears,
|
||||
type GroupedDecade,
|
||||
type SortDirection,
|
||||
} from '../../../lib/timeline'
|
||||
import TimelineYear from './TimelineYear'
|
||||
} from '../../../lib/timeline.ts'
|
||||
import TimelineYear from './TimelineYear.tsx'
|
||||
|
||||
type Props = {
|
||||
decade: GroupedDecade
|
||||
|
|
@ -45,7 +45,7 @@ export default function TimelineDecade({
|
|||
{decade.preProgram ? (
|
||||
<p className="ngu-tl__gapNote">
|
||||
<span aria-hidden="true">◌</span>
|
||||
Before the program — kept for context, not part of our record
|
||||
Before the program, kept for context, not part of our record
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Link } from 'react-router-dom'
|
||||
import { MONTH_LABELS, type PersonRef, type TimelineItem } from '../../../lib/timeline'
|
||||
import { hrefFor, logoSrc, photoSrc } from '../../../lib/timelineRefs'
|
||||
import { MONTH_LABELS, type PersonRef, type TimelineItem } from '../../../lib/timeline.ts'
|
||||
import { hrefFor, logoSrc, photoSrc } from '../../../lib/timelineRefs.ts'
|
||||
import { initials } from '../../../lib/media.ts'
|
||||
|
||||
const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
||||
milestone: 'Milestone',
|
||||
|
|
@ -10,7 +11,7 @@ const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
|||
people: 'People',
|
||||
}
|
||||
|
||||
/** Day number only — the month node above already carries the month. */
|
||||
/** Day number only, the month node above already carries the month. */
|
||||
function dayMarker(item: TimelineItem): string {
|
||||
if (item.precision !== 'day') return ''
|
||||
const day = Number(item.date.split('-')[2])
|
||||
|
|
@ -26,16 +27,6 @@ function fullMarker(item: TimelineItem): string {
|
|||
return `${month} ${Number(d)}`
|
||||
}
|
||||
|
||||
/** Initials stand in when a person has no photo on file. */
|
||||
function initials(name: string): string {
|
||||
return name
|
||||
.split(/\s+/)
|
||||
.slice(0, 2)
|
||||
.map((part) => part[0] ?? '')
|
||||
.join('')
|
||||
.toUpperCase()
|
||||
}
|
||||
|
||||
function PersonChip({ person }: { person: PersonRef }) {
|
||||
const src = photoSrc(person.photo)
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useState } from 'react'
|
||||
import type { GroupedYear, SortDirection } from '../../../lib/timeline'
|
||||
import TimelineYear from './TimelineYear'
|
||||
import type { GroupedYear, SortDirection } from '../../../lib/timeline.ts'
|
||||
import TimelineYear from './TimelineYear.tsx'
|
||||
|
||||
type Props = {
|
||||
years: GroupedYear[]
|
||||
|
|
@ -17,7 +17,7 @@ type Props = {
|
|||
* order. That keeps the button anchored next to the decade marker
|
||||
* instead of drifting up the page as items appear.
|
||||
*
|
||||
* Membership is decided by date, not by a flag — see partitionByDate.
|
||||
* Membership is decided by date, not by a flag, see partitionByDate.
|
||||
* An event moves into the record on its own, with nothing to update.
|
||||
*/
|
||||
export default function TimelineUpcoming({
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { CSSProperties } from 'react'
|
||||
import type { GroupedYear } from '../../../lib/timeline'
|
||||
import TimelineEntry from './TimelineEntry'
|
||||
import type { GroupedYear } from '../../../lib/timeline.ts'
|
||||
import TimelineEntry from './TimelineEntry.tsx'
|
||||
|
||||
/** Dot diameter scales with volume, so the rail reads as a density chart. */
|
||||
function dotSize(count: number): string {
|
||||
|
|
@ -42,7 +42,7 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
|||
/>
|
||||
<span className="ngu-tl__yearLabel">{year.year}</span>
|
||||
<span className="ngu-tl__yearCount">
|
||||
{empty ? '—' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||
{empty ? '-' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* History timeline — scoped under .ngu-tl.
|
||||
* History timeline, scoped under .ngu-tl.
|
||||
*
|
||||
* Everything themeable is a custom property with a fallback, so rewiring to the
|
||||
* site tokens is a one-block edit at the top. Typefaces are deliberately not
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* ——— Decade block ——————————————————————————————————————————————— */
|
||||
/* --- Decade block ----------------------------------------------- */
|
||||
|
||||
.ngu-tl__decade {
|
||||
position: relative;
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
color: var(--tl-muted);
|
||||
}
|
||||
|
||||
/* ——— Decade header ——————————————————————————————————————————————— */
|
||||
/* --- Decade header ----------------------------------------------- */
|
||||
|
||||
.ngu-tl__decadeHead {
|
||||
position: relative;
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
color: var(--tl-faint);
|
||||
}
|
||||
|
||||
/* ——— Year node ———————————————————————————————————————————————— */
|
||||
/* --- Year node ------------------------------------------------ */
|
||||
|
||||
.ngu-tl__year {
|
||||
position: relative;
|
||||
|
|
@ -231,7 +231,7 @@
|
|||
font-weight: 450;
|
||||
}
|
||||
|
||||
/* ——— Expanded panel ——————————————————————————————————————————— */
|
||||
/* --- Expanded panel ------------------------------------------- */
|
||||
|
||||
.ngu-tl__panel {
|
||||
padding: 0.25rem 0 1.5rem var(--tl-gutter);
|
||||
|
|
@ -286,7 +286,7 @@
|
|||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
/* ——— Entry ————————————————————————————————————————————————————— */
|
||||
/* --- Entry ----------------------------------------------------- */
|
||||
|
||||
.ngu-tl__entry {
|
||||
display: grid;
|
||||
|
|
@ -371,7 +371,7 @@ a.ngu-tl__entry:hover .ngu-tl__entryTitle {
|
|||
box-shadow: inset 0 0 0 1.5px var(--tl-faint);
|
||||
}
|
||||
|
||||
/* ——— Featured entries ————————————————————————————————————————— */
|
||||
/* --- Featured entries ----------------------------------------- */
|
||||
|
||||
.ngu-tl__featured {
|
||||
display: flex;
|
||||
|
|
@ -403,7 +403,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
background: color-mix(in srgb, var(--tl-accent) 18%, transparent);
|
||||
}
|
||||
|
||||
/* ——— Empty state ——————————————————————————————————————————————— */
|
||||
/* --- Empty state ----------------------------------------------- */
|
||||
|
||||
.ngu-tl__empty {
|
||||
padding: 0.5rem 0 1.25rem var(--tl-gutter);
|
||||
|
|
@ -420,7 +420,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
}
|
||||
}
|
||||
|
||||
/* ——— Toolbar + utilities ————————————————————————————————————— */
|
||||
/* --- Toolbar + utilities ------------------------------------- */
|
||||
|
||||
.ngu-tl__toolbar {
|
||||
display: flex;
|
||||
|
|
@ -468,7 +468,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
border: 0;
|
||||
}
|
||||
|
||||
/* ——— Upcoming block ——————————————————————————————————————————
|
||||
/* --- Upcoming block ------------------------------------------
|
||||
Opens upward: the toggle is first in the DOM, column-reverse puts the
|
||||
list above it. Faded because none of it has happened yet. */
|
||||
|
||||
|
|
@ -556,7 +556,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
}
|
||||
}
|
||||
|
||||
/* ——— Event / org / award logo ————————————————————————————————— */
|
||||
/* --- Event / org / award logo --------------------------------- */
|
||||
|
||||
.ngu-tl__logo {
|
||||
display: inline-block;
|
||||
|
|
@ -574,7 +574,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
vertical-align: -0.3125rem;
|
||||
}
|
||||
|
||||
/* ——— People roster ——————————————————————————————————————————— */
|
||||
/* --- People roster ------------------------------------------- */
|
||||
|
||||
.ngu-tl__entryWrap {
|
||||
display: block;
|
||||
|
|
@ -643,7 +643,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
color: var(--tl-faint);
|
||||
}
|
||||
|
||||
/* ——— Kind markers, continued ————————————————————————————————— */
|
||||
/* --- Kind markers, continued --------------------------------- */
|
||||
|
||||
.ngu-tl__kind--organization {
|
||||
border-radius: 2px;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
EventCalendar on the front page: every scope and every type, all
|
||||
four visitor filters, starting on this month. The same component
|
||||
can go on any page with a narrower filter — a region's page would
|
||||
pass host, a classes page would pass type — and this file only
|
||||
can go on any page with a narrower filter, a region's page would
|
||||
pass host, a classes page would pass type, and this file only
|
||||
adds the front page's heading around it.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
under the cards with a dot per entry, and a year label wherever
|
||||
the year changes. The last card goes to the full history.
|
||||
|
||||
Featured is the admin's call — timeline_entries.is_featured,
|
||||
Featured is the admin's call, timeline_entries.is_featured,
|
||||
"shown large" on the history page. Nothing else is filtered
|
||||
here; /history has already decided what's public.
|
||||
|
||||
Scrolling is native — touch, trackpad, shift-wheel — with
|
||||
Scrolling is native, touch, trackpad, shift-wheel, with
|
||||
scroll-snap so it settles on a card. A mouse can also drag it, and
|
||||
the arrow buttons step one card. A drag that moved more than a few
|
||||
pixels swallows the click it ends in, so letting go over a card
|
||||
|
|
@ -170,7 +170,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
|||
|
||||
const year = (item: TimelineItem) => item.date.slice(0, 4)
|
||||
|
||||
/* "June 2014", "2014", "12 June 2014" — only as much as precision
|
||||
/* "June 2014", "2014", "12 June 2014", only as much as precision
|
||||
says is true. */
|
||||
function dateLabel(item: TimelineItem): string {
|
||||
const [y, m, d] = item.date.split('-')
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
The API picks the event (pinned in the admin, or the next one that
|
||||
hasn't ended); this works out the moment to count to.
|
||||
|
||||
For a one-off event that's local midnight on starts_on — dates
|
||||
For a one-off event that's local midnight on starts_on, dates
|
||||
here are calendar dates with no time attached. For a series it's
|
||||
the next meeting, at the series' start time when it has one, so a
|
||||
weekly class counts down to Tuesday 7pm rather than to a start
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
PATHFINDER — "Find your way in"
|
||||
PATHFINDER: "Find your way in"
|
||||
|
||||
The connect section as a question rather than a wall of forms:
|
||||
pick what you're here for, and that path's actions arrive. Paths
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue