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
|
|
@ -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)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue