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:
Zaldimmar 2026-09-30 13:19:51 -05:00
parent 175a18976d
commit 38aff34c97
42 changed files with 473 additions and 254 deletions

View file

@ -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 />} />

View file

@ -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'

View file

@ -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)",

View file

@ -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

View file

@ -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;

View file

@ -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,

View file

@ -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"],

View file

@ -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 },

View file

@ -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:

View file

@ -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;

View file

@ -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",
},
}

View file

@ -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,
]);
}

View file

@ -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

View file

@ -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" },
],

View file

@ -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,

View file

@ -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)}

View 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.",
],
},
{

View file

@ -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,

View file

@ -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")

View file

@ -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",

View file

@ -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

View file

@ -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>

View file

@ -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>

View file

@ -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'],
]

View file

@ -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.