Call local chapters groups, everywhere
The organization kind is 'group', its side table is groups, pages live at /groups/<id> and the Community page's section is #groups. Migration 052 converts existing databases: the kind and the tables whose CHECKs name chapters are rebuilt, the front page count and request category follow, and the site's own /chapters/ and #chapters links in records are rewritten. Request files now go in Requests/Groups on the shared drive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
175a18976d
commit
38aff34c97
42 changed files with 473 additions and 254 deletions
|
|
@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||
|
||||
# NGU-Web
|
||||
|
||||
Website for NGU (Next Generation of Unity), a Unity movement organization with regional chapters in the US and internationally. Full-stack app with a public site and a role-based admin panel.
|
||||
Website for NGU (Next Generation of Unity), a Unity movement organization with regional groups in the US and internationally. Full-stack app with a public site and a role-based admin panel.
|
||||
|
||||
## Stack
|
||||
- Frontend: React, TypeScript, Tailwind CSS, React Router, Vite (in `src/`)
|
||||
|
|
@ -22,7 +22,7 @@ Backend (`server/`, Node >= 22.13). The server reads `HOST` (default `127.0.0.1`
|
|||
- `DB_PATH=./dev.db pnpm dev`: run with `node --watch`
|
||||
- `DB_PATH=./dev.db pnpm migrate`: apply migrations without starting the server
|
||||
- `DB_PATH=./dev.db node src/admin-cli.js add|list|passwd|role|disable|enable ...`: the only way accounts are created
|
||||
- `DB_PATH=./dev.db node src/seed-showcase.js [--listed]`: writes fully filled test records (a region, chapter, team, award, person, three events and a blog post with every content block type), ids starting `showcase-`, for checking pages. Unlisted unless `--listed`. Refuses a database under /var/lib/ngu unless `--production` is also given.
|
||||
- `DB_PATH=./dev.db node src/seed-showcase.js [--listed]`: writes fully filled test records (a region, group, team, award, person, three events and a blog post with every content block type), ids starting `showcase-`, for checking pages. Unlisted unless `--listed`. Refuses a database under /var/lib/ngu unless `--production` is also given.
|
||||
|
||||
In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API must listen on that port.
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
|
|||
- **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names.
|
||||
- **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface.
|
||||
- **Colours are tokens, not hex.** Admins can override any token (Panel → Site settings → Colours). The defaults are `server/src/themeDefaults.js` plus the same values as CSS in `src/index.css`; the build fails if they differ (`themeDefaultsCheck` in `vite.config.ts`), and migration 041's CHECK lists the token names. Use the utilities from `src/index.css` (`text-ink`, `text-body`, `text-muted`, `text-link`, `bg-surface`, `bg-tint`, `bg-action`, `border-brand/20`...) so dark mode works; a literal only for something that must look the same in both modes (white on a dark band, a platform's colour). Data colours (accents, event and region colours) go through `withAlpha`, `accentText` and `readableOn` in `src/lib/color.ts`, never `${color}55`.
|
||||
- **Icons are Phosphor** (`@phosphor-icons/react`), weight `bold` (or `fill` for play/star). No hand-drawn `<svg>` icons and no Unicode glyphs as icons (× › ▶ →). Brand marks are the exception: `DoveMark`, `PlatformIcon`, the Google logo, the chapter map.
|
||||
- **Icons are Phosphor** (`@phosphor-icons/react`), weight `bold` (or `fill` for play/star). No hand-drawn `<svg>` icons and no Unicode glyphs as icons (× › ▶ →). Brand marks are the exception: `DoveMark`, `PlatformIcon`, the Google logo, the group map.
|
||||
- **Accents come from `src/lib/color.ts`:** `BRAND` (the teal, via the button token so the admin palette reaches it) and `ACCENTS` (deep, green, mint). Not a new hex in a page.
|
||||
- **No em-dashes** (U+2014) anywhere: UI text, help text, comments, docs, commit messages. Use a colon, comma or parentheses. An empty table cell shows `-`.
|
||||
- **Admin editor text:** blank select options read `Default: …` (what blank means), examples in help text start with `eg.`, and record ids are called "URL ID". Cut-off preview text uses `preview()` from `src/lib/text.ts`, which ends it with an ellipsis. See `docs/updating-data-in-code.md`.
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ hand.
|
|||
|
||||
| Folder | Used by | Set in |
|
||||
| --- | --- | --- |
|
||||
| `Requests/<type>` | Files sent with the Request form, a folder per type (`Requests/Chapters`, `Requests/Blog Posts`...) | `DRIVE_FOLDER` and `TYPE_FOLDERS` in `server/src/routes/requests.js` |
|
||||
| `Requests/<type>` | Files sent with the Request form, a folder per type (`Requests/Groups`, `Requests/Blog Posts`...) | `DRIVE_FOLDER` and `TYPE_FOLDERS` in `server/src/routes/requests.js` |
|
||||
| `Media` and folders in it | Files for pages to link to (Tools → Media → Files), in folders you make there | `FOLDER` in `server/src/routes/files.js` |
|
||||
|
||||
A new use calls `driveUpload("<Folder>", name, mime, bytes)` from
|
||||
|
|
|
|||
|
|
@ -165,9 +165,9 @@ also in `server/src/admin-schema/` and a CHECK):
|
|||
|
||||
| Entity → field | Stored values | Labelled? | Also used on the public site by |
|
||||
| --- | --- | --- | --- |
|
||||
| Organizations → Kind (+ list filter) | national, region, chapter, partner | no, shows values | `ORG_BASE` in `src/lib/hrefs.ts` (the route each kind uses) and `orgListHref` there (its back link) |
|
||||
| Organizations → Kind (+ list filter) | national, region, group, partner | no, shows values | `ORG_BASE` in `src/lib/hrefs.ts` (the route each kind uses) and `orgListHref` there (its back link) |
|
||||
| Organizations → Region → Scope | domestic, international, virtual | no | the Community page groups regions by it |
|
||||
| Organizations → Region areas → Edge | top, bottom | no | the chapter map (`OrgList-Map.tsx`) |
|
||||
| Organizations → Region areas → Edge | top, bottom | no | the group map (`OrgList-Map.tsx`) |
|
||||
| Events → Type (+ list filter) | retreat, class, workshop, meeting, other | no | `EVENT_TYPES` in `src/lib/eventTypes.ts` (public labels and plurals) |
|
||||
| Events → Status (+ list filter) | upcoming, past, cancelled | no | `STATUS_LABEL` in `src/pages/EventDetail.tsx` |
|
||||
| Events → Series → Repeats | weekly, monthly_date, monthly_weekday | **yes** | `src/lib/eventSeries.ts` |
|
||||
|
|
@ -197,7 +197,7 @@ code):
|
|||
|
||||
| Dropdown | `optionsFrom` | Comes from |
|
||||
| --- | --- | --- |
|
||||
| Chapter → Region | `regions` | organizations of kind region |
|
||||
| Group → Region | `regions` | organizations of kind region |
|
||||
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) |
|
||||
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labelled by name |
|
||||
| Event hosts / event people / team members / timeline people → Person | `people` | people |
|
||||
|
|
@ -271,7 +271,7 @@ The numbers band's "Number Source" dropdown works the same way:
|
|||
| Section titles, blurbs and colours 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`. |
|
||||
| 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. |
|
||||
| Chapter 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). |
|
||||
| Feedback form types | `src/data/feedbackTypes.ts` **and** `TYPES` in `server/src/routes/feedback.js` | Keep the ids identical in both; the server stores unknown ids as `general`. Labels and hints are client-only. `DATA_REQUEST` ('privacy') isn't a tile: the Privacy page's form sends it, and the server requires an email for it. |
|
||||
| Request form types (what `/request` can ask for) | `src/data/requestTypes.ts` **and** `CATEGORIES` in `server/src/routes/requests.js` **and** the CHECK on `feedback.category` (`046_content_requests.sql`) | Ids and allowed actions (new, update) identical in all three; a new id needs a migration. Labels, hints, the name field's question and each type's `fields` (the details it asks for, and where each lands in the admin editor: a field path, a link row or a description paragraph) are client-only: the server stores whatever detail keys come as JSON (`feedback.details`, 049), so adding a field needs no migration. A button to the form opened on one type: `request: { type, label }` on a section manifest entry, or `<RequestLink>` (`src/components/RequestLink.tsx`). |
|
||||
| The site's colours, light and dark | the database over `src/index.css` | Admin → Panel → Site settings → Colours (superadmins): pick a colour, set its light and/or dark value; saving refuses anything that makes text hard to read. The defaults are `THEME_DEFAULTS` in `server/src/themeDefaults.js` (the admin and the contrast check read it) and the same values as CSS in `src/index.css`; the build stops if the two differ. The admin's labels for them are `THEME_LABELS` in `src/lib/adminSchema/siteSettings.ts`. Change a token's value in both modes and every use follows. Use the token utilities (`text-muted`, `bg-surface`, `border-brand/20`) or `var(--color-…)`, not hex. A colour that arrives as data (a page accent, an event's or region's colour) goes through `src/lib/color.ts`: `withAlpha` for tints, `accentText` for text in it, `readableOn` for text on it. |
|
||||
|
|
@ -280,7 +280,7 @@ The numbers band's "Number Source" dropdown works the same way:
|
|||
| Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
|
||||
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
||||
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
||||
| Organization kind labels ("Region", "Chapter") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin); `orgListHref` in `src/lib/hrefs.ts` (the public back link, "All regions") | |
|
||||
| Organization kind labels ("Region", "Group") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin); `orgListHref` in `src/lib/hrefs.ts` (the public back link, "All regions") | |
|
||||
| Admin account roles | `src/lib/roles.ts` (labels, notes) and `ROLES` in `server/src/auth.js` | Adding a role is also a CHECK change on `admin_users.role`. |
|
||||
| Admin navigation | `src/pages/admin/adminNav.ts` | |
|
||||
| The live site's address (used by QR codes) | `SITE_ORIGIN` in `src/lib/site.ts` | |
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
columns writable columns of the parent row
|
||||
extensions 1:1 side tables, optionally gated on a column
|
||||
value (organizations.kind decides whether a
|
||||
regions or chapters row should exist)
|
||||
regions or groups row should exist)
|
||||
children ordered collections, replaced wholesale on save
|
||||
singleton the one id this entity ever has; the engine
|
||||
refuses create and delete (see front_page)
|
||||
|
|
@ -86,7 +86,7 @@ export const OPTION_QUERIES = {
|
|||
// dropdowns of which four are always wrong. The timeline and the
|
||||
// featured cards both pick from it. `kind` is the discriminator
|
||||
// the client's filterBy matches on; org_kind disambiguates the label,
|
||||
// since a region and a chapter can share a name.
|
||||
// since a region and a group can share a name.
|
||||
record_refs: `
|
||||
SELECT 'event' AS kind, id, title AS label FROM events
|
||||
UNION ALL
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ export const frontPage = {
|
|||
"manual",
|
||||
"years_since",
|
||||
"regions",
|
||||
"chapters",
|
||||
"groups",
|
||||
"partners",
|
||||
"events_held",
|
||||
"retreats_held",
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export const organizations = {
|
|||
},
|
||||
|
||||
columns: [
|
||||
enumeration("kind", ["national", "region", "chapter", "partner"], {
|
||||
enumeration("kind", ["national", "region", "group", "partner"], {
|
||||
required: true,
|
||||
}),
|
||||
text("name", { required: true }),
|
||||
|
|
@ -58,10 +58,10 @@ export const organizations = {
|
|||
],
|
||||
},
|
||||
{
|
||||
key: "chapter",
|
||||
table: "chapters",
|
||||
key: "group",
|
||||
table: "groups",
|
||||
idColumn: "id",
|
||||
when: { column: "kind", value: "chapter" },
|
||||
when: { column: "kind", value: "group" },
|
||||
columns: [text("region_id"), text("meets"), text("started")],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ async function findOrMakeFolder(path) {
|
|||
const walked = [];
|
||||
for (const name of path.split("/").filter(Boolean)) {
|
||||
// Each level on the way is known too: "Requests" once
|
||||
// "Requests/Chapters" has been found.
|
||||
// "Requests/Groups" has been found.
|
||||
if (walked.length && !folders.has(walked.join("/"))) folders.set(walked.join("/"), Promise.resolve(parent));
|
||||
walked.push(name);
|
||||
const quoted = name.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
||||
|
|
|
|||
219
server/src/migrations/052_groups.sql
Normal file
219
server/src/migrations/052_groups.sql
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 052 CHAPTERS BECOME GROUPS
|
||||
--
|
||||
-- Local chapters are called groups now, everywhere: the kind value,
|
||||
-- the side table, the front page count, the Request form's type, the
|
||||
-- pages (/groups/<id>, the Community page's #groups section).
|
||||
--
|
||||
-- organizations.kind 'chapter' → 'group' (CHECK changes, so
|
||||
-- the table is rebuilt as 045 did, then
|
||||
-- its indexes and triggers again)
|
||||
-- chapters renamed groups, its index with it
|
||||
-- front_page_stats.source 'chapters' → 'groups' (rebuilt), and
|
||||
-- the seeded "Chapters" label
|
||||
-- feedback.category 'chapter' → 'group' (a column CHECK
|
||||
-- only, so a new column replaces it)
|
||||
-- links in records the site's own /chapters/ and
|
||||
-- #chapters links, in link columns and
|
||||
-- [text](url) formatting
|
||||
--
|
||||
-- Names and prose written in the admin (an organization called
|
||||
-- "Lynnwood Chapter", a post's paragraph) are left as written.
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
-- ── organizations.kind ─────────────────────────────────────────
|
||||
|
||||
CREATE TABLE organizations_new (
|
||||
id TEXT PRIMARY KEY, -- slug: 'northwest', 'lynnwood'
|
||||
kind TEXT NOT NULL
|
||||
CHECK (kind IN ('national', 'region', 'group', 'partner')),
|
||||
|
||||
name TEXT NOT NULL,
|
||||
short_name TEXT,
|
||||
tagline TEXT, -- one line, for the card
|
||||
color TEXT,
|
||||
logo TEXT, -- an upload's filename
|
||||
|
||||
venue TEXT,
|
||||
address TEXT,
|
||||
locality TEXT,
|
||||
state_code TEXT, -- US only
|
||||
country TEXT NOT NULL DEFAULT 'US',
|
||||
location_label TEXT,
|
||||
latitude REAL,
|
||||
longitude REAL,
|
||||
is_online INTEGER NOT NULL DEFAULT 0 CHECK (is_online IN (0, 1)),
|
||||
|
||||
is_published INTEGER NOT NULL DEFAULT 1 CHECK (is_published IN (0, 1)),
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
in_timeline INTEGER NOT NULL DEFAULT 0 CHECK (in_timeline IN (0, 1)),
|
||||
is_listed INTEGER NOT NULL DEFAULT 1 CHECK (is_listed IN (0, 1))
|
||||
) STRICT;
|
||||
|
||||
INSERT INTO organizations_new
|
||||
(id, kind, name, short_name, tagline, color, logo,
|
||||
venue, address, locality, state_code, country, location_label,
|
||||
latitude, longitude, is_online,
|
||||
is_published, sort_order, created_at, updated_at, in_timeline, is_listed)
|
||||
SELECT id, CASE kind WHEN 'chapter' THEN 'group' ELSE kind END,
|
||||
name, short_name, tagline, color, logo,
|
||||
venue, address, locality, state_code, country, location_label,
|
||||
latitude, longitude, is_online,
|
||||
is_published, sort_order, created_at, updated_at, in_timeline, is_listed
|
||||
FROM organizations;
|
||||
|
||||
PRAGMA legacy_alter_table = ON;
|
||||
DROP TABLE organizations;
|
||||
ALTER TABLE organizations_new RENAME TO organizations;
|
||||
PRAGMA legacy_alter_table = OFF;
|
||||
|
||||
CREATE INDEX organizations_kind_idx ON organizations (kind, is_published, sort_order);
|
||||
CREATE INDEX organizations_state_idx ON organizations (state_code);
|
||||
|
||||
|
||||
-- ── chapters → groups ──────────────────────────────────────────
|
||||
|
||||
ALTER TABLE chapters RENAME TO groups;
|
||||
DROP INDEX chapters_region_idx;
|
||||
CREATE INDEX groups_region_idx ON groups (region_id);
|
||||
|
||||
|
||||
-- ── front_page_stats.source ────────────────────────────────────
|
||||
|
||||
CREATE TABLE front_page_stats_new (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
page_id TEXT NOT NULL REFERENCES front_page (id) ON DELETE CASCADE,
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
label TEXT NOT NULL,
|
||||
source TEXT NOT NULL DEFAULT 'manual'
|
||||
CHECK (source IN ('manual', 'years_since', 'regions', 'groups',
|
||||
'partners', 'events_held', 'retreats_held',
|
||||
'people', 'awards_given')),
|
||||
value TEXT,
|
||||
suffix TEXT, -- '+', 'k', ' states'
|
||||
note TEXT
|
||||
) STRICT;
|
||||
|
||||
INSERT INTO front_page_stats_new
|
||||
(id, page_id, sort_order, label, source, value, suffix, note)
|
||||
SELECT id, page_id, sort_order,
|
||||
CASE label WHEN 'Chapters' THEN 'Groups' ELSE label END,
|
||||
CASE source WHEN 'chapters' THEN 'groups' ELSE source END,
|
||||
value, suffix, note
|
||||
FROM front_page_stats;
|
||||
|
||||
PRAGMA legacy_alter_table = ON;
|
||||
DROP TABLE front_page_stats;
|
||||
ALTER TABLE front_page_stats_new RENAME TO front_page_stats;
|
||||
PRAGMA legacy_alter_table = OFF;
|
||||
|
||||
|
||||
-- ── feedback.category ──────────────────────────────────────────
|
||||
|
||||
ALTER TABLE feedback ADD COLUMN category_new TEXT
|
||||
CHECK (category_new IN ('blog', 'event', 'group', 'region', 'partner', 'team', 'award', 'person'));
|
||||
UPDATE feedback SET category_new = CASE category WHEN 'chapter' THEN 'group' ELSE category END;
|
||||
ALTER TABLE feedback DROP COLUMN category;
|
||||
ALTER TABLE feedback RENAME COLUMN category_new TO category;
|
||||
|
||||
UPDATE feedback SET section_id = 'groups' WHERE section_id = 'chapters';
|
||||
UPDATE feedback SET page_path = '/groups/' || substr(page_path, 11)
|
||||
WHERE page_path LIKE '/chapters/%';
|
||||
|
||||
|
||||
-- ── Seeded text ────────────────────────────────────────────────
|
||||
|
||||
UPDATE front_page_path_actions SET description = 'Groups and regions across the country.'
|
||||
WHERE description = 'Chapters and regions across the country.';
|
||||
|
||||
UPDATE affiliations SET title = replace(replace(title, 'Chapter', 'Group'), 'chapter', 'group')
|
||||
WHERE title LIKE '%chapter%';
|
||||
|
||||
|
||||
-- ── The site's own links ───────────────────────────────────────
|
||||
-- A link to one of our group pages or the Community page's section:
|
||||
-- '/chapters/<id>', '/community#chapters', or either on our domain.
|
||||
-- Someone else's site with a /chapters/ path is left alone.
|
||||
|
||||
UPDATE links SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR url LIKE '%/community#chapters' OR url = '#chapters';
|
||||
|
||||
UPDATE content_block_items SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR url LIKE '%/community#chapters' OR url = '#chapters';
|
||||
|
||||
UPDATE content_blocks SET href = replace(replace(href, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE href LIKE '/chapters/%' OR href LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR href LIKE '%/community#chapters' OR href = '#chapters';
|
||||
|
||||
UPDATE featured_cards SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR url LIKE '%/community#chapters' OR url = '#chapters';
|
||||
|
||||
UPDATE timeline_entries SET link_url = replace(replace(link_url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE link_url LIKE '/chapters/%' OR link_url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR link_url LIKE '%/community#chapters' OR link_url = '#chapters';
|
||||
|
||||
UPDATE front_page_slides SET link_url = replace(replace(link_url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE link_url LIKE '/chapters/%' OR link_url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR link_url LIKE '%/community#chapters' OR link_url = '#chapters';
|
||||
|
||||
UPDATE front_page_path_actions SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR url LIKE '%/community#chapters' OR url = '#chapters';
|
||||
|
||||
UPDATE front_page SET primary_url = replace(replace(primary_url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE primary_url LIKE '/chapters/%' OR primary_url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR primary_url LIKE '%/community#chapters' OR primary_url = '#chapters';
|
||||
|
||||
UPDATE front_page SET secondary_url = replace(replace(secondary_url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE secondary_url LIKE '/chapters/%' OR secondary_url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR secondary_url LIKE '%/community#chapters' OR secondary_url = '#chapters';
|
||||
|
||||
-- [text](url) formatting in block and item text.
|
||||
UPDATE content_blocks
|
||||
SET text = replace(replace(replace(text, '](/chapters/', '](/groups/'),
|
||||
'](/community#chapters)', '](/community#groups)'),
|
||||
'nextgenerationofunity.org/chapters/', 'nextgenerationofunity.org/groups/')
|
||||
WHERE text LIKE '%](/chapters/%' OR text LIKE '%](/community#chapters)%'
|
||||
OR text LIKE '%nextgenerationofunity.org/chapters/%';
|
||||
|
||||
UPDATE content_block_items
|
||||
SET text = replace(replace(replace(text, '](/chapters/', '](/groups/'),
|
||||
'](/community#chapters)', '](/community#groups)'),
|
||||
'nextgenerationofunity.org/chapters/', 'nextgenerationofunity.org/groups/')
|
||||
WHERE text LIKE '%](/chapters/%' OR text LIKE '%](/community#chapters)%'
|
||||
OR text LIKE '%nextgenerationofunity.org/chapters/%';
|
||||
|
||||
|
||||
-- ── Triggers last (see CLAUDE.md, Migrations) ──
|
||||
-- Dropping organizations took its own triggers with it.
|
||||
|
||||
CREATE TRIGGER organizations_cleanup
|
||||
AFTER DELETE ON organizations
|
||||
BEGIN
|
||||
DELETE FROM content_blocks WHERE owner_kind = 'organization' AND owner_id = old.id;
|
||||
DELETE FROM links WHERE owner_kind = 'organization' AND owner_id = old.id;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER timeline_organizations_cleanup
|
||||
AFTER DELETE ON organizations
|
||||
BEGIN
|
||||
DELETE FROM timeline_entries WHERE ref_kind = 'organization' AND ref_id = old.id;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER organizations_featured_cleanup
|
||||
AFTER DELETE ON organizations
|
||||
BEGIN
|
||||
DELETE FROM featured_cards WHERE ref_kind = 'organization' AND ref_id = old.id;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER organizations_touch
|
||||
AFTER UPDATE ON organizations
|
||||
FOR EACH ROW WHEN new.updated_at = old.updated_at
|
||||
BEGIN
|
||||
UPDATE organizations SET updated_at = datetime('now') WHERE id = new.id;
|
||||
END;
|
||||
|
|
@ -169,7 +169,7 @@ function firstParagraph(db, ownerKind, id, slot) {
|
|||
|
||||
/* ── One page ──────────────────────────────────────────────── */
|
||||
|
||||
const ORG_ROUTES = { region: "/regions", chapter: "/chapters", partner: "/partners", national: "/organizations" };
|
||||
const ORG_ROUTES = { region: "/regions", group: "/groups", partner: "/partners", national: "/organizations" };
|
||||
|
||||
function defaults(site, db, pathname) {
|
||||
const home = db.prepare(`SELECT headline, subhead FROM front_page WHERE id = 'home'`).get();
|
||||
|
|
@ -388,7 +388,7 @@ export function metaFor(db, rawPath) {
|
|||
return { ...meta, title: titled(site, page.title), description: plainText(page.description) ?? meta.description };
|
||||
}
|
||||
|
||||
const match = pathname.match(/^\/(events|regions|chapters|partners|organizations|teams|awards|people|blog)\/([^/]+)$/);
|
||||
const match = pathname.match(/^\/(events|regions|groups|partners|organizations|teams|awards|people|blog)\/([^/]+)$/);
|
||||
if (!match) return notFound(meta);
|
||||
|
||||
const [, base, rawId] = match;
|
||||
|
|
@ -404,8 +404,8 @@ export function metaFor(db, rawPath) {
|
|||
return eventMeta(site, db, id, meta);
|
||||
case "regions":
|
||||
return organizationMeta(site, db, id, "region", meta);
|
||||
case "chapters":
|
||||
return organizationMeta(site, db, id, "chapter", meta);
|
||||
case "groups":
|
||||
return organizationMeta(site, db, id, "group", meta);
|
||||
case "partners":
|
||||
return organizationMeta(site, db, id, "partner", meta);
|
||||
case "organizations":
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
GET /events list + the event scopes
|
||||
GET /events/:id one event, full body, people
|
||||
GET /organizations list, ?kind=region|chapter|…
|
||||
GET /organizations list, ?kind=region|group|…
|
||||
GET /organizations/:id one organization's page
|
||||
GET /teams list, ?org=slug
|
||||
GET /teams/:id one team's page
|
||||
|
|
@ -11,13 +11,13 @@
|
|||
GET /awards/:id one award and its recipients
|
||||
|
||||
Organizations are one table, so they're one endpoint. A region
|
||||
and a chapter differ by a handful of fields, which arrive under
|
||||
and a group differ by a handful of fields, which arrive under
|
||||
`details` rather than as separate routes, that's what lets a
|
||||
list component be written once and pointed at any kind.
|
||||
|
||||
The lists leave out unlisted records (is_listed = 0); the
|
||||
detail routes don't, since reaching one by its link is the
|
||||
point. A region's chapters and an organization's events, teams
|
||||
point. A region's groups and an organization's events, teams
|
||||
and awards are lists too. See 027_listed.sql.
|
||||
|
||||
Responses carry their fallbacks already resolved: an event's
|
||||
|
|
@ -70,7 +70,7 @@ const content = new Hono();
|
|||
// anything. stale-while-revalidate keeps the page instant while the
|
||||
// refresh happens behind it.
|
||||
|
||||
const ORG_KINDS = ["national", "region", "chapter", "partner"];
|
||||
const ORG_KINDS = ["national", "region", "group", "partner"];
|
||||
|
||||
/* ── Loaders ───────────────────────────────────────────────── */
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ function shapeHost(row) {
|
|||
kind: row.host_kind, // 'organization' | 'person'
|
||||
id: row.host_id,
|
||||
name: row.host_name,
|
||||
// Which of /regions, /chapters, /partners the slug belongs to.
|
||||
// Which of /regions, /groups, /partners the slug belongs to.
|
||||
// Null for a person, whose route needs no disambiguating.
|
||||
org_kind: row.host_org_kind,
|
||||
};
|
||||
|
|
@ -264,11 +264,11 @@ function attachRegionDetails(db, orgs) {
|
|||
)
|
||||
.all(...ids);
|
||||
|
||||
// A region's chapters, enough of each for a list entry.
|
||||
// A region's groups, enough of each for a list entry.
|
||||
const children = db
|
||||
.prepare(
|
||||
`SELECT c.region_id, o.id, o.name, o.location_label, o.logo
|
||||
FROM chapters c
|
||||
FROM groups c
|
||||
JOIN organizations o ON o.id = c.id AND o.is_published = 1 AND o.is_listed = 1
|
||||
WHERE c.region_id IN (${marks(ids.length)})
|
||||
ORDER BY o.sort_order, o.name`,
|
||||
|
|
@ -309,20 +309,20 @@ function attachRegionDetails(db, orgs) {
|
|||
scope: byId[org.id]?.scope ?? null,
|
||||
map_note: byId[org.id]?.map_note ?? null,
|
||||
areas: areasBy.get(org.id) ?? [],
|
||||
chapters: childrenBy.get(org.id) ?? [],
|
||||
groups: childrenBy.get(org.id) ?? [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function attachChapterDetails(db, orgs) {
|
||||
const ids = orgs.filter((o) => o.kind === "chapter").map((o) => o.id);
|
||||
function attachGroupDetails(db, orgs) {
|
||||
const ids = orgs.filter((o) => o.kind === "group").map((o) => o.id);
|
||||
if (ids.length === 0) return;
|
||||
|
||||
const rows = db
|
||||
.prepare(
|
||||
`SELECT c.id, c.region_id, c.meets, c.started,
|
||||
r.name AS region_name, r.color AS region_color
|
||||
FROM chapters c
|
||||
FROM groups c
|
||||
LEFT JOIN organizations r ON r.id = c.region_id
|
||||
WHERE c.id IN (${marks(ids.length)})`,
|
||||
)
|
||||
|
|
@ -331,7 +331,7 @@ function attachChapterDetails(db, orgs) {
|
|||
const byId = Object.fromEntries(rows.map((r) => [r.id, r]));
|
||||
|
||||
for (const org of orgs) {
|
||||
if (org.kind !== "chapter") continue;
|
||||
if (org.kind !== "group") continue;
|
||||
const row = byId[org.id] ?? {};
|
||||
org.details = {
|
||||
region_id: row.region_id ?? null,
|
||||
|
|
@ -539,7 +539,7 @@ content.get("/events/:id", (c) => {
|
|||
/* ── Organizations ─────────────────────────────────────────────
|
||||
GET /organizations every published, listed org
|
||||
GET /organizations?kind=region one kind
|
||||
GET /organizations?kind=region,chapter
|
||||
GET /organizations?kind=region,group
|
||||
|
||||
Whatever the kind, the common card fields are in the same
|
||||
places, so a list component reads `name`, `color`, `logo` and
|
||||
|
|
@ -584,13 +584,13 @@ content.get("/organizations", (c) => {
|
|||
);
|
||||
|
||||
attachRegionDetails(db, organizations);
|
||||
attachChapterDetails(db, organizations);
|
||||
attachGroupDetails(db, organizations);
|
||||
attachLeadership(db, organizations);
|
||||
|
||||
return json(c, { organizations });
|
||||
});
|
||||
|
||||
/* One organization's page: region, chapter, partner or NGU. */
|
||||
/* One organization's page: region, group, partner or NGU. */
|
||||
content.get("/organizations/:id", (c) => {
|
||||
const db = c.get("db");
|
||||
const id = c.req.param("id");
|
||||
|
|
@ -607,7 +607,7 @@ content.get("/organizations/:id", (c) => {
|
|||
const one = [organization];
|
||||
|
||||
attachRegionDetails(db, one);
|
||||
attachChapterDetails(db, one);
|
||||
attachGroupDetails(db, one);
|
||||
attachLeadership(db, one);
|
||||
attachTeams(db, one);
|
||||
attachAwards(db, one);
|
||||
|
|
@ -637,8 +637,8 @@ content.get("/organizations/:id", (c) => {
|
|||
GET /teams/:id one team's page
|
||||
|
||||
An unpublished organization hides its teams too, in both
|
||||
routes. Without that join a retired chapter's board stays
|
||||
reachable by URL after the chapter itself has gone.
|
||||
routes. Without that join a retired group's board stays
|
||||
reachable by URL after the group itself has gone.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
|
||||
content.get("/teams", (c) => {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
One flat list per kind, each row just enough to name a record
|
||||
and build its URL: id and name, plus the organization's kind,
|
||||
which decides whether its page is /regions, /chapters or
|
||||
which decides whether its page is /regions, /groups or
|
||||
/partners. The QR code page reads it to offer "any page on the
|
||||
site" without five list requests carrying descriptions, links
|
||||
and blocks it would throw away.
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ feedback.post("/", async (c) => {
|
|||
const email = clean(body.email, LIMITS.email);
|
||||
const message = clean(body.message, LIMITS.message);
|
||||
const pagePath = clean(body.pagePath, LIMITS.pagePath);
|
||||
// The picker holds nav hashes ('#chapters'); the column holds ids.
|
||||
// The picker holds nav hashes ('#groups'); the column holds ids.
|
||||
const sectionId = clean(body.sectionId, LIMITS.sectionId).replace(/^#/, "");
|
||||
const feedbackType = TYPES.includes(body.feedbackType)
|
||||
? body.feedbackType
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
v_timeline has already done the resolution: an entry with no title
|
||||
of its own carries the referenced record's name, an entry with no
|
||||
date carries the event's starts_on, and org_kind rides along
|
||||
because /regions, /chapters and /partners are three routes and only
|
||||
because /regions, /groups and /partners are three routes and only
|
||||
the database knows which a slug is.
|
||||
|
||||
What's left here is shaping, and three things the view can't do:
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ const PAGE_ID = "home";
|
|||
|
||||
const STAT_QUERIES = {
|
||||
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`,
|
||||
chapters: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'chapter' AND is_published = 1 AND is_listed = 1`,
|
||||
groups: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'group' AND is_published = 1 AND is_listed = 1`,
|
||||
partners: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'partner' AND is_published = 1 AND is_listed = 1`,
|
||||
events_held: `SELECT COUNT(*) AS n FROM v_events
|
||||
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
REQUEST ROUTE: POST /api/requests
|
||||
|
||||
The Request form (/request): a blog post, an event, or a new or
|
||||
updated chapter, region, partner, team, award or person, with up
|
||||
updated group, region, partner, team, award or person, with up
|
||||
to MAX_FILES attachments. Stored as a feedback row of type
|
||||
'content' (046_content_requests.sql), files in Google Drive.
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ const requests = new Hono();
|
|||
const CATEGORIES = {
|
||||
blog: ["new"],
|
||||
event: ["new", "update"],
|
||||
chapter: ["new", "update"],
|
||||
group: ["new", "update"],
|
||||
region: ["update"],
|
||||
partner: ["new", "update"],
|
||||
team: ["new", "update"],
|
||||
|
|
@ -64,12 +64,12 @@ export function cleanDetails(raw) {
|
|||
}
|
||||
const MIN_MESSAGE = 10;
|
||||
// Where in the shared drive the files go (googleService.js): a
|
||||
// folder per type under Requests, eg. Requests/Chapters.
|
||||
// folder per type under Requests, eg. Requests/Groups.
|
||||
export const DRIVE_FOLDER = "Requests";
|
||||
export const TYPE_FOLDERS = {
|
||||
blog: "Blog Posts",
|
||||
event: "Events",
|
||||
chapter: "Chapters",
|
||||
group: "Groups",
|
||||
region: "Regions",
|
||||
partner: "Partners",
|
||||
team: "Teams",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
exercises all of it:
|
||||
|
||||
/regions/showcase-region region: areas, map note, links, blocks
|
||||
/chapters/showcase-chapter chapter: meets, started, region
|
||||
/groups/showcase-group group: meets, started, region
|
||||
/teams/showcase-team team: a lead and members
|
||||
/awards/showcase-award award: recipients, one at an event
|
||||
/people/showcase-person person: bio, links, roles past and
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
Published but unlisted by default: every page above works, and
|
||||
none of it shows in the site's lists, counts, map or QR page.
|
||||
One consequence: a region's page lists only listed chapters,
|
||||
One consequence: a region's page lists only listed groups,
|
||||
teams, awards and events, so the showcase region's are empty.
|
||||
--listed lists everything instead, and
|
||||
adds timeline entries, so the Community map, Retreats bands,
|
||||
|
|
@ -71,7 +71,7 @@ const IMAGE = "/uploads/showcase.jpg";
|
|||
const POST_ID = "content-block-showcase";
|
||||
|
||||
const REGION = "showcase-region";
|
||||
const CHAPTER = "showcase-chapter";
|
||||
const GROUP = "showcase-group";
|
||||
const TEAM = "showcase-team";
|
||||
const AWARD = "showcase-award";
|
||||
const PERSON = "showcase-person";
|
||||
|
|
@ -229,7 +229,7 @@ tx(db, () => {
|
|||
db.prepare(`DELETE FROM affiliations WHERE person_id LIKE 'showcase-%' OR org_id LIKE 'showcase-%'`).run();
|
||||
db.prepare(`DELETE FROM teams WHERE id LIKE 'showcase-%'`).run();
|
||||
db.prepare(`DELETE FROM people WHERE id LIKE 'showcase-%'`).run();
|
||||
db.prepare(`DELETE FROM organizations WHERE id = ?`).run(CHAPTER);
|
||||
db.prepare(`DELETE FROM organizations WHERE id = ?`).run(GROUP);
|
||||
db.prepare(`DELETE FROM organizations WHERE id LIKE 'showcase-%'`).run();
|
||||
|
||||
/* ── Organizations ── */
|
||||
|
|
@ -256,11 +256,11 @@ tx(db, () => {
|
|||
blocks("organization", REGION, "body", pageBody("region"));
|
||||
|
||||
insert("organizations", {
|
||||
id: CHAPTER,
|
||||
kind: "chapter",
|
||||
name: "Showcase Chapter",
|
||||
id: GROUP,
|
||||
kind: "group",
|
||||
name: "Showcase Group",
|
||||
short_name: "Showcase Ch.",
|
||||
tagline: "A chapter with every field filled in",
|
||||
tagline: "A group with every field filled in",
|
||||
color: "#138ba0",
|
||||
logo: IMAGE,
|
||||
...place,
|
||||
|
|
@ -270,10 +270,10 @@ tx(db, () => {
|
|||
is_listed: LISTED,
|
||||
sort_order: 99,
|
||||
});
|
||||
insert("chapters", { id: CHAPTER, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" });
|
||||
links("organization", CHAPTER, standardLinks("Showcase Chapter"));
|
||||
blocks("organization", CHAPTER, "card", cardText("chapter"));
|
||||
blocks("organization", CHAPTER, "body", pageBody("chapter"));
|
||||
insert("groups", { id: GROUP, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" });
|
||||
links("organization", GROUP, standardLinks("Showcase Group"));
|
||||
blocks("organization", GROUP, "card", cardText("group"));
|
||||
blocks("organization", GROUP, "body", pageBody("group"));
|
||||
|
||||
/* ── People ── */
|
||||
insert("people", {
|
||||
|
|
@ -290,7 +290,7 @@ tx(db, () => {
|
|||
country: "US",
|
||||
location_label: "Exampletown, PA",
|
||||
bio: "Showcase Person is test data. This bio has two paragraphs so the page's spacing can be checked.\n\nThe second paragraph. Everything about this person is made up by seed-showcase.js.",
|
||||
primary_org_id: CHAPTER,
|
||||
primary_org_id: GROUP,
|
||||
is_published: 1,
|
||||
is_listed: LISTED,
|
||||
});
|
||||
|
|
@ -343,7 +343,7 @@ tx(db, () => {
|
|||
blocks("team", TEAM, "body", pageBody("team"));
|
||||
|
||||
insert("affiliations", { person_id: PERSON, org_id: REGION, team_id: TEAM, title: "Showcase Team Lead", role: "lead", is_owner: 1, started_on: "2023-01-01", is_public: 1, sort_order: 0 });
|
||||
insert("affiliations", { person_id: PERSON, org_id: CHAPTER, title: "Former Chapter Coordinator", role: "volunteer", started_on: "2021-01-01", ended_on: "2022-12-31", is_public: 1, sort_order: 1 });
|
||||
insert("affiliations", { person_id: PERSON, org_id: GROUP, title: "Former Group Coordinator", role: "volunteer", started_on: "2021-01-01", ended_on: "2022-12-31", is_public: 1, sort_order: 1 });
|
||||
MEMBERS.forEach((id, i) =>
|
||||
insert("affiliations", { person_id: id, org_id: REGION, team_id: TEAM, title: ["Treasurer", "Secretary", null][i], role: i === 2 ? "member" : "board", is_public: 1, sort_order: i + 1 }),
|
||||
);
|
||||
|
|
@ -409,7 +409,7 @@ tx(db, () => {
|
|||
is_published: 1,
|
||||
is_listed: LISTED,
|
||||
});
|
||||
insert("event_hosts", { event_id: SERIES, org_id: CHAPTER, sort_order: 0 });
|
||||
insert("event_hosts", { event_id: SERIES, org_id: GROUP, sort_order: 0 });
|
||||
links("event", SERIES, [{ kind: "action", label: "Join on Zoom", url: "https://example.org/zoom" }]);
|
||||
blocks("event", SERIES, "card", cardText("series"));
|
||||
|
||||
|
|
@ -489,7 +489,7 @@ db.close();
|
|||
console.log(`✓ Showcase written (${LISTED ? "listed" : "unlisted: pages only"}):`);
|
||||
for (const path of [
|
||||
`/regions/${REGION}`,
|
||||
`/chapters/${CHAPTER}`,
|
||||
`/groups/${GROUP}`,
|
||||
`/teams/${TEAM}`,
|
||||
`/awards/${AWARD}`,
|
||||
`/people/${PERSON}`,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
},
|
||||
"/community": {
|
||||
"title": "Community",
|
||||
"description": "Chapters, 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": {
|
||||
"title": "Leadership",
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
},
|
||||
"/resources": {
|
||||
"title": "Resources",
|
||||
"description": "Teachings, brand assets, and material for chapters and partners."
|
||||
"description": "Teachings, brand assets, and material for groups and partners."
|
||||
},
|
||||
"/history": {
|
||||
"title": "History",
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
},
|
||||
"/request": {
|
||||
"title": "Request",
|
||||
"description": "Ask for a blog post, an event, or a new or updated chapter, region, partner, team, award or person on the site."
|
||||
"description": "Ask for a blog post, an event, or a new or updated group, region, partner, team, award or person on the site."
|
||||
},
|
||||
"/qr": {
|
||||
"title": "QR Codes",
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import RequireRole from "./pages/admin/RequireRole.tsx"
|
|||
// Home is the landing page, so it ships in the main bundle. Every
|
||||
// other page, and all of the admin, is fetched when first visited:
|
||||
// a visitor to the front page never downloads the admin, the QR
|
||||
// encoder, the calendar or the chapter map. Layout and AdminLayout
|
||||
// encoder, the calendar or the group map. Layout and AdminLayout
|
||||
// wrap their <Outlet /> in <Suspense>, so the header stays put while
|
||||
// a page loads.
|
||||
import Home from "./pages/Home.tsx"
|
||||
|
|
@ -94,7 +94,7 @@ export default function App() {
|
|||
<Route path="/events/:id" element={<EventDetail />} />
|
||||
<Route path="community" element={<Community />} />
|
||||
<Route path="/regions/:id" element={<OrganizationDetail />} />
|
||||
<Route path="/chapters/:id" element={<OrganizationDetail />} />
|
||||
<Route path="/groups/:id" element={<OrganizationDetail />} />
|
||||
<Route path="/partners/:id" element={<OrganizationDetail />} />
|
||||
<Route path="/organizations/:id" element={<OrganizationDetail />} />
|
||||
<Route path="/teams/:id" element={<TeamDetail />} />
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
An organization's logo, or its initials in a square in its colour
|
||||
when there's no file or it fails to load. Decorative: the name is
|
||||
always right beside it. Used by the organization lists and the
|
||||
chapter map.
|
||||
group map.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import Logo from './Logo.tsx'
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
{
|
||||
id: "local", // matches the nav hash, #local
|
||||
|
||||
title: "Local Chapters",
|
||||
title: "Local Groups",
|
||||
blurb: "Optional line under the section heading.",
|
||||
accent: BRAND, // heading, banner, rule
|
||||
background: "var(--color-tint)",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
The three ways a detail page can fail to be a detail page. All
|
||||
four of them need the same thing, and it should be the same thing:
|
||||
a visitor who hits a dead retreat link and a dead chapter link
|
||||
a visitor who hits a dead retreat link and a dead group link
|
||||
shouldn't get two different pages.
|
||||
|
||||
Rendered inside PageShell so the chrome doesn't flicker in and
|
||||
|
|
@ -33,7 +33,7 @@ export default function PageState({
|
|||
error: string | null
|
||||
notFound: boolean
|
||||
onRetry: () => void
|
||||
/** Lowercase, as it appears mid-sentence: "retreat", "chapter". */
|
||||
/** Lowercase, as it appears mid-sentence: "retreat", "group". */
|
||||
noun: string
|
||||
backTo: string
|
||||
backLabel: string
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
MAP GRID
|
||||
|
||||
Pure layout. Where each tile sits, what it's called, and how to
|
||||
work out which tile a chapter belongs to. None of this is in the
|
||||
work out which tile a group belongs to. None of this is in the
|
||||
database because none of it changes, Rhode Island will not be
|
||||
moving, and no admin form should offer to move it.
|
||||
|
||||
|
|
@ -83,27 +83,27 @@ export const AREAS = Object.freeze([
|
|||
|
||||
export const AREA_BY_CODE = Object.fromEntries(AREAS.map((a) => [a.code, a]));
|
||||
|
||||
/* ── Which tile a chapter sits on ──────────────────────────────
|
||||
/* ── Which tile a group sits on ──────────────────────────────
|
||||
The database stores a real address, state_code for US, and a
|
||||
country code otherwise, rather than a tile name. This is the
|
||||
one place that translates between the two, so adding a Mexico
|
||||
band later means a line here and nothing in SQL.
|
||||
|
||||
Returns null for anything with no tile, which covers virtual
|
||||
chapters and any country not drawn.
|
||||
groups and any country not drawn.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
const COUNTRY_AREA = {
|
||||
CA: "CANADA", // ISO country code, not California
|
||||
};
|
||||
|
||||
export function areaForChapter(chapter) {
|
||||
if (!chapter) return null;
|
||||
if (chapter.is_online) return null;
|
||||
export function areaForGroup(group) {
|
||||
if (!group) return null;
|
||||
if (group.is_online) return null;
|
||||
|
||||
if (chapter.country === "US") {
|
||||
return AREA_BY_CODE[chapter.state_code] ? chapter.state_code : null;
|
||||
if (group.country === "US") {
|
||||
return AREA_BY_CODE[group.state_code] ? group.state_code : null;
|
||||
}
|
||||
return COUNTRY_AREA[chapter.country] ?? null;
|
||||
return COUNTRY_AREA[group.country] ?? null;
|
||||
}
|
||||
|
||||
/* ── Slices per tile ───────────────────────────────────────────
|
||||
|
|
@ -146,13 +146,13 @@ export function buildAreaSlices(regionAreas: any[] = [], regions: any[] = []) {
|
|||
return byArea;
|
||||
}
|
||||
|
||||
/* ── Chapter counts per tile ───────────────────────────────────
|
||||
/* ── Group counts per tile ───────────────────────────────────
|
||||
{ WA: 2, MO: 1, CANADA: 1 }
|
||||
───────────────────────────────────────────────────────────── */
|
||||
export function countChaptersByArea(chapters: any[] = []) {
|
||||
export function countGroupsByArea(groups: any[] = []) {
|
||||
const counts = {};
|
||||
for (const chapter of chapters) {
|
||||
const code = areaForChapter(chapter);
|
||||
for (const group of groups) {
|
||||
const code = areaForGroup(group);
|
||||
if (code) counts[code] = (counts[code] ?? 0) + 1;
|
||||
}
|
||||
return counts;
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
CATEGORIES in server/src/routes/requests.js (and the CHECK in
|
||||
046_content_requests.sql); keep them in step.
|
||||
|
||||
A link can open the form on one: requestLink("chapter") is
|
||||
/request?type=chapter. People, teams and awards have no buttons on
|
||||
A link can open the form on one: requestLink("group") is
|
||||
/request?type=group. People, teams and awards have no buttons on
|
||||
the site, but are here to pick.
|
||||
|
||||
`fields` are the details the form asks for on top of the name and
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
name, which the admin picks by hand
|
||||
|
||||
`entity` is the admin record it becomes, `preset` the values a new
|
||||
one starts with (a chapter is an organization of kind chapter), and
|
||||
one starts with (a group is an organization of kind group), and
|
||||
`heading` the editor field the request's name fills.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
@ -91,20 +91,20 @@ export const REQUEST_TYPES: RequestType[] = [
|
|||
],
|
||||
},
|
||||
{
|
||||
id: "chapter",
|
||||
label: "Chapter",
|
||||
hint: "A local NGU chapter",
|
||||
id: "group",
|
||||
label: "Group",
|
||||
hint: "A local NGU group",
|
||||
actions: ["new", "update"],
|
||||
subject: "The chapter's name",
|
||||
subject: "The group's name",
|
||||
entity: "organizations",
|
||||
heading: "name",
|
||||
preset: { kind: "chapter" },
|
||||
preset: { kind: "group" },
|
||||
fields: [
|
||||
{ key: "region", label: "Region it's in", placeholder: "eg. Great Lakes" },
|
||||
CITY,
|
||||
STATE,
|
||||
COUNTRY,
|
||||
{ key: "meets", label: "When it meets", placeholder: "eg. 2nd Sundays, 6:00pm", to: { path: "chapter.meets" } },
|
||||
{ key: "meets", label: "When it meets", placeholder: "eg. 2nd Sundays, 6:00pm", to: { path: "group.meets" } },
|
||||
WEBSITE,
|
||||
EMAIL,
|
||||
DESCRIPTION,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const STAT_SOURCES = [
|
|||
["manual", "Print Value Field"],
|
||||
["years_since", "Years Since Value"],
|
||||
["regions", "Count: regions"],
|
||||
["chapters", "Count: chapters"],
|
||||
["groups", "Count: groups"],
|
||||
["partners", "Count: partners"],
|
||||
["events_held", "Count: past events"],
|
||||
["retreats_held", "Count: past retreats"],
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export const organizations = {
|
|||
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||
],
|
||||
filters: [
|
||||
{ key: "kind", label: "Kind", options: ["national", "region", "chapter", "partner"] },
|
||||
{ key: "kind", label: "Kind", options: ["national", "region", "group", "partner"] },
|
||||
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||
],
|
||||
|
|
@ -34,7 +34,7 @@ export const organizations = {
|
|||
path: "kind",
|
||||
label: "Kind",
|
||||
widget: "select",
|
||||
options: ["national", "region", "chapter", "partner"],
|
||||
options: ["national", "region", "group", "partner"],
|
||||
required: true,
|
||||
help: "Changing this swaps which extra fields apply",
|
||||
},
|
||||
|
|
@ -60,18 +60,18 @@ export const organizations = {
|
|||
],
|
||||
},
|
||||
{
|
||||
legend: "Chapter",
|
||||
when: { path: "kind", value: "chapter" },
|
||||
legend: "Group",
|
||||
when: { path: "kind", value: "group" },
|
||||
fields: [
|
||||
{
|
||||
path: "chapter.region_id",
|
||||
path: "group.region_id",
|
||||
label: "Region",
|
||||
widget: "select",
|
||||
optionsFrom: "regions",
|
||||
blankLabel: "Default: none",
|
||||
},
|
||||
{ path: "chapter.meets", label: "Meets", help: "2nd Sundays, 6:00pm" },
|
||||
{ path: "chapter.started", label: "Started", help: "Since 2021" },
|
||||
{ path: "group.meets", label: "Meets", help: "2nd Sundays, 6:00pm" },
|
||||
{ path: "group.started", label: "Started", help: "Since 2021" },
|
||||
],
|
||||
},
|
||||
{ legend: "Place", fields: PLACE_FIELDS },
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
never sends paths, it sends `{ kind, id }` and, for an
|
||||
organization, the `org_kind` that decides which of the three
|
||||
routes a slug belongs to. Deciding that in each component is how
|
||||
/regions/x and /chapters/x end up both existing for the same
|
||||
/regions/x and /groups/x end up both existing for the same
|
||||
record, and how the history timeline ended up emitting /event/:id
|
||||
while the router only knew /retreats/:id.
|
||||
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
detailPath() returns null for it, so useRecord never fetches it.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export type OrgKind = 'national' | 'region' | 'chapter' | 'partner'
|
||||
export type OrgKind = 'national' | 'region' | 'group' | 'partner'
|
||||
export type RefKind = 'event' | 'organization' | 'team' | 'award' | 'person'
|
||||
|
||||
/* A region, a chapter and a partner read as different things to a
|
||||
/* A region, a group and a partner read as different things to a
|
||||
visitor even though they are one table, so they get one route
|
||||
each. 'national' is NGU itself, one record, no listing to sit
|
||||
under, so it falls through to the generic path. */
|
||||
const ORG_BASE: Record<string, string> = {
|
||||
region: '/regions',
|
||||
chapter: '/chapters',
|
||||
group: '/groups',
|
||||
partner: '/partners',
|
||||
national: '/organizations',
|
||||
}
|
||||
|
|
@ -152,14 +152,14 @@ export function refHref(
|
|||
}
|
||||
}
|
||||
|
||||
/* Where "back" goes from a record page. A chapter belongs to
|
||||
/* Where "back" goes from a record page. A group belongs to
|
||||
/community, a retreat to /retreats. */
|
||||
export function orgListHref(kind?: string | null): { to: string; label: string } {
|
||||
switch (kind) {
|
||||
case 'region':
|
||||
return { to: '/community#regions', label: 'All regions' }
|
||||
case 'chapter':
|
||||
return { to: '/community#chapters', label: 'All chapters' }
|
||||
case 'group':
|
||||
return { to: '/community#groups', label: 'All groups' }
|
||||
case 'partner':
|
||||
return { to: '/community#partners', label: 'All partner organizations' }
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ORGANIZATIONS
|
||||
|
||||
Regions, chapters, partners and NGU itself are one table and one
|
||||
Regions, groups, partners and NGU itself are one table and one
|
||||
endpoint. Anything that lists organizations reads them the same
|
||||
way and filters by kind:
|
||||
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
`details`, so a list component can render the common parts
|
||||
without knowing what it's holding:
|
||||
|
||||
region { scope, map_note, areas[], chapters[] }
|
||||
chapter { region_id, region_name, region_color, meets, started }
|
||||
region { scope, map_note, areas[], groups[] }
|
||||
group { region_id, region_name, region_color, meets, started }
|
||||
partner {}
|
||||
|
||||
Each kind is a separate request path, so the cache in api.ts
|
||||
|
|
@ -47,7 +47,7 @@ export function useOrganizations(kind) {
|
|||
one for the rest (NGU itself) or a bad id.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
|
||||
const WITH_PAGE = new Set(["region", "chapter", "partner"]);
|
||||
const WITH_PAGE = new Set(["region", "group", "partner"]);
|
||||
|
||||
export function orgPath(org) {
|
||||
return WITH_PAGE.has(org?.kind) && !isBadId(org.id) ? orgHref(org.id, org.kind) : null;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import RequestLink from "../components/RequestLink.tsx";
|
|||
|
||||
A page is a list of sections, and a section is a view over data
|
||||
the database already holds, narrowed by a filter. The map of
|
||||
chapters and the vertical list of regions are the same rows seen
|
||||
groups and the vertical list of regions are the same rows seen
|
||||
two ways; the three bands of retreats are one view seen three
|
||||
times with a different filter each.
|
||||
|
||||
|
|
@ -24,8 +24,8 @@ import RequestLink from "../components/RequestLink.tsx";
|
|||
Toggle: EventCardsToggle,
|
||||
},
|
||||
request: { // optional button
|
||||
type: "chapter", // to the Request form
|
||||
label: "Add or update a chapter",
|
||||
type: "group", // to the Request form
|
||||
label: "Add or update a group",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
useCommunity
|
||||
|
||||
The chapter map's view of the organization list (OrgList-Map).
|
||||
Regions and chapters are the same table and the same endpoint;
|
||||
The group map's view of the organization list (OrgList-Map).
|
||||
Regions and groups are the same table and the same endpoint;
|
||||
this hook reshapes them into what a map needs, slices per tile,
|
||||
counts per tile, chapters grouped by region.
|
||||
counts per tile, groups grouped by region.
|
||||
|
||||
Two things live elsewhere:
|
||||
|
||||
|
|
@ -24,17 +24,17 @@ import {
|
|||
useOrganizations,
|
||||
} from "./organizations.ts";
|
||||
import {
|
||||
areaForChapter,
|
||||
areaForGroup,
|
||||
buildAreaSlices,
|
||||
countChaptersByArea,
|
||||
countGroupsByArea,
|
||||
} from "../data/mapGrid.ts";
|
||||
|
||||
export function useCommunity() {
|
||||
const regionsQuery = useOrganizations("region");
|
||||
const chaptersQuery = useOrganizations("chapter");
|
||||
const groupsQuery = useOrganizations("group");
|
||||
|
||||
const rawRegions = regionsQuery.organizations;
|
||||
const rawChapters = chaptersQuery.organizations;
|
||||
const rawGroups = groupsQuery.organizations;
|
||||
|
||||
return useMemo(() => {
|
||||
/* ── Regions ───────────────────────────────────────────────
|
||||
|
|
@ -52,18 +52,18 @@ export function useCommunity() {
|
|||
region.areas.map((area) => ({ ...area, region_id: region.id })),
|
||||
);
|
||||
|
||||
/* ── Chapters, each tagged with the tile it lights up ──────
|
||||
/* ── Groups, each tagged with the tile it lights up ──────
|
||||
The database stores a real address; which square that maps
|
||||
to is a rendering question, answered here once rather than
|
||||
at every call site. */
|
||||
const chapters = rawChapters.map((org) => ({
|
||||
const groups = rawGroups.map((org) => ({
|
||||
...org,
|
||||
region_id: org.details?.region_id ?? null,
|
||||
region_name: org.details?.region_name ?? null,
|
||||
region_color: org.details?.region_color ?? null,
|
||||
meets: org.details?.meets ?? null,
|
||||
started: org.details?.started ?? null,
|
||||
area_code: areaForChapter(org),
|
||||
area_code: areaForGroup(org),
|
||||
}));
|
||||
|
||||
const regionById = Object.fromEntries(regions.map((r) => [r.id, r]));
|
||||
|
|
@ -73,17 +73,17 @@ export function useCommunity() {
|
|||
primary and a remainder, so the SVG never does arithmetic. */
|
||||
const slices = buildAreaSlices(regionAreas, regions);
|
||||
|
||||
const chapterCounts = countChaptersByArea(chapters);
|
||||
const groupCounts = countGroupsByArea(groups);
|
||||
|
||||
const chaptersByRegion = new Map();
|
||||
for (const chapter of chapters) {
|
||||
if (!chapter.region_id) continue;
|
||||
const list = chaptersByRegion.get(chapter.region_id);
|
||||
if (list) list.push(chapter);
|
||||
else chaptersByRegion.set(chapter.region_id, [chapter]);
|
||||
const groupsByRegion = new Map();
|
||||
for (const group of groups) {
|
||||
if (!group.region_id) continue;
|
||||
const list = groupsByRegion.get(group.region_id);
|
||||
if (list) list.push(group);
|
||||
else groupsByRegion.set(group.region_id, [group]);
|
||||
}
|
||||
|
||||
const chaptersIn = (regionId) => chaptersByRegion.get(regionId) ?? [];
|
||||
const groupsIn = (regionId) => groupsByRegion.get(regionId) ?? [];
|
||||
|
||||
/* Sorted by name to match how the page has always shown them,
|
||||
rather than by the sort_order the API returns. */
|
||||
|
|
@ -108,8 +108,8 @@ export function useCommunity() {
|
|||
.filter(Boolean);
|
||||
|
||||
return {
|
||||
loading: regionsQuery.loading || chaptersQuery.loading,
|
||||
error: regionsQuery.error ?? chaptersQuery.error,
|
||||
loading: regionsQuery.loading || groupsQuery.loading,
|
||||
error: regionsQuery.error ?? groupsQuery.error,
|
||||
|
||||
regions,
|
||||
regionAreas,
|
||||
|
|
@ -118,11 +118,11 @@ export function useCommunity() {
|
|||
international,
|
||||
virtual,
|
||||
|
||||
chapters,
|
||||
chaptersIn,
|
||||
groups,
|
||||
groupsIn,
|
||||
|
||||
slices,
|
||||
chapterCounts,
|
||||
groupCounts,
|
||||
regionsForArea,
|
||||
|
||||
areasLabelFor,
|
||||
|
|
@ -130,10 +130,10 @@ export function useCommunity() {
|
|||
};
|
||||
}, [
|
||||
rawRegions,
|
||||
rawChapters,
|
||||
rawGroups,
|
||||
regionsQuery.loading,
|
||||
regionsQuery.error,
|
||||
chaptersQuery.loading,
|
||||
chaptersQuery.error,
|
||||
groupsQuery.loading,
|
||||
groupsQuery.error,
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export type Link = {
|
|||
export type OrgRef = { id: string; name: string; kind?: string | null }
|
||||
|
||||
/* One host of an event. `kind` says which table the id is in;
|
||||
`org_kind` is the region/chapter/partner split that decides an
|
||||
`org_kind` is the region/group/partner split that decides an
|
||||
organization's route, and is null for a person. The triple is
|
||||
exactly what refHref() in hrefs.ts takes. */
|
||||
export type EventHost = {
|
||||
|
|
@ -207,7 +207,7 @@ export type RegionArea = {
|
|||
|
||||
export type OrganizationRecord = {
|
||||
id: string
|
||||
kind: 'national' | 'region' | 'chapter' | 'partner'
|
||||
kind: 'national' | 'region' | 'group' | 'partner'
|
||||
name: string
|
||||
short_name?: string | null
|
||||
tagline?: string | null
|
||||
|
|
@ -234,7 +234,7 @@ export type OrganizationRecord = {
|
|||
scope?: RegionScope | null
|
||||
map_note?: string | null
|
||||
areas?: RegionArea[]
|
||||
chapters?: Array<{ id: string; name: string; location_label?: string | null; logo?: string | null }>
|
||||
groups?: Array<{ id: string; name: string; location_label?: string | null; logo?: string | null }>
|
||||
region_id?: string | null
|
||||
region_name?: string | null
|
||||
region_color?: string | null
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export const PAGE_SECTIONS = {
|
|||
],
|
||||
"/community": [
|
||||
{ label: "Community Blog", hash: "#blog" },
|
||||
{ label: "Local Chapters", hash: "#chapters" },
|
||||
{ label: "Local Groups", hash: "#groups" },
|
||||
{ label: "Unity Regions", hash: "#regions" },
|
||||
{ label: "Partner Organizations", hash: "#partners" },
|
||||
],
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const PAGE = sitePage("/community");
|
|||
COMMUNITY PAGE
|
||||
|
||||
The blog first, then two views of the organizations table. The
|
||||
map is filtered to chapters; the vertical list is filtered to
|
||||
map is filtered to groups; the vertical list is filtered to
|
||||
regions. Same rows, same endpoint, different shape on the page.
|
||||
|
||||
The blog's heading and blurb are the admin's (Pages → Community blog
|
||||
|
|
@ -27,21 +27,21 @@ const BLOG_DEFAULT_TITLE = "Community Blog";
|
|||
|
||||
const SECTIONS = [
|
||||
{
|
||||
id: "chapters",
|
||||
title: "Local Chapters",
|
||||
id: "groups",
|
||||
title: "Local Groups",
|
||||
blurb:
|
||||
"Young adult groups meeting in person and online across the movement.",
|
||||
accent: BRAND,
|
||||
background: "var(--color-tint)",
|
||||
Component: OrgListMap,
|
||||
request: { type: "chapter", label: "Add or update a chapter" },
|
||||
request: { type: "group", label: "Add or update a group" },
|
||||
views: { options: ["map", "grid"], default: "map", Toggle: OrgMapToggle },
|
||||
},
|
||||
{
|
||||
id: "regions",
|
||||
title: "Unity Regions",
|
||||
blurb:
|
||||
"The regional organizations that support chapters and host their own gatherings.",
|
||||
"The regional organizations that support groups and host their own gatherings.",
|
||||
accent: "#4a6b72",
|
||||
background: "var(--color-surface)",
|
||||
Component: OrgListVertical,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ORGANIZATION DETAIL
|
||||
/regions/:id /chapters/:id /partners/:id /organizations/:id
|
||||
/regions/:id /groups/:id /partners/:id /organizations/:id
|
||||
|
||||
One component behind four routes, because organizations are one
|
||||
table. The kind decides which extras render, not which file runs.
|
||||
|
||||
The URL kind is decoration, the slug is what identifies the
|
||||
record, so a request for /chapters/great-lakes when that slug is
|
||||
record, so a request for /groups/great-lakes when that slug is
|
||||
a region redirects to the canonical path rather than rendering a
|
||||
correct page at a wrong address.
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ export default function OrganizationDetail() {
|
|||
)
|
||||
}
|
||||
|
||||
// /chapters/x when x is a region: same record, wrong address.
|
||||
// /groups/x when x is a region: same record, wrong address.
|
||||
//
|
||||
// useLocation, not window.location: the latter is outside the
|
||||
// router's awareness, always "/" under HashRouter, and free to
|
||||
|
|
@ -64,7 +64,7 @@ export default function OrganizationDetail() {
|
|||
// redirect loop rather than a one-shot correction.
|
||||
//
|
||||
// Guarded on org.id because a record with no id would redirect to
|
||||
// /chapters/undefined, which is a worse page than the one we're
|
||||
// /groups/undefined, which is a worse page than the one we're
|
||||
// already on. All four organization routes must be registered or
|
||||
// this redirects somewhere nothing matches.
|
||||
const canonical = org.id ? orgHref(org.id, org.kind) : null
|
||||
|
|
@ -164,30 +164,30 @@ export default function OrganizationDetail() {
|
|||
})
|
||||
}
|
||||
|
||||
if (org.kind === 'region' && (org.details.chapters?.length ?? 0) > 0) {
|
||||
if (org.kind === 'region' && (org.details.groups?.length ?? 0) > 0) {
|
||||
sections.push({
|
||||
id: 'chapters',
|
||||
title: 'Chapters',
|
||||
id: 'groups',
|
||||
title: 'Groups',
|
||||
blurb: org.details.map_note ?? undefined,
|
||||
accent,
|
||||
background: 'var(--color-surface)',
|
||||
content: (
|
||||
<div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{(org.details.chapters ?? []).map((chapter) => (
|
||||
{(org.details.groups ?? []).map((group) => (
|
||||
<Link
|
||||
key={chapter.id}
|
||||
to={orgHref(chapter.id, 'chapter')}
|
||||
key={group.id}
|
||||
to={orgHref(group.id, 'group')}
|
||||
className="flex items-center gap-4 rounded-lg border p-4 transition-colors hover:bg-tint"
|
||||
style={{ borderColor: `${withAlpha(accent, 25)}` }}
|
||||
>
|
||||
<ChapterMark file={chapter.logo} name={chapter.name} accent={accent} />
|
||||
<GroupMark file={group.logo} name={group.name} accent={accent} />
|
||||
<span>
|
||||
<span className="block font-semibold" style={{ color: accentText(accent) }}>
|
||||
{chapter.name}
|
||||
{group.name}
|
||||
</span>
|
||||
{chapter.location_label && (
|
||||
{group.location_label && (
|
||||
<span className="block text-sm" style={{ color: BODY }}>
|
||||
{chapter.location_label}
|
||||
{group.location_label}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
|
@ -285,7 +285,7 @@ function Facts({
|
|||
<span style={{ color: BODY }}>{org.details.scope}</span>
|
||||
)}
|
||||
|
||||
{org.kind === 'chapter' && org.details.region_id && (
|
||||
{org.kind === 'group' && org.details.region_id && (
|
||||
<span style={{ color: BODY }}>
|
||||
Part of{' '}
|
||||
<Link
|
||||
|
|
@ -298,10 +298,10 @@ function Facts({
|
|||
</span>
|
||||
)}
|
||||
|
||||
{org.kind === 'chapter' && org.details.meets && (
|
||||
{org.kind === 'group' && org.details.meets && (
|
||||
<span style={{ color: BODY }}>Meets {org.details.meets}</span>
|
||||
)}
|
||||
{org.kind === 'chapter' && org.details.started && (
|
||||
{org.kind === 'group' && org.details.started && (
|
||||
<span style={{ color: BODY }}>Since {org.details.started}</span>
|
||||
)}
|
||||
{org.is_online && <span style={{ color: BODY }}>Online</span>}
|
||||
|
|
@ -360,7 +360,7 @@ function Contact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
|||
)
|
||||
}
|
||||
|
||||
function ChapterMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) {
|
||||
function GroupMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) {
|
||||
return (
|
||||
<Logo
|
||||
src={mediaUrl(file)}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ const PARTS: LegalPart[] = [
|
|||
id: "how-we-use",
|
||||
heading: "How we use it",
|
||||
body: [
|
||||
"To answer you, to run our retreats, chapters and other programs, to keep this site accurate and working, and to keep it secure. We don't sell or rent your information, and we don't use it for advertising.",
|
||||
"To answer you, to run our retreats, groups and other programs, to keep this site accurate and working, and to keep it secure. We don't sell or rent your information, and we don't use it for advertising.",
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ const SECTIONS = [
|
|||
{
|
||||
id: "local",
|
||||
title: "Local Events",
|
||||
blurb: "Hosted by individual chapters.",
|
||||
blurb: "Hosted by individual groups.",
|
||||
accent: ACCENTS.green,
|
||||
background: "var(--color-surface)",
|
||||
Component: EventListCards,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
One component for organizations, events and people. The :entity
|
||||
route param picks the manifest; nothing here knows what a
|
||||
chapter or a retreat is.
|
||||
group or a retreat is.
|
||||
|
||||
The "New X" link follows the same rule as EntityEdit's save
|
||||
button: atLeast(user, "editor"), matching requireRole("editor")
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export const DATA_NAV = {
|
|||
{
|
||||
to: "/admin/organizations",
|
||||
label: "Organizations",
|
||||
blurb: "The national organization, regions, chapters and partners.",
|
||||
blurb: "The national organization, regions, groups and partners.",
|
||||
},
|
||||
{
|
||||
to: "/admin/teams",
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
</label>
|
||||
<p className="mt-1 text-sm" style={{ color: MUTED }}>
|
||||
{request
|
||||
? "Say what you'd like: to see the information we hold about you, to correct it, or to have it deleted. Tell us how you've been in touch with NGU (a retreat, a chapter, this site) so we can find it."
|
||||
? "Say what you'd like: to see the information we hold about you, to correct it, or to have it deleted. Tell us how you've been in touch with NGU (a retreat, a group, this site) so we can find it."
|
||||
: "What you expected to happen, and what happened instead, is the most useful thing you can give us."}
|
||||
</p>
|
||||
<textarea
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { scrollBehavior } from "../../lib/motion.ts";
|
|||
Organizations placed on a tile grid: the map on the left, the
|
||||
list on the right, selecting on either side filtering both.
|
||||
|
||||
Filtered to chapters, and unlike the other sections that isn't
|
||||
Filtered to groups, and unlike the other sections that isn't
|
||||
a prop. A map only makes sense for organizations that sit
|
||||
somewhere, and it reads regions off the same data to colour the
|
||||
tiles, so "plot partners instead" isn't a filter change, it's a
|
||||
|
|
@ -56,7 +56,7 @@ const US_TITLE = "US Unity Regions";
|
|||
const INTL_TITLE = "International Unity Regions";
|
||||
|
||||
/* ── Body content ──────────────────────────────────────────────
|
||||
A chapter's description is ordered blocks rather than one
|
||||
A group's description is ordered blocks rather than one
|
||||
string, so a heading or a list added later renders instead of
|
||||
vanishing. When organization and person pages arrive this should
|
||||
move to a shared component; small enough to live here until then.
|
||||
|
|
@ -184,7 +184,7 @@ function Tile({
|
|||
>
|
||||
<title>
|
||||
{AREA_NAMES[code] || code}: {slices.map(s => s.name).join(" / ")}
|
||||
{count ? ` · ${count} chapter${count > 1 ? "s" : ""}` : ""}
|
||||
{count ? ` · ${count} group${count > 1 ? "s" : ""}` : ""}
|
||||
</title>
|
||||
|
||||
<clipPath id={clipId}>
|
||||
|
|
@ -250,7 +250,7 @@ function Tile({
|
|||
);
|
||||
}
|
||||
|
||||
function RegionMap({ slices, chapterCounts, ...props }: any) {
|
||||
function RegionMap({ slices, groupCounts, ...props }: any) {
|
||||
const size = TILE - PAD * 2;
|
||||
|
||||
return (
|
||||
|
|
@ -258,7 +258,7 @@ function RegionMap({ slices, chapterCounts, ...props }: any) {
|
|||
viewBox={`0 0 ${COLS * TILE} ${ROWS * TILE}`}
|
||||
className="w-full h-auto"
|
||||
role="group"
|
||||
aria-label="Chapters by Unity region"
|
||||
aria-label="Groups by Unity region"
|
||||
>
|
||||
{/* States and bands are the same shape, a tile with a span,
|
||||
so this is one loop rather than two. */}
|
||||
|
|
@ -273,7 +273,7 @@ function RegionMap({ slices, chapterCounts, ...props }: any) {
|
|||
width={area.span * TILE - PAD * 2}
|
||||
fontSize={area.isState ? 34 : 38}
|
||||
slices={slices[area.code] ?? []}
|
||||
count={chapterCounts[area.code] ?? 0}
|
||||
count={groupCounts[area.code] ?? 0}
|
||||
{...props}
|
||||
/>
|
||||
))}
|
||||
|
|
@ -355,14 +355,14 @@ function Legend({ domestic, international, onMapIds, ...props }: any) {
|
|||
|
||||
function RegionBlock({
|
||||
region,
|
||||
chapters,
|
||||
groups,
|
||||
subtext,
|
||||
selected,
|
||||
setSelected,
|
||||
setHovered,
|
||||
indent,
|
||||
regionRefs,
|
||||
chapterRefs,
|
||||
groupRefs,
|
||||
}) {
|
||||
const on = selected === region.id;
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ function RegionBlock({
|
|||
/>
|
||||
{region.name}
|
||||
<span className="text-sm font-normal ml-auto" style={{ color: MUTED }}>
|
||||
{chapters.length || "-"}
|
||||
{groups.length || "-"}
|
||||
</span>
|
||||
</button>
|
||||
</h4>
|
||||
|
|
@ -399,16 +399,16 @@ function RegionBlock({
|
|||
</p>
|
||||
)}
|
||||
|
||||
{chapters.length === 0 ? (
|
||||
{groups.length === 0 ? (
|
||||
<p className="text-sm ml-5 mb-4" style={{ color: MUTED }}>
|
||||
No chapters yet. Interested in starting one?
|
||||
No groups yet. Interested in starting one?
|
||||
</p>
|
||||
) : (
|
||||
<ul className="ml-5 mb-4 flex flex-col gap-3">
|
||||
{chapters.map(c => (
|
||||
{groups.map(c => (
|
||||
<li
|
||||
key={c.id}
|
||||
ref={el => chapterRefs && (chapterRefs.current[c.id] = el)}
|
||||
ref={el => groupRefs && (groupRefs.current[c.id] = el)}
|
||||
className="pl-3 flex items-start gap-3"
|
||||
style={{ borderLeft: `2px solid ${colorOf(region)}` }}
|
||||
>
|
||||
|
|
@ -447,7 +447,7 @@ function RegionBlock({
|
|||
{orgPath(c) && (
|
||||
<ArrowLink
|
||||
to={orgPath(c)}
|
||||
label={`${c.name}: chapter page`}
|
||||
label={`${c.name}: group page`}
|
||||
color={colorOf(region)}
|
||||
size="h-8 w-8"
|
||||
/>
|
||||
|
|
@ -467,7 +467,7 @@ function RegionBlock({
|
|||
color. Selecting another card swaps the panel's contents.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
function ChapterCard({ chapter, color, open, onOpen }) {
|
||||
function GroupCard({ group, color, open, onOpen }) {
|
||||
return (
|
||||
<div
|
||||
className="rounded-2xl p-4 flex items-start gap-4 transition-all duration-200"
|
||||
|
|
@ -476,29 +476,29 @@ function ChapterCard({ chapter, color, open, onOpen }) {
|
|||
background: open ? `${withAlpha(color, 8)}` : "transparent",
|
||||
}}
|
||||
>
|
||||
<OrgLogo org={chapter} color={color} />
|
||||
<OrgLogo org={group} color={color} />
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="font-bold leading-tight">{chapter.name}</p>
|
||||
<p className="font-bold leading-tight">{group.name}</p>
|
||||
<p className="text-sm" style={{ color: FALLBACK_COLOR }}>
|
||||
{chapter.location_label}
|
||||
{group.location_label}
|
||||
</p>
|
||||
{chapter.meets && (
|
||||
{group.meets && (
|
||||
<p className="text-sm" style={{ color: MUTED }}>
|
||||
{chapter.meets}
|
||||
{group.meets}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Two controls, two destinations: the chevron opens the
|
||||
detail panel in place, the arrow leaves for the chapter's
|
||||
detail panel in place, the arrow leaves for the group's
|
||||
own page. Keeping them distinct beats one control that
|
||||
does different things depending on where you click. */}
|
||||
<div className="shrink-0 flex items-center gap-2">
|
||||
<button
|
||||
onClick={onOpen}
|
||||
aria-expanded={open}
|
||||
aria-label={`${open ? "Hide" : "View"} details for ${chapter.name}`}
|
||||
aria-label={`${open ? "Hide" : "View"} details for ${group.name}`}
|
||||
className="h-9 w-9 rounded-full flex items-center justify-center transition-transform duration-200 hover:scale-110"
|
||||
style={{
|
||||
border: `1px solid ${color}`,
|
||||
|
|
@ -509,10 +509,10 @@ function ChapterCard({ chapter, color, open, onOpen }) {
|
|||
<CaretRight className="h-4 w-4" weight="bold" aria-hidden="true" />
|
||||
</button>
|
||||
|
||||
{orgPath(chapter) && (
|
||||
{orgPath(group) && (
|
||||
<ArrowLink
|
||||
to={orgPath(chapter)}
|
||||
label={`${chapter.name}: chapter page`}
|
||||
to={orgPath(group)}
|
||||
label={`${group.name}: group page`}
|
||||
color={color}
|
||||
/>
|
||||
)}
|
||||
|
|
@ -521,10 +521,10 @@ function ChapterCard({ chapter, color, open, onOpen }) {
|
|||
);
|
||||
}
|
||||
|
||||
function ChapterDetail({ chapter, region, onClose }) {
|
||||
function GroupDetail({ group, region, onClose }) {
|
||||
/* "Led by" comes from affiliations rather than a text field, so
|
||||
it lists real people and stays empty until they exist. */
|
||||
const leads = (chapter.leadership ?? [])
|
||||
const leads = (group.leadership ?? [])
|
||||
.map(person =>
|
||||
person.title ? `${person.display_name} (${person.title})` : person.display_name
|
||||
)
|
||||
|
|
@ -532,10 +532,10 @@ function ChapterDetail({ chapter, region, onClose }) {
|
|||
|
||||
const rows = [
|
||||
["Region", region.name],
|
||||
["Where", chapter.venue],
|
||||
["Meets", chapter.meets],
|
||||
["Where", group.venue],
|
||||
["Meets", group.meets],
|
||||
["Led by", leads],
|
||||
["Since", chapter.started],
|
||||
["Since", group.started],
|
||||
].filter(([, v]) => v);
|
||||
|
||||
return (
|
||||
|
|
@ -544,11 +544,11 @@ function ChapterDetail({ chapter, region, onClose }) {
|
|||
style={{ border: `2px solid ${colorOf(region)}`, background: `${withAlpha(colorOf(region), 6)}` }}
|
||||
>
|
||||
<div className="flex items-start gap-4">
|
||||
<OrgLogo org={chapter} color={colorOf(region)} size="h-20 w-20" />
|
||||
<OrgLogo org={group} color={colorOf(region)} size="h-20 w-20" />
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-2xl font-extrabold leading-tight">{chapter.name}</p>
|
||||
<p style={{ color: FALLBACK_COLOR }}>{chapter.location_label}</p>
|
||||
<p className="text-2xl font-extrabold leading-tight">{group.name}</p>
|
||||
<p style={{ color: FALLBACK_COLOR }}>{group.location_label}</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
|
|
@ -561,7 +561,7 @@ function ChapterDetail({ chapter, region, onClose }) {
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<Blocks blocks={chapter.blocks} color={colorOf(region)} />
|
||||
<Blocks blocks={group.blocks} color={colorOf(region)} />
|
||||
|
||||
{rows.length > 0 && (
|
||||
<dl className="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1 text-sm">
|
||||
|
|
@ -579,18 +579,18 @@ function ChapterDetail({ chapter, region, onClose }) {
|
|||
)}
|
||||
|
||||
<div className="mt-5 flex flex-wrap gap-3">
|
||||
{orgPath(chapter) && (
|
||||
{orgPath(group) && (
|
||||
<Link
|
||||
to={orgPath(chapter)!}
|
||||
to={orgPath(group)!}
|
||||
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
|
||||
style={{ background: colorOf(region), color: readableOn(colorOf(region)) }}
|
||||
>
|
||||
Chapter page
|
||||
Group page
|
||||
</Link>
|
||||
)}
|
||||
{chapter.website && (
|
||||
{group.website && (
|
||||
<a
|
||||
href={chapter.website}
|
||||
href={group.website}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
|
||||
|
|
@ -600,9 +600,9 @@ function ChapterDetail({ chapter, region, onClose }) {
|
|||
</a>
|
||||
)}
|
||||
|
||||
{chapter.email && (
|
||||
{group.email && (
|
||||
<a
|
||||
href={`mailto:${chapter.email}`}
|
||||
href={`mailto:${group.email}`}
|
||||
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
|
||||
style={{ border: `1px solid ${colorOf(region)}`, color: colorOf(region) }}
|
||||
>
|
||||
|
|
@ -614,13 +614,13 @@ function ChapterDetail({ chapter, region, onClose }) {
|
|||
);
|
||||
}
|
||||
|
||||
function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpenId }) {
|
||||
// Only regions that actually have chapters get a grid.
|
||||
function GroupGrid({ regions, groups, groupsIn, subtextFor, openId, setOpenId }) {
|
||||
// Only regions that actually have groups get a grid.
|
||||
const populated = regions
|
||||
.map(region => ({ region, list: chaptersIn(region.id) }))
|
||||
.map(region => ({ region, list: groupsIn(region.id) }))
|
||||
.filter(({ list }) => list.length > 0);
|
||||
const empty = regions.filter(region => chaptersIn(region.id).length === 0);
|
||||
const openChapter = chapters.find(c => c.id === openId) || null;
|
||||
const empty = regions.filter(region => groupsIn(region.id).length === 0);
|
||||
const openGroup = groups.find(c => c.id === openId) || null;
|
||||
|
||||
return (
|
||||
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: CONTENT_MAX }}>
|
||||
|
|
@ -647,10 +647,10 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
|
|||
)}
|
||||
|
||||
{/* Detail panel sits above this region's grid, and only
|
||||
when the open chapter belongs to this region. */}
|
||||
{openChapter && openChapter.region_id === region.id && (
|
||||
<ChapterDetail
|
||||
chapter={openChapter}
|
||||
when the open group belongs to this region. */}
|
||||
{openGroup && openGroup.region_id === region.id && (
|
||||
<GroupDetail
|
||||
group={openGroup}
|
||||
region={region}
|
||||
onClose={() => setOpenId(null)}
|
||||
/>
|
||||
|
|
@ -663,9 +663,9 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
|
|||
}}
|
||||
>
|
||||
{list.map(c => (
|
||||
<ChapterCard
|
||||
<GroupCard
|
||||
key={c.id}
|
||||
chapter={c}
|
||||
group={c}
|
||||
color={colorOf(region)}
|
||||
open={openId === c.id}
|
||||
onOpen={() => setOpenId(openId === c.id ? null : c.id)}
|
||||
|
|
@ -678,7 +678,7 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
|
|||
|
||||
{empty.length > 0 && (
|
||||
<p className="text-sm" style={{ color: MUTED }}>
|
||||
No chapters yet in {empty.map(r => r.name).join(", ")}. Interested in
|
||||
No groups yet in {empty.map(r => r.name).join(", ")}. Interested in
|
||||
starting one?
|
||||
</p>
|
||||
)}
|
||||
|
|
@ -698,7 +698,7 @@ export function OrgMapToggle({ view, setView, accent }) {
|
|||
className="inline-flex rounded-xl overflow-hidden shrink-0"
|
||||
style={{ border: `1px solid ${accent}` }}
|
||||
role="group"
|
||||
aria-label="Change how chapters are displayed"
|
||||
aria-label="Change how groups are displayed"
|
||||
>
|
||||
{[
|
||||
["map", "Map"],
|
||||
|
|
@ -727,10 +727,10 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
domestic,
|
||||
international,
|
||||
virtual,
|
||||
chapters,
|
||||
chaptersIn,
|
||||
groups,
|
||||
groupsIn,
|
||||
slices,
|
||||
chapterCounts,
|
||||
groupCounts,
|
||||
regionsForArea,
|
||||
subtextFor,
|
||||
} = useCommunity();
|
||||
|
|
@ -742,7 +742,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
// The list scrolls itself to whatever the map or legend points at.
|
||||
const listRef = useRef<any>(null);
|
||||
const regionRefs = useRef<any>({});
|
||||
const chapterRefs = useRef<any>({});
|
||||
const groupRefs = useRef<any>({});
|
||||
|
||||
// Where the latest hover came from. The list follows the map and
|
||||
// the legend, but hovering the list itself must not move it: the
|
||||
|
|
@ -776,12 +776,12 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
if (id) scrollListTo(regionRefs.current[id]);
|
||||
}, [hovered, selected]);
|
||||
|
||||
// Clicking a tile jumps to its first chapter when it has one,
|
||||
// Clicking a tile jumps to its first group when it has one,
|
||||
// otherwise to the region it belongs to.
|
||||
const pickArea = code => {
|
||||
const chapter = chapters.find(c => c.area_code === code);
|
||||
if (chapter && chapterRefs.current[chapter.id]) {
|
||||
return scrollListTo(chapterRefs.current[chapter.id]);
|
||||
const group = groups.find(c => c.area_code === code);
|
||||
if (group && groupRefs.current[group.id]) {
|
||||
return scrollListTo(groupRefs.current[group.id]);
|
||||
}
|
||||
const region = regionsForArea(code)[0];
|
||||
if (region) scrollListTo(regionRefs.current[region.id]);
|
||||
|
|
@ -795,24 +795,24 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
|
||||
if (loading && regions.length === 0) {
|
||||
return shell(
|
||||
<div className="skeleton" role="status" aria-label="Loading chapters" />
|
||||
<div className="skeleton" role="status" aria-label="Loading groups" />
|
||||
);
|
||||
}
|
||||
|
||||
if (error && regions.length === 0) {
|
||||
return shell(
|
||||
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||
· Chapters couldn't be loaded just now, please try again shortly ·
|
||||
· Groups couldn't be loaded just now, please try again shortly ·
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
if (view === "grid") {
|
||||
return (
|
||||
<ChapterGrid
|
||||
<GroupGrid
|
||||
regions={regions}
|
||||
chapters={chapters}
|
||||
chaptersIn={chaptersIn}
|
||||
groups={groups}
|
||||
groupsIn={groupsIn}
|
||||
subtextFor={subtextFor}
|
||||
openId={openId}
|
||||
setOpenId={setOpenId}
|
||||
|
|
@ -827,11 +827,11 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
<RegionBlock
|
||||
key={region.id}
|
||||
region={region}
|
||||
chapters={chaptersIn(region.id)}
|
||||
groups={groupsIn(region.id)}
|
||||
subtext={subtextFor(region)}
|
||||
indent={indent}
|
||||
regionRefs={regionRefs}
|
||||
chapterRefs={chapterRefs}
|
||||
groupRefs={groupRefs}
|
||||
{...shared}
|
||||
setHovered={hoverInList}
|
||||
/>
|
||||
|
|
@ -847,7 +847,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
<div>
|
||||
<RegionMap
|
||||
slices={slices}
|
||||
chapterCounts={chapterCounts}
|
||||
groupCounts={groupCounts}
|
||||
onPick={pickArea}
|
||||
{...shared}
|
||||
/>
|
||||
|
|
@ -858,7 +858,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
{...shared}
|
||||
/>
|
||||
<p className="text-sm mt-4" style={{ color: MUTED }}>
|
||||
A filled tile means a chapter meets there; a two-tone tile is a
|
||||
A filled tile means a group meets there; a two-tone tile is a
|
||||
state shared by two Unity regions. Select a region to filter the
|
||||
list.
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import { accentText } from '../../lib/color.ts'
|
|||
labelled button out to its own site when it has one.
|
||||
|
||||
Nothing here is region-specific. It asks for a kind and renders
|
||||
what comes back, so the same section lists partners or chapters
|
||||
what comes back, so the same section lists partners or groups
|
||||
by changing one prop:
|
||||
|
||||
<OrgListVertical kind="partner" title="Our Partners" />
|
||||
|
|
@ -36,7 +36,7 @@ import { accentText } from '../../lib/color.ts'
|
|||
groupBy={org => org.details?.scope}
|
||||
/>
|
||||
|
||||
Kind-specific extras (the areas a region covers, the chapters
|
||||
Kind-specific extras (the areas a region covers, the groups
|
||||
inside it) come from `details` and render only when present, so
|
||||
a partner row simply doesn't have them.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
|
@ -88,7 +88,7 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
|||
// Region extras. Absent for every other kind, and the JSX below
|
||||
// skips them rather than rendering empty headings.
|
||||
const areas = areasSentence(org.details?.areas ?? []);
|
||||
const chapterCount = (org.details?.chapters ?? []).length;
|
||||
const groupCount = (org.details?.groups ?? []).length;
|
||||
const note = org.details?.map_note;
|
||||
|
||||
/* Collapsed, a row says who it is and nothing else, the areas
|
||||
|
|
@ -124,13 +124,13 @@ function OrgRow({ org, pageLabel, siteLabel }) {
|
|||
)}
|
||||
</span>
|
||||
|
||||
{chapterCount > 0 && (
|
||||
{groupCount > 0 && (
|
||||
<span
|
||||
className="ml-auto text-sm shrink-0"
|
||||
style={{ color: MUTED }}
|
||||
title={`${chapterCount} chapter${chapterCount > 1 ? "s" : ""}`}
|
||||
title={`${groupCount} group${groupCount > 1 ? "s" : ""}`}
|
||||
>
|
||||
{chapterCount}
|
||||
{groupCount}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ function typedUrl(raw: string): string | null {
|
|||
const ORG_GROUPS: Array<[string, string]> = [
|
||||
['national', 'NGU'],
|
||||
['region', 'Regions'],
|
||||
['chapter', 'Chapters'],
|
||||
['group', 'Groups'],
|
||||
['partner', 'Partner organizations'],
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
Posts to /api/requests (server/src/routes/requests.js), as a form
|
||||
so files can go with it. What can be asked for is REQUEST_TYPES;
|
||||
?type=chapter in the address picks one to start with, which is how
|
||||
?type=group in the address picks one to start with, which is how
|
||||
the site's "Request" buttons open it.
|
||||
|
||||
Each type's details (its `fields` in requestTypes.ts: a chapter's
|
||||
Each type's details (its `fields` in requestTypes.ts: a group's
|
||||
city and meeting time, an event's dates) go as one JSON field; the
|
||||
admin opens the record's editor filled in from them.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue