diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index e7c9fb6..ececced 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -268,7 +268,7 @@ The numbers band's "Number Source" dropdown works the same way: | What | File | Notes | | --- | --- | --- | | Header and footer navigation, page subnav links | `src/navConfig.ts` | `PAGE_LINKS`, `PAGE_SECTIONS`, `NAV_ACTIONS`. A new page also needs a route in `src/App.tsx`. | -| Section titles, blurbs and colors on Retreats, Community, Leadership, Resources, Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. A section's `id` must match its subnav `hash`. | +| Section titles, blurbs and colors on Retreats, Community, Organization, Resources, Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. A section's `id` must match its subnav `hash`. | | Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. | | History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. | | Group map tiles and area names | `src/data/mapGrid.ts` | `AREAS` (tile positions) and `AREA_NAMES`. Which region paints which tile is in the database (Admin → Data → Organizations → a region → Map areas). | diff --git a/server/src/admin-schema/columns.js b/server/src/admin-schema/columns.js index 0832550..49a0f15 100644 --- a/server/src/admin-schema/columns.js +++ b/server/src/admin-schema/columns.js @@ -150,6 +150,7 @@ export const blocksChild = (ownerKind) => ({ "schedule", "table", "cards", + "people", ], { required: true }, ), @@ -158,6 +159,8 @@ export const blocksChild = (ownerKind) => ({ url("href"), text("alt"), text("cite"), + // People blocks only (054): whose team's tiles to show. + text("team_id"), ], children: [ { @@ -200,5 +203,6 @@ export const hostsChild = { table: "event_hosts", owner: { column: "event_id" }, order: "sort_order", - columns: [text("org_id"), text("person_id")], + // team_id (054): an organization host's team, shown in its place. + columns: [text("org_id"), text("person_id"), text("team_id")], }; diff --git a/server/src/migrations/054_people_blocks_host_teams.sql b/server/src/migrations/054_people_blocks_host_teams.sql new file mode 100644 index 0000000..ecb39c0 --- /dev/null +++ b/server/src/migrations/054_people_blocks_host_teams.sql @@ -0,0 +1,140 @@ +-- ═══════════════════════════════════════════════════════════════ +-- 054 PEOPLE BLOCKS, HOST TEAMS, THE ORGANIZATION PAGE +-- +-- A content block of type 'people': a team's people tiles, people +-- picked one by one (items, each with a title), or both. The team +-- is a new column, content_blocks.team_id; a picked person rides on +-- the item's person_id, as a schedule entry's does. ContentBlocks.tsx +-- draws it with PeopleTiles. The type CHECK changes, so the table is +-- rebuilt as 045 did (legacy_alter_table around the rename, then its +-- index and owner trigger again). +-- +-- An event's organization host can name a team to show instead: +-- event_hosts.team_id, any organization's team. The event page then +-- reads "Hosted by " linked to the team's page. v_event_hosts +-- carries it (and v_events, which reads v_event_hosts, is made again +-- around it, unchanged). +-- +-- The Leadership page is now the Organization page, at /organization: +-- a page title or intro saved for /leadership in Site settings moves +-- with it. +-- ═══════════════════════════════════════════════════════════════ + +-- ── Host teams ───────────────────────────────────────────────── + +ALTER TABLE event_hosts ADD COLUMN team_id TEXT REFERENCES teams (id) ON DELETE SET NULL; + +DROP VIEW v_events; +DROP VIEW v_event_hosts; + +CREATE VIEW v_event_hosts AS +SELECT + eh.id, + eh.event_id, + eh.sort_order, + CASE WHEN eh.person_id IS NULL THEN 'organization' ELSE 'person' END + AS host_kind, + COALESCE(eh.org_id, eh.person_id) AS host_id, + COALESCE(o.name, p.display_name) AS host_name, + o.kind AS host_org_kind, + o.logo AS host_logo, + o.color AS host_color, + p.photo AS host_photo, + COALESCE(o.is_published, p.is_published) AS host_is_published, + t.id AS host_team_id, + t.name AS host_team_name +FROM event_hosts eh +LEFT JOIN organizations o ON o.id = eh.org_id +LEFT JOIN people p ON p.id = eh.person_id +LEFT JOIN teams t ON t.id = eh.team_id AND eh.org_id IS NOT NULL AND t.is_published = 1; + +CREATE VIEW v_events AS +SELECT + e.*, + h.host_kind, + h.host_id, + h.host_name, + h.host_org_kind, + COALESCE(e.org_logo, h.host_logo) AS effective_org_logo, + COALESCE(e.color, h.host_color) AS effective_color, + COALESCE( + e.status, + CASE WHEN e.ends_on IS NOT NULL AND e.ends_on < date('now') + THEN 'past' ELSE 'upcoming' END + ) AS effective_status +FROM events e +LEFT JOIN v_event_hosts h + ON h.id = ( + SELECT x.id + FROM v_event_hosts x + WHERE x.event_id = e.id + ORDER BY x.sort_order, x.id + LIMIT 1 + ); + + +-- ── People blocks ────────────────────────────────────────────── + +CREATE TABLE content_blocks_new ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + owner_kind TEXT NOT NULL + CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post')), + owner_id TEXT NOT NULL, + slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body')), + sort_order INTEGER NOT NULL DEFAULT 0, + + type TEXT NOT NULL + CHECK (type IN ('heading', 'subheading', 'paragraph', + 'list', 'links', 'quote', 'image', 'divider', + 'video', 'button', 'callout', 'schedule', 'table', 'cards', + 'people')), + text TEXT, + media TEXT, + href TEXT, + alt TEXT, + cite TEXT, + team_id TEXT REFERENCES teams (id) ON DELETE SET NULL +) STRICT; + +INSERT INTO content_blocks_new + (id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite) +SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite + FROM content_blocks; + +PRAGMA legacy_alter_table = ON; +DROP TABLE content_blocks; +ALTER TABLE content_blocks_new RENAME TO content_blocks; +PRAGMA legacy_alter_table = OFF; + +CREATE INDEX content_blocks_owner_idx + ON content_blocks (owner_kind, owner_id, slot, sort_order); + + +-- ── The Organization page ────────────────────────────────────── + +UPDATE site_setting_pages SET path = '/organization' WHERE path = '/leadership'; + + +-- ── Triggers last (see CLAUDE.md, Migrations) ── + +CREATE TRIGGER content_blocks_owner_exists +BEFORE INSERT ON content_blocks +BEGIN + SELECT CASE + WHEN new.owner_kind = 'event' + AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id) + THEN RAISE(ABORT, 'content_blocks: no such event') + WHEN new.owner_kind = 'organization' + AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id) + THEN RAISE(ABORT, 'content_blocks: no such organization') + WHEN new.owner_kind = 'person' + AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id) + THEN RAISE(ABORT, 'content_blocks: no such person') + WHEN new.owner_kind = 'team' + AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id) + THEN RAISE(ABORT, 'content_blocks: no such team') + WHEN new.owner_kind = 'blog_post' + AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id) + THEN RAISE(ABORT, 'content_blocks: no such blog post') + END; +END; diff --git a/server/src/routes/content.js b/server/src/routes/content.js index 943dbbe..820086a 100644 --- a/server/src/routes/content.js +++ b/server/src/routes/content.js @@ -88,7 +88,8 @@ function loadHosts(db, ids) { const rows = db .prepare( - `SELECT event_id, host_kind, host_id, host_name, host_org_kind + `SELECT event_id, host_kind, host_id, host_name, host_org_kind, + host_team_id, host_team_name FROM v_event_hosts WHERE event_id IN (${marks(ids.length)}) AND host_is_published = 1 @@ -115,6 +116,9 @@ function shapeHost(row) { // Which of /regions, /groups, /partners the slug belongs to. // Null for a person, whose route needs no disambiguating. org_kind: row.host_org_kind, + // The team an organization host is shown as, when one is set + // (and published): the event page names and links it instead. + team: row.host_team_id ? { id: row.host_team_id, name: row.host_team_name } : null, }; } diff --git a/server/src/routes/pages.js b/server/src/routes/pages.js index 7a03596..b6f6f1a 100644 --- a/server/src/routes/pages.js +++ b/server/src/routes/pages.js @@ -21,6 +21,9 @@ the app's own not-found page with a 404 status, so search engines drop it. + A page that moved answers with a 301 to where it is now (MOVED), + so old links, QR codes and search results keep working. + If the metadata can't be built (no site.json at SITE_CONFIG, say), the page is still served, as built, and the cause is logged once: a preview is never worth a page that won't load. @@ -89,12 +92,23 @@ pages.get("/sitemap.xml", (c) => { }); }); +/* Pages that have moved: old path → new, query string kept. */ +const MOVED = { + "/leadership": "/organization", +}; + pages.get("*", (c, next) => { const pathname = c.req.path; // The API's own paths, and an upload that isn't there, stay plain // 404s rather than becoming a page. if (/^\/(api|uploads)(\/|$)/.test(pathname)) return next(); + const moved = MOVED[pathname.replace(/(.)\/+$/, "$1")]; + if (moved) { + const query = new URL(c.req.url).search; + return c.redirect(moved + query, 301); + } + let html; try { html = indexHtml(); diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js index 5f16645..550f6f9 100644 --- a/server/src/seed-showcase.js +++ b/server/src/seed-showcase.js @@ -144,6 +144,10 @@ const ALL_BLOCKS = [ { text: "A card with a picture", detail: "Its description, up to three lines, under the title. The whole card is the link.", url: "/retreats", media: IMAGE }, { text: "An outside link, text only", detail: "The card shows the site it goes to above the title.", url: "https://example.org" }, ]], + ["subheading", { text: "People" }], + ["people", { team_id: TEAM }, [ + { person_id: PERSON, text: "Picked as an item, with a title" }, + ]], ]; /* A record page's body: a handful of types, so it reads like a @@ -426,7 +430,8 @@ tx(db, () => { is_published: 1, is_listed: LISTED, }); - insert("event_hosts", { event_id: PAST, org_id: REGION, sort_order: 0 }); + // Hosted by the region, shown as its team (054). + insert("event_hosts", { event_id: PAST, org_id: REGION, team_id: TEAM, sort_order: 0 }); insert("event_people", { event_id: PAST, person_id: PERSON, role: "host", is_public: 1, sort_order: 0 }); blocks("event", PAST, "card", cardText("past event")); diff --git a/server/src/shape.js b/server/src/shape.js index 5ea0259..4a23395 100644 --- a/server/src/shape.js +++ b/server/src/shape.js @@ -66,7 +66,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") { const blockRows = db .prepare( - `SELECT id, owner_id, type, text, media, href, alt, cite + `SELECT id, owner_id, type, text, media, href, alt, cite, team_id FROM content_blocks WHERE owner_kind = ? AND slot = ? AND owner_id IN (${placeholders(ids.length)}) ORDER BY owner_id, sort_order`, @@ -85,6 +85,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") { href: row.href, alt: row.alt, cite: row.cite, + team_id: row.team_id, items: [], }; byId.set(row.id, block); diff --git a/site.json b/site.json index b8c9bb3..4011a51 100644 --- a/site.json +++ b/site.json @@ -22,9 +22,9 @@ "title": "Community", "description": "Groups, regions and the people who make up Next Generation of Unity." }, - "/leadership": { - "title": "Leadership", - "description": "The board, staff, and volunteers who keep Next Generation of Unity running." + "/organization": { + "title": "Organization", + "description": "Our mission, vision and values, the people who lead Next Generation of Unity, and how to reach us." }, "/resources": { "title": "Resources", diff --git a/src/App.tsx b/src/App.tsx index 9585533..fc432c7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -51,7 +51,7 @@ const lazyPage = (load) => ) const Retreats = lazyPage(() => import("./pages/Retreats.tsx")) const Community = lazyPage(() => import("./pages/Community.tsx")) -const Leadership = lazyPage(() => import("./pages/Leadership.tsx")) +const Organization = lazyPage(() => import("./pages/Organization.tsx")) const Resources = lazyPage(() => import("./pages/Resources.tsx")) const History = lazyPage(() => import("./pages/History.tsx")) const Feedback = lazyPage(() => import("./pages/Feedback.tsx")) @@ -101,7 +101,7 @@ export default function App() { } /> } /> } /> - } /> + } /> } /> } /> } /> diff --git a/src/components/ComingSoon.tsx b/src/components/ComingSoon.tsx index 8e88188..cb1910c 100644 --- a/src/components/ComingSoon.tsx +++ b/src/components/ComingSoon.tsx @@ -7,7 +7,9 @@ some. ═══════════════════════════════════════════════════════════════ */ -const CONTACT = 'info@nextgenerationofunity.org' +import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts' + +const CONTACT = ORGANIZATION_DETAILS.email export default function ComingSoon({ what }: { what: string }) { return ( diff --git a/src/components/ContentBlocks.tsx b/src/components/ContentBlocks.tsx index 0650497..1d53d3a 100644 --- a/src/components/ContentBlocks.tsx +++ b/src/components/ContentBlocks.tsx @@ -27,6 +27,9 @@ cards items as link cards, up to three in a row: text the title, detail, url, media the picture + people team_id's members as people tiles, then + items as more tiles: person, text their + title (an unpublished person is left out) divider nothing "Formatted" is InlineText.tsx: **bold**, *italic*, [text](url), @@ -38,6 +41,7 @@ ═══════════════════════════════════════════════════════════════ */ import { mediaUrl } from '../lib/media.ts' +import PeopleTiles from './PeopleTiles.tsx' import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts' import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx' import VideoPlayer from './VideoPlayer.tsx' @@ -326,6 +330,19 @@ function Block({ block, accent, anchor }: { block: ContentBlock; accent: string; if (!block.items?.length) return null return + case 'people': { + const picked = (block.items ?? []) + .filter((item) => item.person) + .map((item) => ({ peopleslug: item.person!.id, title: item.text || null })) + if (!block.team_id && picked.length === 0) return null + return ( +
+ {block.team_id && } + {picked.length > 0 && } +
+ ) + } + case 'divider': return
diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index d80f19b..a1cc27e 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -2,6 +2,7 @@ import { Link } from "react-router-dom"; import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts"; import siteLogo from "../assets/logos/NGU_Logo.svg"; import PlatformIcon from "./PlatformIcon.tsx"; +import { ORGANIZATION_DETAILS as Organization_Details } from "../data/organizationDetails.ts"; const Social_Links = [ { label: "Instagram", href: "https://www.instagram.com/nextgenerationunity/", platform: "instagram" }, @@ -22,19 +23,9 @@ type TouchLink = { label: string } & ( const Get_In_Touch: TouchLink[] = [ { label: "Feedback", to: "/feedback"}, { label: "Request", to: "/request" }, - { label: "Contact Us", to: "/leadership#contact" }, + { label: "Contact Us", to: "/organization#contact" }, ]; -/* Under the logo. The street address is where NGU is, not where - to send post, and says so. */ -const Organization_Details = { - street: "1901 NW Blue Parkway", - cityLine: "Unity Village, MO 64065", - addressNote: "Physical address, not for mail", - nonprofit: "Next Generation of Unity is a qualified 501(c)(3) nonprofit organization.", - taxId: "33-2819320", -}; - const Footer_Links = [ { label: "Privacy Policy", to: "/privacy" }, { label: "Terms of Service", to: "/terms" }, diff --git a/src/components/OrgContact.tsx b/src/components/OrgContact.tsx new file mode 100644 index 0000000..3df7ebb --- /dev/null +++ b/src/components/OrgContact.tsx @@ -0,0 +1,59 @@ +/* ═══════════════════════════════════════════════════════════════ + ORG CONTACT + + An organization's ways to reach it, as buttons: its action links + filled in its accent, then its website, email and socials + outlined. Nothing at all when it has none. Used on an + organization's page and on the Organization page (NGU's own). + ═══════════════════════════════════════════════════════════════ */ + +import PlatformIcon from './PlatformIcon.tsx' +import type { OrganizationRecord } from '../lib/useContent.ts' +import { accentText } from '../lib/color.ts' + +export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) { + const hasAny = + org.links.length > 0 || org.socials.length > 0 || org.website || org.email + + if (!hasAny) return null + + return ( +
+ {org.links.map((link) => ( + + + {link.label} + + ))} + + {/* website and email arrive as bare strings (splitLinks in + shape.js); socials are whole link rows. */} + {[ + org.website ? { url: org.website, label: 'Website', platform: null } : null, + org.email ? { url: `mailto:${org.email}`, label: org.email, platform: null } : null, + ...org.socials, + ] + .filter((link): link is NonNullable => Boolean(link)) + .map((link) => ( + + + {link.label} + + ))} +
+ ) +} diff --git a/src/components/OrgTeams.tsx b/src/components/OrgTeams.tsx new file mode 100644 index 0000000..c4044c7 --- /dev/null +++ b/src/components/OrgTeams.tsx @@ -0,0 +1,143 @@ +/* ═══════════════════════════════════════════════════════════════ + ORG TEAMS + + An organization's leadership as people tiles, one block per team: + the team's name (linked to its page) and tagline, then its people. + Leadership arrives flat with team_id and team_name on each row, + so grouping costs nothing; `teams` gives the order and lists a + team with nobody in it yet. Used on an organization's page and on + the Organization page (NGU's own Board, Retreat Team and the rest). + ═══════════════════════════════════════════════════════════════ */ + +import { Link } from 'react-router-dom' + +import PeopleTiles from './PeopleTiles.tsx' +import type { Leader, OrganizationRecord } from '../lib/useContent.ts' +import { teamHref } from '../lib/hrefs.ts' +import { mediaUrl } from '../lib/media.ts' +import { accentText } from '../lib/color.ts' + +const BODY = 'var(--color-muted)' + +/* Whether the organization has any leadership to show. */ +export const hasTeams = (org: OrganizationRecord) => groupLeadership(org).length > 0 + +export default function OrgTeams({ org, accent }: { org: OrganizationRecord; accent: string }) { + const teamBlocks = groupLeadership(org) + return ( +
+ {teamBlocks.map((block) => ( +
+
+ {block.teamId ? ( +

+ + {block.label} + +

+ ) : ( + block.label && ( +

+ {block.label} +

+ ) + )} + {block.tagline && ( +

+ {block.tagline} +

+ )} +
+ + {block.people.length > 0 ? ( + ({ + id: leader.person_id, + name: leader.display_name, + title: leader.title, + pronouns: leader.pronouns, + public_email: leader.public_email, + photo: mediaUrl(leader.photo), + is_owner: leader.is_owner, + }))} + /> + ) : ( +

+ No members listed yet. +

+ )} +
+ ))} +
+ ) +} + +/* ── Leadership → team blocks ────────────────────────────────── */ + +type TeamBlock = { + key: string + teamId: string | null + label: string | null + tagline?: string | null + accent?: string | null + people: Leader[] +} + +/* Order comes from `teams` (the admin's sort_order), not from the + order people happen to appear in. Three cases to cover: + affiliations with no team at all, teams with nobody in them, and + people filed under a team that is no longer published. */ +function groupLeadership(org: OrganizationRecord): TeamBlock[] { + const byTeam = new Map() + const loose: Leader[] = [] + + for (const leader of org.leadership) { + if (!leader.team_id) { + loose.push(leader) + continue + } + const list = byTeam.get(leader.team_id) + if (list) list.push(leader) + else byTeam.set(leader.team_id, [leader]) + } + + 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. + if (loose.length > 0) { + blocks.push({ key: 'loose', teamId: null, label: null, people: loose }) + } + + for (const team of org.teams) { + blocks.push({ + key: team.id, + teamId: team.id, + label: team.name, + tagline: team.tagline, + accent: team.color, + people: byTeam.get(team.id) ?? [], + }) + byTeam.delete(team.id) + } + + // Whatever is left is filed under an unpublished team. Its page + // 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({ + key: teamId, + teamId: null, + label: people[0]?.team_name ?? null, + people, + }) + } + + return blocks +} diff --git a/src/components/admin/fields.tsx b/src/components/admin/fields.tsx index 94b50a5..57367e5 100644 --- a/src/components/admin/fields.tsx +++ b/src/components/admin/fields.tsx @@ -163,10 +163,14 @@ export function setPath(object, path, value) { /* ── Conditional fields ──────────────────────────────────────── */ +/* `when: { path, value }` shows a field when the other field holds + that value (or one of a list); `when: { path, filled: true }` when + it holds anything at all. */ export function fieldShown(field, row, parent?) { if (!field.when) return true; - const want = Array.isArray(field.when.value) ? field.when.value : [field.when.value]; const source = field.when.scope === "parent" ? parent : row; + if (field.when.filled) return Boolean(source?.[field.when.path]); + const want = Array.isArray(field.when.value) ? field.when.value : [field.when.value]; return want.includes(source?.[field.when.path]); } diff --git a/src/data/organizationDetails.ts b/src/data/organizationDetails.ts new file mode 100644 index 0000000..6b7b013 --- /dev/null +++ b/src/data/organizationDetails.ts @@ -0,0 +1,17 @@ +/* ═══════════════════════════════════════════════════════════════ + ORGANIZATION DETAILS + + NGU's own address, nonprofit status and contact email, shown in + the footer and in the Organization page's Details & Contact. The + street address is where NGU is, not where to send post, and says + so. + ═══════════════════════════════════════════════════════════════ */ + +export const ORGANIZATION_DETAILS = { + street: '1901 NW Blue Parkway', + cityLine: 'Unity Village, MO 64065', + addressNote: 'Physical address, not for mail', + nonprofit: 'Next Generation of Unity is a qualified 501(c)(3) nonprofit organization.', + taxId: '33-2819320', + email: 'info@nextgenerationofunity.org', +} diff --git a/src/data/requestTypes.ts b/src/data/requestTypes.ts index ef015a2..cf53e47 100644 --- a/src/data/requestTypes.ts +++ b/src/data/requestTypes.ts @@ -32,7 +32,10 @@ export type RequestAction = "new" | "update"; export type RequestField = { key: string; + /** A short title for the field. */ label: string; + /** A line under the title: what it's for, or where it shows. */ + help?: string; input?: "text" | "date" | "url" | "email" | "textarea"; placeholder?: string; to?: { path: string } | { link: "website" | "email" | "action"; label: string } | { block: "card" }; @@ -56,7 +59,7 @@ const STATE: RequestField = { key: "state", label: "State or province", placehol const COUNTRY: RequestField = { key: "country", label: "Country", placeholder: "eg. US", to: { path: "country" } }; const WEBSITE: RequestField = { key: "website", label: "Website", input: "url", placeholder: "https://", to: { link: "website", label: "Website" } }; const EMAIL: RequestField = { key: "email", label: "Contact email", input: "email", to: { link: "email", label: "Email" } }; -const DESCRIPTION: RequestField = { key: "description", label: "Short description", input: "textarea", to: { block: "card" } }; +const DESCRIPTION: RequestField = { key: "description", label: "Short description", help: "A line or two shown on its card in lists and at the top of its page.", input: "textarea", to: { block: "card" } }; export const REQUEST_TYPES: RequestType[] = [ { @@ -68,8 +71,8 @@ export const REQUEST_TYPES: RequestType[] = [ entity: "blog_posts", heading: "title", fields: [ - { key: "author", label: "Author's name, as it should appear", to: { path: "guest_author" } }, - { key: "excerpt", label: "A line or two for the post's card", input: "textarea", to: { path: "excerpt" } }, + { key: "author", label: "Author", help: "Their name as it should appear on the post.", to: { path: "guest_author" } }, + { key: "excerpt", label: "Short description", help: "A line or two shown on the post's preview card, eg. in the Community blog.", input: "textarea", to: { path: "excerpt" } }, ], }, { @@ -100,11 +103,11 @@ export const REQUEST_TYPES: RequestType[] = [ heading: "name", preset: { kind: "group" }, fields: [ - { key: "region", label: "Region it's in", placeholder: "eg. Great Lakes" }, + { key: "region", label: "Region", help: "The Unity region it's part of, if you know it.", placeholder: "eg. Great Lakes" }, CITY, STATE, COUNTRY, - { key: "meets", label: "When it meets", placeholder: "eg. 2nd Sundays, 6:00pm", to: { path: "group.meets" } }, + { key: "meets", label: "Meeting time", placeholder: "eg. 2nd Sundays, 6:00pm", to: { path: "group.meets" } }, WEBSITE, EMAIL, DESCRIPTION, @@ -141,8 +144,8 @@ export const REQUEST_TYPES: RequestType[] = [ entity: "teams", heading: "name", fields: [ - { key: "organization", label: "Which organization it belongs to", placeholder: "eg. NGU national" }, - { key: "tagline", label: "What it does, in a line", to: { path: "tagline" } }, + { key: "organization", label: "Organization", help: "The organization the team belongs to.", placeholder: "eg. NGU national" }, + { key: "tagline", label: "Tagline", help: "What the team does, in a line.", to: { path: "tagline" } }, EMAIL, DESCRIPTION, ], @@ -156,9 +159,9 @@ export const REQUEST_TYPES: RequestType[] = [ entity: "awards", heading: "name", fields: [ - { key: "organization", label: "Who gives it", placeholder: "eg. NGU national" }, + { key: "organization", label: "Given by", help: "The organization that gives the award.", placeholder: "eg. NGU national" }, { key: "description", label: "What it's for", input: "textarea", to: { path: "description" } }, - { key: "recipients", label: "Who received it, and when", input: "textarea" }, + { key: "recipients", label: "Recipients", help: "Who received it, and in which year.", input: "textarea" }, ], }, { @@ -171,7 +174,7 @@ export const REQUEST_TYPES: RequestType[] = [ heading: "display_name", fields: [ { key: "pronouns", label: "Pronouns", placeholder: "eg. she/her", to: { path: "pronouns" } }, - { key: "tagline", label: "Role or title", to: { path: "tagline" } }, + { key: "tagline", label: "Role or title", help: "Shown under their name, eg. Retreat Team Lead.", to: { path: "tagline" } }, CITY, STATE, { key: "email", label: "Public email", input: "email", to: { path: "public_email" } }, diff --git a/src/lib/adminSchema/shared.ts b/src/lib/adminSchema/shared.ts index 9306c28..e994c81 100644 --- a/src/lib/adminSchema/shared.ts +++ b/src/lib/adminSchema/shared.ts @@ -230,6 +230,11 @@ export const linksChild = { The first row supplies the logo and color when the event sets neither, so the order here is data rather than a display choice. + + An organization host can name a team (any organization's) to show + in its place: the event page reads "Hosted by" that team, linked + to its page, while the logo and color still come from the + organization. A person supplies neither: there is no color on a person and a headshot is not a logo, so a person-hosted event with no color of its own falls through to the section default. */ @@ -259,6 +264,15 @@ export const hostsChild = { blankLabel: "Default: none", help: "Use if the host is an individual, choose between person and org host, not both.", }, + { + path: "team_id", + label: "Shown as team", + widget: "select", + optionsFrom: "teams", + blankLabel: "Default: the organization", + help: "Optional: a team to name as the host instead, eg. the retreat team. Any organization's team.", + when: { path: "org_id", filled: true }, + }, ], }; @@ -280,6 +294,7 @@ export const BLOCK_TYPES = [ ["schedule", "Schedule", "Entries in one tab per day, each folding out for more. The text is an optional intro."], ["table", "Table", "A grid of text, eg. a comparison chart: one row per line, cells split by |, the first row the header."], ["cards", "Link cards", "Cards with a picture, title and description, each a link to a page or a file, like a link shared in a chat; up to three in a row. Paste a link and press Fetch preview, or Choose a file."], + ["people", "People", "People tiles: a team's members, or people picked one by one as items (each with their title), or both."], ["divider", "Divider", "A thin line between parts."], ]; @@ -288,6 +303,8 @@ export const SCHEDULE_ENTRY = { scope: "parent", path: "type", value: "schedule" /* Item fields for a link card, and for every other kind of item. */ export const CARD_ITEM = { scope: "parent", path: "type", value: "cards" }; export const NOT_CARD_ITEM = { scope: "parent", path: "type", value: ["list", "links", "schedule"] }; +/* An item that's a person on a people block. */ +export const PEOPLE_ITEM = { scope: "parent", path: "type", value: "people" }; export const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type; @@ -384,13 +401,22 @@ export const blocksChild = { when: { path: "type", value: "image" }, help: "Describes the picture for someone who can't see it, eg. Campers around a fire at dusk", }, + { + path: "team_id", + label: "Team", + widget: "select", + optionsFrom: "teams", + blankLabel: "Default: none, just the people below", + help: "Shows the team's members as tiles, its leads first. People added as items show after it.", + when: { path: "type", value: "people" }, + }, ], children: [ { key: "items", label: "Items", addLabel: "Add item", - when: { path: "type", value: ["list", "links", "schedule", "cards"] }, + when: { path: "type", value: ["list", "links", "schedule", "cards", "people"] }, title: (row) => [row.day, row.time, row.text].filter(Boolean).join(" · ") || "New item", blank: { text: "" }, fields: [ @@ -412,7 +438,16 @@ export const blocksChild = { help: "A page on this site (eg. /retreats), anywhere else, or a file (Choose a file). Fetch preview fills the title, description and picture from a page; a file fills its name and first-page picture.", when: CARD_ITEM, }, - { path: "text", label: "Text", required: true, help: "Schedules: the entry's title. Cards: the card's title" }, + { + path: "person_id", + label: "Person", + widget: "select", + optionsFrom: "people", + required: true, + help: "Shown as a tile with their photo, linked to their page", + when: PEOPLE_ITEM, + }, + { path: "text", label: "Text", required: true, help: "Schedules: the entry's title. Cards: the card's title. People: their title on the tile, eg. Speaker" }, { path: "location", label: "Location", diff --git a/src/lib/site.ts b/src/lib/site.ts index d70f00f..6c223c9 100644 --- a/src/lib/site.ts +++ b/src/lib/site.ts @@ -48,6 +48,9 @@ export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href const PAGES: Record = { ...siteConfiguration.pages, ...fromServer.pages } +/* Every static page's path and text, for the not-found page's suggestions. */ +export const SITE_PAGES: Readonly> = PAGES + /** A static page's title and intro, from site.json's "pages". */ export function sitePage(path: string): PageText { const page = PAGES[path] diff --git a/src/lib/suggest.ts b/src/lib/suggest.ts new file mode 100644 index 0000000..d21cd2b --- /dev/null +++ b/src/lib/suggest.ts @@ -0,0 +1,70 @@ +/* ═══════════════════════════════════════════════════════════════ + SUGGEST: what a mistyped or out-of-date address was probably for + + The not-found page offers the closest pages to the address that + failed. Each candidate (a static page, or a record from + /directory) is scored by how alike its URL ID or name is to the + address's last part, and its full path to the whole address: + the Dice coefficient over letter pairs, so a typo, a missing + hyphen or an old base (/chapters/lynnwood for /groups/lynnwood) + still lands close. Scores run 0 to 1; anything under MIN_SCORE is + a guess not worth showing. + ═══════════════════════════════════════════════════════════════ */ + +export type Candidate = { href: string; label: string; detail?: string; keys: string[] } + +const MIN_SCORE = 0.4 + +/* Lowercase letters and digits only: "Lynnwood-Group" → "lynnwoodgroup". */ +const squash = (text: string) => text.toLowerCase().replace(/[^a-z0-9]/g, '') + +function pairs(text: string): Map { + const out = new Map() + for (let i = 0; i < text.length - 1; i += 1) { + const pair = text.slice(i, i + 2) + out.set(pair, (out.get(pair) ?? 0) + 1) + } + return out +} + +/* Dice coefficient of two strings' letter pairs: 1 is identical. */ +export function likeness(a: string, b: string): number { + const x = squash(a) + const y = squash(b) + if (!x || !y) return 0 + if (x === y) return 1 + if (x.length < 2 || y.length < 2) return 0 + const left = pairs(x) + const right = pairs(y) + let shared = 0 + for (const [pair, count] of left) shared += Math.min(count, right.get(pair) ?? 0) + return (2 * shared) / (x.length - 1 + (y.length - 1)) +} + +function decode(text: string): string { + try { + return decodeURIComponent(text) + } catch { + return text + } +} + +export function suggest(pathname: string, candidates: Candidate[], limit = 5): Candidate[] { + const segments = decode(pathname).split('/').filter(Boolean) + const last = segments.at(-1) ?? '' + const whole = segments.join(' ') + if (!last) return [] + + return candidates + .map((candidate) => ({ + candidate, + score: Math.max( + likeness(whole, candidate.href), + ...candidate.keys.map((key) => likeness(last, key)), + ), + })) + .filter(({ score }) => score >= MIN_SCORE) + .sort((a, b) => b.score - a.score) + .slice(0, limit) + .map(({ candidate }) => candidate) +} diff --git a/src/lib/useContent.ts b/src/lib/useContent.ts index 7656b65..79bc338 100644 --- a/src/lib/useContent.ts +++ b/src/lib/useContent.ts @@ -38,11 +38,14 @@ export type ContentBlock = { | 'schedule' | 'table' | 'cards' + | 'people' text?: string | null media?: string | null href?: string | null /** An image's alt text. */ alt?: string | null + /** A people block's team, shown as its members' tiles. */ + team_id?: string | null /** Who a quote is by. */ cite?: string | null items?: ContentBlockItem[] @@ -84,6 +87,8 @@ export type EventHost = { id: string name: string org_kind?: string | null + /** An organization host's team, shown in its place (054). */ + team?: { id: string; name: string } | null } /* ── Events ──────────────────────────────────────────────────── */ diff --git a/src/lib/version.ts b/src/lib/version.ts index 6a614bc..34e98ec 100644 --- a/src/lib/version.ts +++ b/src/lib/version.ts @@ -7,4 +7,4 @@ box or a build banner can read the same value later. ═══════════════════════════════════════════════════════════════ */ -export const SITE_VERSION = "NGU-Web.v1.10.2"; +export const SITE_VERSION = "NGU-Web.v1.10.3"; diff --git a/src/navConfig.ts b/src/navConfig.ts index e9eead4..db2a596 100644 --- a/src/navConfig.ts +++ b/src/navConfig.ts @@ -5,7 +5,7 @@ export const PAGE_LINKS = [ { label: "Home", path: "/" }, { label: "Retreats", path: "/retreats" }, { label: "Community", path: "/community" }, - { label: "Leadership", path: "/leadership" }, + { label: "Organization", path: "/organization" }, { label: "Resources", path: "/resources" }, { label: "History", path: "/history" }, ]; @@ -31,11 +31,10 @@ export const PAGE_SECTIONS = { { label: "Unity Regions", hash: "#regions" }, { label: "Partner Organizations", hash: "#partners" }, ], - "/leadership": [ - { label: "Board & Staff", hash: "#board-staff" }, - { label: "Retreat Team", hash: "#retreat-team" }, - { label: "Committees & Volunteers", hash: "#committees" }, - { label: "Contact Us", hash: "#contact" }, + "/organization": [ + { label: "Mission & Values", hash: "#mission" }, + { label: "Leadership", hash: "#leadership" }, + { label: "Details & Contact", hash: "#contact" }, ], "/resources": [ { label: "Unity Teachings", hash: "#unity" }, @@ -49,7 +48,7 @@ export const PAGE_SECTIONS = { // Right-side actions. `variant` picks the styling, not the destination. export const NAV_ACTIONS = [ - { label: "Contact Us", to: "/leadership#contact", variant: "ghost" }, + { label: "Contact Us", to: "/organization#contact", variant: "ghost" }, { label: "Give", to: "/give", diff --git a/src/pages/EventDetail.tsx b/src/pages/EventDetail.tsx index 95b40e9..a237a35 100644 --- a/src/pages/EventDetail.tsx +++ b/src/pages/EventDetail.tsx @@ -295,12 +295,14 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) { 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 - is worse than a name. */ + is worse than a name. An organization host with a team set shows + the team instead, linked to the team's page. */ function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) { return ( <> {hosts.map((host, index) => { - const to = refHref(host.kind, host.id, host.org_kind) + const to = host.team ? refHref('team', host.team.id) : refHref(host.kind, host.id, host.org_kind) + const name = host.team?.name ?? host.name return ( @@ -312,10 +314,10 @@ function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) { className="font-medium hover:underline" style={{ color: accentText(accent) }} > - {host.name} + {name} ) : ( - {host.name} + {name} )} ) diff --git a/src/pages/Leadership.tsx b/src/pages/Leadership.tsx deleted file mode 100644 index 37d1692..0000000 --- a/src/pages/Leadership.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import PageShell from "../components/PageShell.tsx"; -import ComingSoon from "../components/ComingSoon.tsx"; -import { sitePage } from "../lib/site.ts"; -import PeopleTiles from "../components/PeopleTiles.tsx"; -import { ACCENTS, BRAND } from "../lib/color.ts" - -/* Title and intro: site.json, which also gives the search metadata. */ -const PAGE = sitePage("/leadership"); - -const SECTIONS = [ - { - id: "board-staff", - title: "Board & Staff", - blurb: "The people guiding Next Generation of Unity day to day.", - accent: BRAND, - content: ( -
- -
- ), - }, - { - id: "retreat-team", - title: "Retreat Team", - blurb: "Volunteers who plan and lead our gatherings throughout the year.", - accent: ACCENTS.green, - content: ( -
- -
- ), - }, - { - id: "committees", - title: "Committees & Volunteers", - blurb: "Additional roles and contributors.", - accent: ACCENTS.amber, - content: , - }, - { - id: "contact", - title: "Contact Us", - blurb: "Reach out to our staff", - accent: ACCENTS.deep, - content: ( - - ), - }, -]; - -export default function Leadership() { - return ( - - ); -} diff --git a/src/pages/NotFound.tsx b/src/pages/NotFound.tsx index 50e724e..70ae336 100644 --- a/src/pages/NotFound.tsx +++ b/src/pages/NotFound.tsx @@ -1,16 +1,133 @@ -import { Link } from "react-router-dom"; +/* ═══════════════════════════════════════════════════════════════ + NOT FOUND: any address no route matches + + Rather than a dead end, the closest pages to the address that + failed: the static pages (site.json's) and every public, listed + record (GET /directory), scored by suggest.ts against the + address. So /organisation offers Organization, /retreat offers + Retreats, and an old /chapters/lynnwood offers the Lynnwood group. + Below them, the main pages to start from. + + The server sends this same page with a 404 status for an unknown + address (routes/pages.js), so search engines drop it. + ═══════════════════════════════════════════════════════════════ */ + +import { ArrowRight } from '@phosphor-icons/react' +import { useMemo } from 'react' +import { Link, useLocation } from 'react-router-dom' + +import PageShell from '../components/PageShell.tsx' +import { PAGE_LINKS } from '../navConfig.ts' +import { SITE_PAGES } from '../lib/site.ts' +import { useDirectory, type Directory } from '../lib/useContent.ts' +import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts' +import { suggest, type Candidate } from '../lib/suggest.ts' +import { ACCENTS, BRAND } from '../lib/color.ts' + +const ORG_KIND_LABEL: Record = { + national: 'Organization', + region: 'Region', + group: 'Group', + partner: 'Partner', +} + +/* Everything an address could have meant: the static pages, then + each kind of record, with the words to match it by. */ +function candidates(directory: Directory | null): Candidate[] { + const pages: Candidate[] = Object.entries(SITE_PAGES).map(([path, page]) => ({ + href: path, + label: page.title, + detail: 'Page', + keys: [path.slice(1), page.title], + })) + if (!directory) return pages + + const record = (href: string, id: string, name: string, detail: string): Candidate => ({ + href, + label: name, + detail, + keys: [id, name], + }) + + return [ + ...pages, + ...directory.events.map((e) => record(eventHref(e.id), e.id, e.name, 'Event')), + ...directory.organizations.map((o) => record(orgHref(o.id, o.kind), o.id, o.name, ORG_KIND_LABEL[o.kind] ?? 'Organization')), + ...directory.teams.map((t) => record(teamHref(t.id), t.id, t.name, `Team, ${t.org_name}`)), + ...directory.awards.map((a) => record(awardHref(a.id), a.id, a.name, 'Award')), + ...directory.people.map((p) => record(personHref(p.id), p.id, p.name, 'Person')), + ...directory.blog_posts.map((b) => record(blogHref(b.id), b.id, b.name, 'Blog post')), + ] +} export default function NotFound() { + const { pathname } = useLocation() + const { data: directory, loading } = useDirectory() + const matches = useMemo(() => suggest(pathname, candidates(directory ?? null)), [pathname, directory]) + return ( -
-

