v1.5 - history and timeline as well as many datastructure updates added, polished, fixes
This commit is contained in:
parent
1f0aa3078f
commit
1d84400aef
63 changed files with 7927 additions and 208 deletions
155
src/pages/TeamDetail.tsx
Normal file
155
src/pages/TeamDetail.tsx
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
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.js, 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 ContentBlocks from '../components/ContentBlocks.tsx'
|
||||
import PeopleTiles from '../components/PeopleTiles.tsx'
|
||||
import { useTeam } from '../lib/useContent.ts'
|
||||
import { orgHref } from '../lib/hrefs.ts'
|
||||
|
||||
const TEAL = '#138ba0'
|
||||
const BODY = '#4a6b72'
|
||||
|
||||
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="/leadership"
|
||||
backLabel="Leadership"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const accent = team.color || TEAL
|
||||
const hasAbout =
|
||||
team.description.length > 0 || team.blocks.length > 0 || team.links.length > 0
|
||||
|
||||
const sections: any[] = []
|
||||
|
||||
if (hasAbout) {
|
||||
sections.push({
|
||||
id: 'about',
|
||||
title: 'About',
|
||||
accent,
|
||||
background: '#ffffff',
|
||||
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} />
|
||||
|
||||
{team.description.map((paragraph, index) => (
|
||||
<p key={index} className="leading-relaxed max-w-3xl" style={{ color: BODY }}>
|
||||
{paragraph}
|
||||
</p>
|
||||
))}
|
||||
|
||||
<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="rounded-full px-5 py-2 text-sm font-semibold text-white transition-transform hover:scale-105"
|
||||
style={{ background: accent }}
|
||||
>
|
||||
{link.label}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
sections.push({
|
||||
id: 'members',
|
||||
title: hasAbout ? 'Members' : team.name,
|
||||
accent,
|
||||
background: hasAbout ? '#eef9fb' : '#ffffff',
|
||||
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: accent }}
|
||||
>
|
||||
{orgName}
|
||||
</Link>
|
||||
</span>
|
||||
|
||||
<Link
|
||||
to={orgHref(orgId, orgKind)}
|
||||
className="ml-auto hover:underline"
|
||||
style={{ color: accent }}
|
||||
>
|
||||
Back to {orgName}
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue