Compare commits
5 commits
6f86a113e0
...
bc88b45ee1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc88b45ee1 | ||
|
|
af7e99895a | ||
|
|
79c4b243f5 | ||
|
|
499662b59a | ||
|
|
7c7cdaac14 |
31 changed files with 855 additions and 304 deletions
|
|
@ -268,7 +268,7 @@ The numbers band's "Number Source" dropdown works the same way:
|
||||||
| What | File | Notes |
|
| 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`. |
|
| 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. |
|
| 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. |
|
| 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). |
|
| 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). |
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,7 @@ export const blocksChild = (ownerKind) => ({
|
||||||
"schedule",
|
"schedule",
|
||||||
"table",
|
"table",
|
||||||
"cards",
|
"cards",
|
||||||
|
"people",
|
||||||
],
|
],
|
||||||
{ required: true },
|
{ required: true },
|
||||||
),
|
),
|
||||||
|
|
@ -158,6 +159,8 @@ export const blocksChild = (ownerKind) => ({
|
||||||
url("href"),
|
url("href"),
|
||||||
text("alt"),
|
text("alt"),
|
||||||
text("cite"),
|
text("cite"),
|
||||||
|
// People blocks only (054): whose team's tiles to show.
|
||||||
|
text("team_id"),
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
@ -200,5 +203,6 @@ export const hostsChild = {
|
||||||
table: "event_hosts",
|
table: "event_hosts",
|
||||||
owner: { column: "event_id" },
|
owner: { column: "event_id" },
|
||||||
order: "sort_order",
|
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")],
|
||||||
};
|
};
|
||||||
|
|
|
||||||
140
server/src/migrations/054_people_blocks_host_teams.sql
Normal file
140
server/src/migrations/054_people_blocks_host_teams.sql
Normal file
|
|
@ -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 <team>" 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;
|
||||||
|
|
@ -88,7 +88,8 @@ function loadHosts(db, ids) {
|
||||||
|
|
||||||
const rows = db
|
const rows = db
|
||||||
.prepare(
|
.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
|
FROM v_event_hosts
|
||||||
WHERE event_id IN (${marks(ids.length)})
|
WHERE event_id IN (${marks(ids.length)})
|
||||||
AND host_is_published = 1
|
AND host_is_published = 1
|
||||||
|
|
@ -115,6 +116,9 @@ function shapeHost(row) {
|
||||||
// Which of /regions, /groups, /partners the slug belongs to.
|
// Which of /regions, /groups, /partners the slug belongs to.
|
||||||
// Null for a person, whose route needs no disambiguating.
|
// Null for a person, whose route needs no disambiguating.
|
||||||
org_kind: row.host_org_kind,
|
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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@
|
||||||
the app's own not-found page with a 404 status, so search engines
|
the app's own not-found page with a 404 status, so search engines
|
||||||
drop it.
|
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),
|
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:
|
the page is still served, as built, and the cause is logged once:
|
||||||
a preview is never worth a page that won't load.
|
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) => {
|
pages.get("*", (c, next) => {
|
||||||
const pathname = c.req.path;
|
const pathname = c.req.path;
|
||||||
// The API's own paths, and an upload that isn't there, stay plain
|
// The API's own paths, and an upload that isn't there, stay plain
|
||||||
// 404s rather than becoming a page.
|
// 404s rather than becoming a page.
|
||||||
if (/^\/(api|uploads)(\/|$)/.test(pathname)) return next();
|
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;
|
let html;
|
||||||
try {
|
try {
|
||||||
html = indexHtml();
|
html = indexHtml();
|
||||||
|
|
|
||||||
|
|
@ -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: "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" },
|
{ 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
|
/* A record page's body: a handful of types, so it reads like a
|
||||||
|
|
@ -426,7 +430,8 @@ tx(db, () => {
|
||||||
is_published: 1,
|
is_published: 1,
|
||||||
is_listed: LISTED,
|
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 });
|
insert("event_people", { event_id: PAST, person_id: PERSON, role: "host", is_public: 1, sort_order: 0 });
|
||||||
blocks("event", PAST, "card", cardText("past event"));
|
blocks("event", PAST, "card", cardText("past event"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
||||||
|
|
||||||
const blockRows = db
|
const blockRows = db
|
||||||
.prepare(
|
.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
|
FROM content_blocks
|
||||||
WHERE owner_kind = ? AND slot = ? AND owner_id IN (${placeholders(ids.length)})
|
WHERE owner_kind = ? AND slot = ? AND owner_id IN (${placeholders(ids.length)})
|
||||||
ORDER BY owner_id, sort_order`,
|
ORDER BY owner_id, sort_order`,
|
||||||
|
|
@ -85,6 +85,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
||||||
href: row.href,
|
href: row.href,
|
||||||
alt: row.alt,
|
alt: row.alt,
|
||||||
cite: row.cite,
|
cite: row.cite,
|
||||||
|
team_id: row.team_id,
|
||||||
items: [],
|
items: [],
|
||||||
};
|
};
|
||||||
byId.set(row.id, block);
|
byId.set(row.id, block);
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@
|
||||||
"title": "Community",
|
"title": "Community",
|
||||||
"description": "Groups, regions and the people who make up Next Generation of Unity."
|
"description": "Groups, regions and the people who make up Next Generation of Unity."
|
||||||
},
|
},
|
||||||
"/leadership": {
|
"/organization": {
|
||||||
"title": "Leadership",
|
"title": "Organization",
|
||||||
"description": "The board, staff, and volunteers who keep Next Generation of Unity running."
|
"description": "Our mission, vision and values, the people who lead Next Generation of Unity, and how to reach us."
|
||||||
},
|
},
|
||||||
"/resources": {
|
"/resources": {
|
||||||
"title": "Resources",
|
"title": "Resources",
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ const lazyPage = (load) =>
|
||||||
)
|
)
|
||||||
const Retreats = lazyPage(() => import("./pages/Retreats.tsx"))
|
const Retreats = lazyPage(() => import("./pages/Retreats.tsx"))
|
||||||
const Community = lazyPage(() => import("./pages/Community.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 Resources = lazyPage(() => import("./pages/Resources.tsx"))
|
||||||
const History = lazyPage(() => import("./pages/History.tsx"))
|
const History = lazyPage(() => import("./pages/History.tsx"))
|
||||||
const Feedback = lazyPage(() => import("./pages/Feedback.tsx"))
|
const Feedback = lazyPage(() => import("./pages/Feedback.tsx"))
|
||||||
|
|
@ -101,7 +101,7 @@ export default function App() {
|
||||||
<Route path="/awards/:id" element={<AwardDetail />} />
|
<Route path="/awards/:id" element={<AwardDetail />} />
|
||||||
<Route path="/people/:id" element={<PersonDetail />} />
|
<Route path="/people/:id" element={<PersonDetail />} />
|
||||||
<Route path="/blog/:id" element={<BlogPost />} />
|
<Route path="/blog/:id" element={<BlogPost />} />
|
||||||
<Route path="leadership" element={<Leadership />} />
|
<Route path="organization" element={<Organization />} />
|
||||||
<Route path="resources" element={<Resources />} />
|
<Route path="resources" element={<Resources />} />
|
||||||
<Route path="history" element={<History />} />
|
<Route path="history" element={<History />} />
|
||||||
<Route path="feedback" element={<Feedback />} />
|
<Route path="feedback" element={<Feedback />} />
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@
|
||||||
some.
|
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 }) {
|
export default function ComingSoon({ what }: { what: string }) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@
|
||||||
cards items as link cards, up to three in a row:
|
cards items as link cards, up to three in a row:
|
||||||
text the title, detail, url, media the
|
text the title, detail, url, media the
|
||||||
picture
|
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
|
divider nothing
|
||||||
|
|
||||||
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
|
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
|
||||||
|
|
@ -38,6 +41,7 @@
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { mediaUrl } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
|
import PeopleTiles from './PeopleTiles.tsx'
|
||||||
import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts'
|
import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts'
|
||||||
import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
|
import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
|
||||||
import VideoPlayer from './VideoPlayer.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
|
if (!block.items?.length) return null
|
||||||
return <ScheduleBlock items={block.items} intro={block.text} accent={accent} />
|
return <ScheduleBlock items={block.items} intro={block.text} accent={accent} />
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<div className="space-y-6">
|
||||||
|
{block.team_id && <PeopleTiles size="lg" teams={block.team_id} accent={accent} />}
|
||||||
|
{picked.length > 0 && <PeopleTiles size="lg" people={picked} accent={accent} />}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
case 'divider':
|
case 'divider':
|
||||||
return <hr className="border-0 h-px" style={{ background: accent, opacity: 0.3 }} />
|
return <hr className="border-0 h-px" style={{ background: accent, opacity: 0.3 }} />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import { Link } from "react-router-dom";
|
||||||
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
|
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
|
||||||
import siteLogo from "../assets/logos/NGU_Logo.svg";
|
import siteLogo from "../assets/logos/NGU_Logo.svg";
|
||||||
import PlatformIcon from "./PlatformIcon.tsx";
|
import PlatformIcon from "./PlatformIcon.tsx";
|
||||||
|
import { ORGANIZATION_DETAILS as Organization_Details } from "../data/organizationDetails.ts";
|
||||||
|
|
||||||
const Social_Links = [
|
const Social_Links = [
|
||||||
{ label: "Instagram", href: "https://www.instagram.com/nextgenerationunity/", platform: "instagram" },
|
{ label: "Instagram", href: "https://www.instagram.com/nextgenerationunity/", platform: "instagram" },
|
||||||
|
|
@ -22,19 +23,9 @@ type TouchLink = { label: string } & (
|
||||||
const Get_In_Touch: TouchLink[] = [
|
const Get_In_Touch: TouchLink[] = [
|
||||||
{ label: "Feedback", to: "/feedback"},
|
{ label: "Feedback", to: "/feedback"},
|
||||||
{ label: "Request", to: "/request" },
|
{ 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 = [
|
const Footer_Links = [
|
||||||
{ label: "Privacy Policy", to: "/privacy" },
|
{ label: "Privacy Policy", to: "/privacy" },
|
||||||
{ label: "Terms of Service", to: "/terms" },
|
{ label: "Terms of Service", to: "/terms" },
|
||||||
|
|
|
||||||
59
src/components/OrgContact.tsx
Normal file
59
src/components/OrgContact.tsx
Normal file
|
|
@ -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 (
|
||||||
|
<div className="flex flex-wrap gap-3">
|
||||||
|
{org.links.map((link) => (
|
||||||
|
<a
|
||||||
|
key={link.url}
|
||||||
|
href={link.url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
className="inline-flex items-center gap-2 btn px-5 py-2 text-sm text-white transition-transform hover:scale-105"
|
||||||
|
style={{ background: accent }}
|
||||||
|
>
|
||||||
|
<PlatformIcon platform={link.platform} />
|
||||||
|
{link.label}
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{/* 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<typeof link> => Boolean(link))
|
||||||
|
.map((link) => (
|
||||||
|
<a
|
||||||
|
key={link.url}
|
||||||
|
href={link.url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
className="inline-flex items-center gap-2 btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
|
||||||
|
style={{ borderColor: accent, color: accentText(accent) }}
|
||||||
|
>
|
||||||
|
<PlatformIcon platform={link.platform} />
|
||||||
|
{link.label}
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
143
src/components/OrgTeams.tsx
Normal file
143
src/components/OrgTeams.tsx
Normal file
|
|
@ -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 (
|
||||||
|
<div className="space-y-12">
|
||||||
|
{teamBlocks.map((block) => (
|
||||||
|
<div key={block.key}>
|
||||||
|
<div className="mb-4">
|
||||||
|
{block.teamId ? (
|
||||||
|
<h3 className="text-xl font-bold">
|
||||||
|
<Link
|
||||||
|
to={teamHref(block.teamId)}
|
||||||
|
className="hover:underline"
|
||||||
|
style={{ color: accentText(accent) }}
|
||||||
|
>
|
||||||
|
{block.label}
|
||||||
|
</Link>
|
||||||
|
</h3>
|
||||||
|
) : (
|
||||||
|
block.label && (
|
||||||
|
<h3 className="text-xl font-bold" style={{ color: accentText(accent) }}>
|
||||||
|
{block.label}
|
||||||
|
</h3>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
{block.tagline && (
|
||||||
|
<p className="mt-1 text-sm" style={{ color: BODY }}>
|
||||||
|
{block.tagline}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{block.people.length > 0 ? (
|
||||||
|
<PeopleTiles
|
||||||
|
size="lg"
|
||||||
|
accent={block.accent || accent}
|
||||||
|
people={block.people.map((leader) => ({
|
||||||
|
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,
|
||||||
|
}))}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<p className="text-sm italic" style={{ color: BODY }}>
|
||||||
|
No members listed yet.
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── 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<string, Leader[]>()
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
@ -163,10 +163,14 @@ export function setPath(object, path, value) {
|
||||||
|
|
||||||
/* ── Conditional fields ──────────────────────────────────────── */
|
/* ── 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?) {
|
export function fieldShown(field, row, parent?) {
|
||||||
if (!field.when) return true;
|
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;
|
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]);
|
return want.includes(source?.[field.when.path]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
src/data/organizationDetails.ts
Normal file
17
src/data/organizationDetails.ts
Normal file
|
|
@ -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',
|
||||||
|
}
|
||||||
|
|
@ -32,7 +32,10 @@ export type RequestAction = "new" | "update";
|
||||||
|
|
||||||
export type RequestField = {
|
export type RequestField = {
|
||||||
key: string;
|
key: string;
|
||||||
|
/** A short title for the field. */
|
||||||
label: string;
|
label: string;
|
||||||
|
/** A line under the title: what it's for, or where it shows. */
|
||||||
|
help?: string;
|
||||||
input?: "text" | "date" | "url" | "email" | "textarea";
|
input?: "text" | "date" | "url" | "email" | "textarea";
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
to?: { path: string } | { link: "website" | "email" | "action"; label: string } | { block: "card" };
|
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 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 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 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[] = [
|
export const REQUEST_TYPES: RequestType[] = [
|
||||||
{
|
{
|
||||||
|
|
@ -68,8 +71,8 @@ export const REQUEST_TYPES: RequestType[] = [
|
||||||
entity: "blog_posts",
|
entity: "blog_posts",
|
||||||
heading: "title",
|
heading: "title",
|
||||||
fields: [
|
fields: [
|
||||||
{ key: "author", label: "Author's name, as it should appear", to: { path: "guest_author" } },
|
{ key: "author", label: "Author", help: "Their name as it should appear on the post.", to: { path: "guest_author" } },
|
||||||
{ key: "excerpt", label: "A line or two for the post's card", input: "textarea", to: { path: "excerpt" } },
|
{ 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",
|
heading: "name",
|
||||||
preset: { kind: "group" },
|
preset: { kind: "group" },
|
||||||
fields: [
|
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,
|
CITY,
|
||||||
STATE,
|
STATE,
|
||||||
COUNTRY,
|
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,
|
WEBSITE,
|
||||||
EMAIL,
|
EMAIL,
|
||||||
DESCRIPTION,
|
DESCRIPTION,
|
||||||
|
|
@ -141,8 +144,8 @@ export const REQUEST_TYPES: RequestType[] = [
|
||||||
entity: "teams",
|
entity: "teams",
|
||||||
heading: "name",
|
heading: "name",
|
||||||
fields: [
|
fields: [
|
||||||
{ key: "organization", label: "Which organization it belongs to", placeholder: "eg. NGU national" },
|
{ key: "organization", label: "Organization", help: "The organization the team belongs to.", placeholder: "eg. NGU national" },
|
||||||
{ key: "tagline", label: "What it does, in a line", to: { path: "tagline" } },
|
{ key: "tagline", label: "Tagline", help: "What the team does, in a line.", to: { path: "tagline" } },
|
||||||
EMAIL,
|
EMAIL,
|
||||||
DESCRIPTION,
|
DESCRIPTION,
|
||||||
],
|
],
|
||||||
|
|
@ -156,9 +159,9 @@ export const REQUEST_TYPES: RequestType[] = [
|
||||||
entity: "awards",
|
entity: "awards",
|
||||||
heading: "name",
|
heading: "name",
|
||||||
fields: [
|
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: "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",
|
heading: "display_name",
|
||||||
fields: [
|
fields: [
|
||||||
{ key: "pronouns", label: "Pronouns", placeholder: "eg. she/her", to: { path: "pronouns" } },
|
{ 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,
|
CITY,
|
||||||
STATE,
|
STATE,
|
||||||
{ key: "email", label: "Public email", input: "email", to: { path: "public_email" } },
|
{ key: "email", label: "Public email", input: "email", to: { path: "public_email" } },
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,11 @@ export const linksChild = {
|
||||||
|
|
||||||
The first row supplies the logo and color when the event sets
|
The first row supplies the logo and color when the event sets
|
||||||
neither, so the order here is data rather than a display choice.
|
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
|
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
|
headshot is not a logo, so a person-hosted event with no color
|
||||||
of its own falls through to the section default. */
|
of its own falls through to the section default. */
|
||||||
|
|
@ -259,6 +264,15 @@ export const hostsChild = {
|
||||||
blankLabel: "Default: none",
|
blankLabel: "Default: none",
|
||||||
help: "Use if the host is an individual, choose between person and org host, not both.",
|
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."],
|
["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."],
|
["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."],
|
["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."],
|
["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. */
|
/* 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 CARD_ITEM = { scope: "parent", path: "type", value: "cards" };
|
||||||
export const NOT_CARD_ITEM = { scope: "parent", path: "type", value: ["list", "links", "schedule"] };
|
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;
|
export const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type;
|
||||||
|
|
||||||
|
|
@ -384,13 +401,22 @@ export const blocksChild = {
|
||||||
when: { path: "type", value: "image" },
|
when: { path: "type", value: "image" },
|
||||||
help: "Describes the picture for someone who can't see it, eg. Campers around a fire at dusk",
|
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: [
|
children: [
|
||||||
{
|
{
|
||||||
key: "items",
|
key: "items",
|
||||||
label: "Items",
|
label: "Items",
|
||||||
addLabel: "Add item",
|
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",
|
title: (row) => [row.day, row.time, row.text].filter(Boolean).join(" · ") || "New item",
|
||||||
blank: { text: "" },
|
blank: { text: "" },
|
||||||
fields: [
|
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.",
|
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,
|
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",
|
path: "location",
|
||||||
label: "Location",
|
label: "Location",
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href
|
||||||
|
|
||||||
const PAGES: Record<string, PageText> = { ...siteConfiguration.pages, ...fromServer.pages }
|
const PAGES: Record<string, PageText> = { ...siteConfiguration.pages, ...fromServer.pages }
|
||||||
|
|
||||||
|
/* Every static page's path and text, for the not-found page's suggestions. */
|
||||||
|
export const SITE_PAGES: Readonly<Record<string, PageText>> = PAGES
|
||||||
|
|
||||||
/** A static page's title and intro, from site.json's "pages". */
|
/** A static page's title and intro, from site.json's "pages". */
|
||||||
export function sitePage(path: string): PageText {
|
export function sitePage(path: string): PageText {
|
||||||
const page = PAGES[path]
|
const page = PAGES[path]
|
||||||
|
|
|
||||||
70
src/lib/suggest.ts
Normal file
70
src/lib/suggest.ts
Normal file
|
|
@ -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<string, number> {
|
||||||
|
const out = new Map<string, number>()
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
@ -38,11 +38,14 @@ export type ContentBlock = {
|
||||||
| 'schedule'
|
| 'schedule'
|
||||||
| 'table'
|
| 'table'
|
||||||
| 'cards'
|
| 'cards'
|
||||||
|
| 'people'
|
||||||
text?: string | null
|
text?: string | null
|
||||||
media?: string | null
|
media?: string | null
|
||||||
href?: string | null
|
href?: string | null
|
||||||
/** An image's alt text. */
|
/** An image's alt text. */
|
||||||
alt?: string | null
|
alt?: string | null
|
||||||
|
/** A people block's team, shown as its members' tiles. */
|
||||||
|
team_id?: string | null
|
||||||
/** Who a quote is by. */
|
/** Who a quote is by. */
|
||||||
cite?: string | null
|
cite?: string | null
|
||||||
items?: ContentBlockItem[]
|
items?: ContentBlockItem[]
|
||||||
|
|
@ -84,6 +87,8 @@ export type EventHost = {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
org_kind?: string | null
|
org_kind?: string | null
|
||||||
|
/** An organization host's team, shown in its place (054). */
|
||||||
|
team?: { id: string; name: string } | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Events ──────────────────────────────────────────────────── */
|
/* ── Events ──────────────────────────────────────────────────── */
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,4 @@
|
||||||
box or a build banner can read the same value later.
|
box or a build banner can read the same value later.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
export const SITE_VERSION = "NGU-Web.v1.10.2";
|
export const SITE_VERSION = "NGU-Web.v1.10.3";
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export const PAGE_LINKS = [
|
||||||
{ label: "Home", path: "/" },
|
{ label: "Home", path: "/" },
|
||||||
{ label: "Retreats", path: "/retreats" },
|
{ label: "Retreats", path: "/retreats" },
|
||||||
{ label: "Community", path: "/community" },
|
{ label: "Community", path: "/community" },
|
||||||
{ label: "Leadership", path: "/leadership" },
|
{ label: "Organization", path: "/organization" },
|
||||||
{ label: "Resources", path: "/resources" },
|
{ label: "Resources", path: "/resources" },
|
||||||
{ label: "History", path: "/history" },
|
{ label: "History", path: "/history" },
|
||||||
];
|
];
|
||||||
|
|
@ -31,11 +31,10 @@ export const PAGE_SECTIONS = {
|
||||||
{ label: "Unity Regions", hash: "#regions" },
|
{ label: "Unity Regions", hash: "#regions" },
|
||||||
{ label: "Partner Organizations", hash: "#partners" },
|
{ label: "Partner Organizations", hash: "#partners" },
|
||||||
],
|
],
|
||||||
"/leadership": [
|
"/organization": [
|
||||||
{ label: "Board & Staff", hash: "#board-staff" },
|
{ label: "Mission & Values", hash: "#mission" },
|
||||||
{ label: "Retreat Team", hash: "#retreat-team" },
|
{ label: "Leadership", hash: "#leadership" },
|
||||||
{ label: "Committees & Volunteers", hash: "#committees" },
|
{ label: "Details & Contact", hash: "#contact" },
|
||||||
{ label: "Contact Us", hash: "#contact" },
|
|
||||||
],
|
],
|
||||||
"/resources": [
|
"/resources": [
|
||||||
{ label: "Unity Teachings", hash: "#unity" },
|
{ label: "Unity Teachings", hash: "#unity" },
|
||||||
|
|
@ -49,7 +48,7 @@ export const PAGE_SECTIONS = {
|
||||||
|
|
||||||
// Right-side actions. `variant` picks the styling, not the destination.
|
// Right-side actions. `variant` picks the styling, not the destination.
|
||||||
export const NAV_ACTIONS = [
|
export const NAV_ACTIONS = [
|
||||||
{ label: "Contact Us", to: "/leadership#contact", variant: "ghost" },
|
{ label: "Contact Us", to: "/organization#contact", variant: "ghost" },
|
||||||
{
|
{
|
||||||
label: "Give",
|
label: "Give",
|
||||||
to: "/give",
|
to: "/give",
|
||||||
|
|
|
||||||
|
|
@ -295,12 +295,14 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
|
||||||
sentence, so they're joined with commas and an "and" rather than
|
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
|
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. */
|
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 }) {
|
function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{hosts.map((host, index) => {
|
{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 (
|
return (
|
||||||
<span key={`${host.kind}:${host.id}`}>
|
<span key={`${host.kind}:${host.id}`}>
|
||||||
|
|
@ -312,10 +314,10 @@ function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
|
||||||
className="font-medium hover:underline"
|
className="font-medium hover:underline"
|
||||||
style={{ color: accentText(accent) }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{host.name}
|
{name}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<span className="font-medium">{host.name}</span>
|
<span className="font-medium">{name}</span>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -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: (
|
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
|
||||||
<PeopleTiles size="lg" teams={{ id: "ngu-board",}} />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "retreat-team",
|
|
||||||
title: "Retreat Team",
|
|
||||||
blurb: "Volunteers who plan and lead our gatherings throughout the year.",
|
|
||||||
accent: ACCENTS.green,
|
|
||||||
content: (
|
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
|
||||||
<PeopleTiles size="lg" teams="ngu-retreat-team" />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "committees",
|
|
||||||
title: "Committees & Volunteers",
|
|
||||||
blurb: "Additional roles and contributors.",
|
|
||||||
accent: ACCENTS.amber,
|
|
||||||
content: <ComingSoon what="this list of committees and volunteers" />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "contact",
|
|
||||||
title: "Contact Us",
|
|
||||||
blurb: "Reach out to our staff",
|
|
||||||
accent: ACCENTS.deep,
|
|
||||||
content: (
|
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
|
||||||
<a
|
|
||||||
href="mailto:info@nextgenerationofunity.org"
|
|
||||||
className="inline-block py-2.5 px-6 btn border border-link text-link transition-all duration-200 hover:scale-105 active:scale-[0.98]"
|
|
||||||
>
|
|
||||||
info@nextgenerationofunity.org
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default function Leadership() {
|
|
||||||
return (
|
|
||||||
<PageShell
|
|
||||||
title={PAGE.title}
|
|
||||||
intro={PAGE.description}
|
|
||||||
sections={SECTIONS}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -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<string, string> = {
|
||||||
|
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() {
|
export default function NotFound() {
|
||||||
|
const { pathname } = useLocation()
|
||||||
|
const { data: directory, loading } = useDirectory()
|
||||||
|
const matches = useMemo(() => suggest(pathname, candidates(directory ?? null)), [pathname, directory])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="px-6 py-20">
|
<PageShell
|
||||||
<h1 className="text-4xl font-bold">That page isn't here</h1>
|
title="That page isn’t here"
|
||||||
<p className="mt-4 text-lg">
|
intro="The link may be out of date, or the address may have a typo."
|
||||||
The link may be out of date.{" "}
|
sections={[
|
||||||
<Link to="/" className="underline">
|
{
|
||||||
Go to the home page
|
id: 'suggestions',
|
||||||
|
title: matches.length ? 'Were you looking for' : 'Nothing close by that name',
|
||||||
|
accent: BRAND,
|
||||||
|
content: (
|
||||||
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
|
{loading && !directory ? (
|
||||||
|
<div className="skeleton !min-h-32" aria-label="Looking for similar pages" />
|
||||||
|
) : matches.length ? (
|
||||||
|
<ul className="max-w-2xl divide-y divide-brand/15 bg-raised shadow-sm">
|
||||||
|
{matches.map((match) => (
|
||||||
|
<li key={match.href}>
|
||||||
|
<Link
|
||||||
|
to={match.href}
|
||||||
|
className="group flex items-center gap-4 px-5 py-4 transition-colors hover:bg-tint-soft"
|
||||||
|
>
|
||||||
|
<span className="min-w-0 flex-1">
|
||||||
|
<span className="block font-display font-bold text-ink">{match.label}</span>
|
||||||
|
<span className="block text-sm text-muted">
|
||||||
|
{match.detail} · {match.href}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<ArrowRight
|
||||||
|
className="shrink-0 text-link transition-transform group-hover:translate-x-1"
|
||||||
|
weight="bold"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
.
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
) : (
|
||||||
|
<p className="notice max-w-xl p-6 text-body">
|
||||||
|
Try one of the main pages below, or the menu at the top.
|
||||||
</p>
|
</p>
|
||||||
</section>
|
)}
|
||||||
);
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'start',
|
||||||
|
title: 'Start from',
|
||||||
|
accent: ACCENTS.green,
|
||||||
|
content: (
|
||||||
|
<div className="mx-auto flex max-w-6xl flex-wrap gap-3 px-6">
|
||||||
|
{PAGE_LINKS.map((page) => (
|
||||||
|
<Link
|
||||||
|
key={page.path}
|
||||||
|
to={page.path}
|
||||||
|
className="btn border border-brand/50 px-5 py-2 text-link transition-colors hover:bg-tint"
|
||||||
|
>
|
||||||
|
{page.label}
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
136
src/pages/Organization.tsx
Normal file
136
src/pages/Organization.tsx
Normal file
|
|
@ -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 ? (
|
||||||
|
<p className="mx-auto max-w-6xl px-6 text-danger">Couldn’t load {what} right now.</p>
|
||||||
|
) : loading ? (
|
||||||
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
|
<div className="skeleton !min-h-40" aria-label={`Loading ${what}`} />
|
||||||
|
</div>
|
||||||
|
) : null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageShell
|
||||||
|
title={PAGE.title}
|
||||||
|
intro={PAGE.description}
|
||||||
|
sections={[
|
||||||
|
{
|
||||||
|
id: 'mission',
|
||||||
|
title: 'Mission, Vision & Values',
|
||||||
|
accent: BRAND,
|
||||||
|
content: pending('our mission') ?? <Mission org={org} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'leadership',
|
||||||
|
title: 'Leadership',
|
||||||
|
blurb: 'Our board, retreat team, committees and volunteers.',
|
||||||
|
accent: ACCENTS.green,
|
||||||
|
content:
|
||||||
|
pending('our leadership') ??
|
||||||
|
(org && hasTeams(org) ? (
|
||||||
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
|
<OrgTeams org={org} accent={ACCENTS.green} />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<ComingSoon what="our leadership list" />
|
||||||
|
)),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'contact',
|
||||||
|
title: 'Details & Contact',
|
||||||
|
accent: ACCENTS.deep,
|
||||||
|
content: <Contact org={org} />,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Mission({ org }: { org: OrganizationRecord | null }) {
|
||||||
|
const paragraphs = org?.description ?? []
|
||||||
|
const blocks = org?.blocks ?? []
|
||||||
|
if (paragraphs.length === 0 && blocks.length === 0) return <ComingSoon what="our mission, vision and values" />
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="mx-auto max-w-6xl space-y-6 px-6">
|
||||||
|
{paragraphs.map((paragraph, index) => (
|
||||||
|
<p key={index} className="max-w-3xl text-lg leading-relaxed text-body">
|
||||||
|
{paragraph}
|
||||||
|
</p>
|
||||||
|
))}
|
||||||
|
<div className="max-w-3xl">
|
||||||
|
<ContentBlocks blocks={blocks} accent={BRAND} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Contact({ org }: { org: OrganizationRecord | null }) {
|
||||||
|
const details = ORGANIZATION_DETAILS
|
||||||
|
return (
|
||||||
|
<div className="mx-auto grid max-w-6xl gap-8 px-6 md:grid-cols-2">
|
||||||
|
<div className="space-y-3 text-body">
|
||||||
|
<address className="not-italic leading-relaxed">
|
||||||
|
{details.street}
|
||||||
|
<br />
|
||||||
|
{details.cityLine}
|
||||||
|
<br />
|
||||||
|
<span className="text-sm text-muted">({details.addressNote})</span>
|
||||||
|
</address>
|
||||||
|
<p className="text-sm text-muted">
|
||||||
|
{details.nonprofit} Tax ID: {details.taxId}.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-4">
|
||||||
|
<a
|
||||||
|
href={`mailto:${details.email}`}
|
||||||
|
className="btn inline-block border border-link px-6 py-2.5 text-link transition-colors hover:bg-tint"
|
||||||
|
>
|
||||||
|
{details.email}
|
||||||
|
</a>
|
||||||
|
{org && <OrgContact org={org} accent={ACCENTS.deep} />}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -10,26 +10,23 @@
|
||||||
a region redirects to the canonical path rather than rendering a
|
a region redirects to the canonical path rather than rendering a
|
||||||
correct page at a wrong address.
|
correct page at a wrong address.
|
||||||
|
|
||||||
Leadership arrives flat with team_id and team_name on each row,
|
Its leadership, team by team, is OrgTeams (shared with the
|
||||||
so grouping costs nothing. `teams` is fetched alongside anyway:
|
Organization page); its contact buttons are OrgContact.
|
||||||
a team with no current public members would otherwise be
|
|
||||||
invisible here instead of listed, and its page unreachable.
|
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { Link, Navigate, useLocation, useParams } from 'react-router-dom'
|
import { Link, Navigate, useLocation, useParams } from 'react-router-dom'
|
||||||
|
|
||||||
import PageShell from '../components/PageShell.tsx'
|
import PageShell from '../components/PageShell.tsx'
|
||||||
import PageState from '../components/PageState.tsx'
|
import PageState from '../components/PageState.tsx'
|
||||||
import PlatformIcon from '../components/PlatformIcon.tsx'
|
|
||||||
import ContentBlocks from '../components/ContentBlocks.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 EventListCards from './sections/EventList-Cards.tsx'
|
||||||
import {
|
import {
|
||||||
useOrganization,
|
useOrganization,
|
||||||
type Leader,
|
|
||||||
type OrganizationRecord,
|
type OrganizationRecord,
|
||||||
} from '../lib/useContent.ts'
|
} 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 { mediaUrl } from '../lib/media.ts'
|
||||||
import { initialsFor } from '../lib/organizations.ts'
|
import { initialsFor } from '../lib/organizations.ts'
|
||||||
import Logo from '../components/Logo.tsx'
|
import Logo from '../components/Logo.tsx'
|
||||||
|
|
@ -94,69 +91,20 @@ export default function OrganizationDetail() {
|
||||||
<ContentBlocks blocks={org.blocks} accent={accent} />
|
<ContentBlocks blocks={org.blocks} accent={accent} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Contact org={org} accent={accent} />
|
<OrgContact org={org} accent={accent} />
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const teamBlocks = groupLeadership(org)
|
if (hasTeams(org)) {
|
||||||
|
|
||||||
if (teamBlocks.length > 0) {
|
|
||||||
sections.push({
|
sections.push({
|
||||||
id: 'leadership',
|
id: 'leadership',
|
||||||
title: 'Who runs it',
|
title: 'Who runs it',
|
||||||
accent,
|
accent,
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-12">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
{teamBlocks.map((block) => (
|
<OrgTeams org={org} accent={accent} />
|
||||||
<div key={block.key}>
|
|
||||||
<div className="mb-4">
|
|
||||||
{block.teamId ? (
|
|
||||||
<h3 className="text-xl font-bold">
|
|
||||||
<Link
|
|
||||||
to={teamHref(block.teamId)}
|
|
||||||
className="hover:underline"
|
|
||||||
style={{ color: accentText(accent) }}
|
|
||||||
>
|
|
||||||
{block.label}
|
|
||||||
</Link>
|
|
||||||
</h3>
|
|
||||||
) : (
|
|
||||||
block.label && (
|
|
||||||
<h3 className="text-xl font-bold" style={{ color: accentText(accent) }}>
|
|
||||||
{block.label}
|
|
||||||
</h3>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
{block.tagline && (
|
|
||||||
<p className="mt-1 text-sm" style={{ color: BODY }}>
|
|
||||||
{block.tagline}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{block.people.length > 0 ? (
|
|
||||||
<PeopleTiles
|
|
||||||
size="lg"
|
|
||||||
accent={block.accent || accent}
|
|
||||||
people={block.people.map((leader) => ({
|
|
||||||
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,
|
|
||||||
}))}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<p className="text-sm italic" style={{ color: BODY }}>
|
|
||||||
No members listed yet.
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
@ -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 (
|
|
||||||
<div className="flex flex-wrap gap-3">
|
|
||||||
{org.links.map((link) => (
|
|
||||||
<a
|
|
||||||
key={link.url}
|
|
||||||
href={link.url}
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
className="inline-flex items-center gap-2 btn px-5 py-2 text-sm text-white transition-transform hover:scale-105"
|
|
||||||
style={{ background: accent }}
|
|
||||||
>
|
|
||||||
<PlatformIcon platform={link.platform} />
|
|
||||||
{link.label}
|
|
||||||
</a>
|
|
||||||
))}
|
|
||||||
|
|
||||||
{/* 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<typeof link> => Boolean(link))
|
|
||||||
.map((link) => (
|
|
||||||
<a
|
|
||||||
key={link.url}
|
|
||||||
href={link.url}
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
className="inline-flex items-center gap-2 btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
|
|
||||||
style={{ borderColor: accent, color: accentText(accent) }}
|
|
||||||
>
|
|
||||||
<PlatformIcon platform={link.platform} />
|
|
||||||
{link.label}
|
|
||||||
</a>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function GroupMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) {
|
function GroupMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) {
|
||||||
return (
|
return (
|
||||||
<Logo
|
<Logo
|
||||||
|
|
@ -372,67 +273,3 @@ function GroupMark({ file, name, accent }: { file?: string | null; name: string;
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 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<string, Leader[]>()
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ export default function PersonDetail() {
|
||||||
notFound={notFound}
|
notFound={notFound}
|
||||||
onRetry={reload}
|
onRetry={reload}
|
||||||
noun="person"
|
noun="person"
|
||||||
backTo="/leadership"
|
backTo="/organization"
|
||||||
backLabel="Leadership"
|
backLabel="Organization"
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +247,7 @@ function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||||
|
|
||||||
{person.location_label && <span style={{ color: BODY }}>{person.location_label}</span>}
|
{person.location_label && <span style={{ color: BODY }}>{person.location_label}</span>}
|
||||||
|
|
||||||
<Link to="/leadership" className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
|
<Link to="/organization#leadership" className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
|
||||||
Leadership
|
Leadership
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ export default function TeamDetail() {
|
||||||
notFound={notFound}
|
notFound={notFound}
|
||||||
onRetry={reload}
|
onRetry={reload}
|
||||||
noun="team"
|
noun="team"
|
||||||
backTo="/leadership"
|
backTo="/organization"
|
||||||
backLabel="Leadership"
|
backLabel="Organization"
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -235,8 +235,10 @@ export default function RequestForm() {
|
||||||
<div className="mt-4 grid gap-4 sm:grid-cols-2">
|
<div className="mt-4 grid gap-4 sm:grid-cols-2">
|
||||||
{type.fields.map((f) => {
|
{type.fields.map((f) => {
|
||||||
const id = `request-detail-${f.key}`;
|
const id = `request-detail-${f.key}`;
|
||||||
|
const helpId = f.help ? `${id}-help` : undefined;
|
||||||
const common = {
|
const common = {
|
||||||
id,
|
id,
|
||||||
|
"aria-describedby": helpId,
|
||||||
value: details[f.key] ?? "",
|
value: details[f.key] ?? "",
|
||||||
placeholder: f.placeholder,
|
placeholder: f.placeholder,
|
||||||
maxLength: 2000,
|
maxLength: 2000,
|
||||||
|
|
@ -248,6 +250,11 @@ export default function RequestForm() {
|
||||||
<label htmlFor={id} className="block text-sm font-medium text-body">
|
<label htmlFor={id} className="block text-sm font-medium text-body">
|
||||||
{f.label}
|
{f.label}
|
||||||
</label>
|
</label>
|
||||||
|
{f.help && (
|
||||||
|
<p id={helpId} className="mt-0.5 text-xs" style={{ color: MUTED }}>
|
||||||
|
{f.help}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
{f.input === "textarea" ? (
|
{f.input === "textarea" ? (
|
||||||
<textarea {...common} rows={3} onChange={(e) => set(e.target.value)} className={`mt-2 resize-y ${fieldClass}`} />
|
<textarea {...common} rows={3} onChange={(e) => set(e.target.value)} className={`mt-2 resize-y ${fieldClass}`} />
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -298,8 +305,10 @@ export default function RequestForm() {
|
||||||
<OptionalTag />
|
<OptionalTag />
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 max-w-prose text-sm" style={{ color: MUTED }}>
|
<p className="mt-1 max-w-prose text-sm" style={{ color: MUTED }}>
|
||||||
A Word document (.docx) with the details or the post itself, photos (JPEG or PNG) or a PDF. Up to{" "}
|
Why a file: a blog post sent as a Word document (.docx) can be imported straight onto the site, its
|
||||||
{MAX_FILES}, {MAX_FILE_MB} MB each.
|
headings, lists, tables and links as written, so nothing needs retyping. For anything else, a document
|
||||||
|
with the details, photos (JPEG or PNG) or a PDF saves us asking. Up to {MAX_FILES} files,{" "}
|
||||||
|
{MAX_FILE_MB} MB each.
|
||||||
</p>
|
</p>
|
||||||
<input
|
<input
|
||||||
id="request-files"
|
id="request-files"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue