A card block also showed on the record's page (the pages printed the card's paragraphs above the body), which the editor didn't say. Shown in now offers The page, The card only, and The card and the page. Every existing card block becomes both, so nothing on the site moves; the pages no longer print card paragraphs, and a both block comes with the page's blocks, in its place in the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
141 lines
4.1 KiB
TypeScript
141 lines
4.1 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
TEAM DETAIL: /teams/:id
|
|
|
|
teams.id is a global primary key rather than scoped to the
|
|
organization, which is what lets this route be flat: 'ngu-board'
|
|
can only mean one thing site-wide.
|
|
|
|
The roster is not in this page's data. PeopleTiles fetches
|
|
/teams/:id/people itself, off v_org_leadership, which already
|
|
decides who counts as current and public. Two requests, both
|
|
cached for 60s by api.ts, and one set of visibility rules.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import { Link, useParams } from 'react-router-dom'
|
|
|
|
import PageShell from '../components/PageShell.tsx'
|
|
import PageState from '../components/PageState.tsx'
|
|
import PlatformIcon from '../components/PlatformIcon.tsx'
|
|
import ContentBlocks from '../components/ContentBlocks.tsx'
|
|
import PeopleTiles from '../components/PeopleTiles.tsx'
|
|
import { useTeam } from '../lib/useContent.ts'
|
|
import { orgHref } from '../lib/hrefs.ts'
|
|
import { accentText, BRAND } from '../lib/color.ts'
|
|
|
|
const BODY = 'var(--color-muted)'
|
|
|
|
export default function TeamDetail() {
|
|
const { id } = useParams()
|
|
const { data: team, loading, error, notFound, reload } = useTeam(id)
|
|
|
|
if (!team) {
|
|
return (
|
|
<PageState
|
|
loading={loading}
|
|
error={error}
|
|
notFound={notFound}
|
|
onRetry={reload}
|
|
noun="team"
|
|
backTo="/organization"
|
|
backLabel="Organization"
|
|
/>
|
|
)
|
|
}
|
|
|
|
const accent = team.color || BRAND
|
|
const hasAbout =
|
|
team.blocks.length > 0 || team.links.length > 0
|
|
|
|
const sections: any[] = []
|
|
|
|
if (hasAbout) {
|
|
sections.push({
|
|
id: 'about',
|
|
title: 'About',
|
|
accent,
|
|
content: (
|
|
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
|
<Facts orgId={team.org.id} orgKind={team.org.kind} orgName={team.org.name} accent={accent} />
|
|
|
|
<div className="max-w-3xl">
|
|
<ContentBlocks blocks={team.blocks} accent={accent} />
|
|
</div>
|
|
|
|
{team.links.length > 0 && (
|
|
<div className="flex flex-wrap gap-3">
|
|
{team.links.map((link) => (
|
|
<a
|
|
key={link.url}
|
|
href={link.url}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="inline-flex items-center gap-2 btn px-5 py-2 text-sm text-white transition-transform hover:scale-105"
|
|
style={{ background: accent }}
|
|
>
|
|
<PlatformIcon platform={link.platform} />
|
|
{link.label}
|
|
</a>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
),
|
|
})
|
|
}
|
|
|
|
sections.push({
|
|
id: 'members',
|
|
title: 'Members',
|
|
accent,
|
|
content: (
|
|
<div className="max-w-6xl mx-auto px-6 space-y-6">
|
|
{!hasAbout && (
|
|
<Facts
|
|
orgId={team.org.id}
|
|
orgKind={team.org.kind}
|
|
orgName={team.org.name}
|
|
accent={accent}
|
|
/>
|
|
)}
|
|
|
|
<PeopleTiles
|
|
size="lg"
|
|
accent={accent}
|
|
teams={[{ id: team.id, label: 'Members', accent }]}
|
|
emptyMessage="Nobody is currently listed on this team."
|
|
/>
|
|
</div>
|
|
),
|
|
})
|
|
|
|
return (
|
|
<PageShell title={team.name} intro={team.tagline ?? undefined} sections={sections} />
|
|
)
|
|
}
|
|
|
|
function Facts({
|
|
orgId,
|
|
orgKind,
|
|
orgName,
|
|
accent,
|
|
}: {
|
|
orgId: string
|
|
orgKind?: string | null
|
|
orgName: string
|
|
accent: string
|
|
}) {
|
|
return (
|
|
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
|
<span style={{ color: BODY }}>
|
|
A team of{' '}
|
|
<Link
|
|
to={orgHref(orgId, orgKind)}
|
|
className="font-medium hover:underline"
|
|
style={{ color: accentText(accent) }}
|
|
>
|
|
{orgName}
|
|
</Link>
|
|
</span>
|
|
</div>
|
|
)
|
|
}
|