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

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