That page isn't here

-

- The link may be out of date.{" "} - - Go to the home page - - . -

-
- ); + + {loading && !directory ? ( +
+ ) : matches.length ? ( +
    + {matches.map((match) => ( +
  • + + + {match.label} + + {match.detail} · {match.href} + + +
  • + ))} +
+ ) : ( +

+ Try one of the main pages below, or the menu at the top. +

+ )} +
+ ), + }, + { + id: 'start', + title: 'Start from', + accent: ACCENTS.green, + content: ( +
+ {PAGE_LINKS.map((page) => ( + + {page.label} + + ))} +
+ ), + }, + ]} + /> + ) } diff --git a/src/pages/Organization.tsx b/src/pages/Organization.tsx new file mode 100644 index 0000000..0d14535 --- /dev/null +++ b/src/pages/Organization.tsx @@ -0,0 +1,136 @@ +/* ═══════════════════════════════════════════════════════════════ + ORGANIZATION: /organization (it was /leadership, which the API + redirects here) + + NGU itself, in three parts: + + mission Mission, Vision & Values: the national organization + record's own description and content blocks (Data → + Organizations → NGU), so editors change them with the + block editor + leadership that record's teams, each with its people (OrgTeams): + the Board of Trustees, the Retreat Team, committees + and volunteers, in the admin's order + contact NGU's address, nonprofit status and email + (src/data/organizationDetails.ts), and the record's + own contact links (OrgContact) + + The record is the one organization of kind national, found rather + than named, so its URL ID can change. + ═══════════════════════════════════════════════════════════════ */ + +import PageShell from '../components/PageShell.tsx' +import ComingSoon from '../components/ComingSoon.tsx' +import ContentBlocks from '../components/ContentBlocks.tsx' +import OrgTeams, { hasTeams } from '../components/OrgTeams.tsx' +import OrgContact from '../components/OrgContact.tsx' +import { sitePage } from '../lib/site.ts' +import { useOrganizations } from '../lib/organizations.ts' +import { useOrganization, type OrganizationRecord } from '../lib/useContent.ts' +import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts' +import { ACCENTS, BRAND } from '../lib/color.ts' + +/* Title and intro: site.json, which also gives the search metadata. */ +const PAGE = sitePage('/organization') + +export default function Organization() { + const national = useOrganizations('national') + const id = national.organizations[0]?.id + const record = useOrganization(id) + const org = record.data ?? null + const failed = national.error || record.error + const loading = !failed && !org && (national.loading || record.loading || Boolean(id)) + + const pending = (what: string) => + failed ? ( +

Couldn’t load {what} right now.

+ ) : loading ? ( +
+
+
+ ) : null + + return ( + , + }, + { + id: 'leadership', + title: 'Leadership', + blurb: 'Our board, retreat team, committees and volunteers.', + accent: ACCENTS.green, + content: + pending('our leadership') ?? + (org && hasTeams(org) ? ( +
+ +
+ ) : ( + + )), + }, + { + id: 'contact', + title: 'Details & Contact', + accent: ACCENTS.deep, + content: , + }, + ]} + /> + ) +} + +function Mission({ org }: { org: OrganizationRecord | null }) { + const paragraphs = org?.description ?? [] + const blocks = org?.blocks ?? [] + if (paragraphs.length === 0 && blocks.length === 0) return + + return ( +
+ {paragraphs.map((paragraph, index) => ( +

+ {paragraph} +

+ ))} +
+ +
+
+ ) +} + +function Contact({ org }: { org: OrganizationRecord | null }) { + const details = ORGANIZATION_DETAILS + return ( +
+
+
+ {details.street} +
+ {details.cityLine} +
+ ({details.addressNote}) +
+

+ {details.nonprofit} Tax ID: {details.taxId}. +

+
+
+ + {details.email} + + {org && } +
+
+ ) +} diff --git a/src/pages/OrganizationDetail.tsx b/src/pages/OrganizationDetail.tsx index 548d0b8..a25d013 100644 --- a/src/pages/OrganizationDetail.tsx +++ b/src/pages/OrganizationDetail.tsx @@ -10,26 +10,23 @@ a region redirects to the canonical path rather than rendering a correct page at a wrong address. - Leadership arrives flat with team_id and team_name on each row, - so grouping costs nothing. `teams` is fetched alongside anyway: - a team with no current public members would otherwise be - invisible here instead of listed, and its page unreachable. + Its leadership, team by team, is OrgTeams (shared with the + Organization page); its contact buttons are OrgContact. ═══════════════════════════════════════════════════════════════ */ import { Link, Navigate, useLocation, useParams } from 'react-router-dom' import PageShell from '../components/PageShell.tsx' import PageState from '../components/PageState.tsx' -import PlatformIcon from '../components/PlatformIcon.tsx' import ContentBlocks from '../components/ContentBlocks.tsx' -import PeopleTiles from '../components/PeopleTiles.tsx' +import OrgTeams, { hasTeams } from '../components/OrgTeams.tsx' +import OrgContact from '../components/OrgContact.tsx' import EventListCards from './sections/EventList-Cards.tsx' import { useOrganization, - type Leader, type OrganizationRecord, } from '../lib/useContent.ts' -import { orgHref, orgListHref, teamHref } from '../lib/hrefs.ts' +import { orgHref, orgListHref } from '../lib/hrefs.ts' import { mediaUrl } from '../lib/media.ts' import { initialsFor } from '../lib/organizations.ts' import Logo from '../components/Logo.tsx' @@ -94,69 +91,20 @@ export default function OrganizationDetail() {
- + ), }, ] - const teamBlocks = groupLeadership(org) - - if (teamBlocks.length > 0) { + if (hasTeams(org)) { sections.push({ id: 'leadership', title: 'Who runs it', accent, content: ( -
- {teamBlocks.map((block) => ( -
-
- {block.teamId ? ( -

- - {block.label} - -

- ) : ( - block.label && ( -

- {block.label} -

- ) - )} - {block.tagline && ( -

- {block.tagline} -

- )} -
- - {block.people.length > 0 ? ( - ({ - id: leader.person_id, - name: leader.display_name, - title: leader.title, - pronouns: leader.pronouns, - public_email: leader.public_email, - photo: mediaUrl(leader.photo), - is_owner: leader.is_owner, - }))} - /> - ) : ( -

- No members listed yet. -

- )} -
- ))} +
+
), }) @@ -308,53 +256,6 @@ function Facts({ ) } -function Contact({ org, accent }: { org: OrganizationRecord; accent: string }) { - const hasAny = - org.links.length > 0 || org.socials.length > 0 || org.website || org.email - - if (!hasAny) return null - - return ( -
- {org.links.map((link) => ( - - - {link.label} - - ))} - - {/* website and email arrive as bare strings (splitLinks in - shape.js); socials are whole link rows. */} - {[ - org.website ? { url: org.website, label: 'Website', platform: null } : null, - org.email ? { url: `mailto:${org.email}`, label: org.email, platform: null } : null, - ...org.socials, - ] - .filter((link): link is NonNullable => Boolean(link)) - .map((link) => ( - - - {link.label} - - ))} -
- ) -} - function GroupMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) { return ( ) } - -/* ── Leadership → team blocks ────────────────────────────────── */ - -type TeamBlock = { - key: string - teamId: string | null - label: string | null - tagline?: string | null - accent?: string | null - people: Leader[] -} - -/* Order comes from `teams` (the admin's sort_order), not from the - order people happen to appear in. Three cases to cover: - affiliations with no team at all, teams with nobody in them, and - people filed under a team that is no longer published. */ -function groupLeadership(org: OrganizationRecord): TeamBlock[] { - const byTeam = new Map() - const loose: Leader[] = [] - - for (const leader of org.leadership) { - if (!leader.team_id) { - loose.push(leader) - continue - } - const list = byTeam.get(leader.team_id) - if (list) list.push(leader) - else byTeam.set(leader.team_id, [leader]) - } - - 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. - if (loose.length > 0) { - blocks.push({ key: 'loose', teamId: null, label: null, people: loose }) - } - - for (const team of org.teams) { - blocks.push({ - key: team.id, - teamId: team.id, - label: team.name, - tagline: team.tagline, - accent: team.color, - people: byTeam.get(team.id) ?? [], - }) - byTeam.delete(team.id) - } - - // Whatever is left is filed under an unpublished team. Its page - // 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({ - key: teamId, - teamId: null, - label: people[0]?.team_name ?? null, - people, - }) - } - - return blocks -} diff --git a/src/pages/PersonDetail.tsx b/src/pages/PersonDetail.tsx index 0db9a56..bb12762 100644 --- a/src/pages/PersonDetail.tsx +++ b/src/pages/PersonDetail.tsx @@ -61,8 +61,8 @@ export default function PersonDetail() { notFound={notFound} onRetry={reload} noun="person" - backTo="/leadership" - backLabel="Leadership" + backTo="/organization" + backLabel="Organization" /> ) } @@ -247,7 +247,7 @@ function Facts({ person, accent }: { person: PersonRecord; accent: string }) { {person.location_label && {person.location_label}} - + Leadership
diff --git a/src/pages/TeamDetail.tsx b/src/pages/TeamDetail.tsx index 0e14430..0e6b6a0 100644 --- a/src/pages/TeamDetail.tsx +++ b/src/pages/TeamDetail.tsx @@ -36,8 +36,8 @@ export default function TeamDetail() { notFound={notFound} onRetry={reload} noun="team" - backTo="/leadership" - backLabel="Leadership" + backTo="/organization" + backLabel="Organization" /> ) } diff --git a/src/pages/sections/RequestForm.tsx b/src/pages/sections/RequestForm.tsx index fad21d2..e42bc0c 100644 --- a/src/pages/sections/RequestForm.tsx +++ b/src/pages/sections/RequestForm.tsx @@ -235,8 +235,10 @@ export default function RequestForm() {
{type.fields.map((f) => { const id = `request-detail-${f.key}`; + const helpId = f.help ? `${id}-help` : undefined; const common = { id, + "aria-describedby": helpId, value: details[f.key] ?? "", placeholder: f.placeholder, maxLength: 2000, @@ -248,6 +250,11 @@ export default function RequestForm() { + {f.help && ( +

+ {f.help} +

+ )} {f.input === "textarea" ? (