NGU-Web/src/pages/TeamDetail.tsx
Zaldimmar 185f9831e2 Fix accessibility found in the audit
- Text contrast: teal text and button fills use #0f7183 (5.7:1), section
  accents darkened to pass on white, solid CTA buttons instead of the
  gradient, footer and subnav text raised to white/65, event and region
  colours kept on borders and swatches with ink text
- Hidden carousel slides and collapsed past events are inert
- Admin list rows carry a real link for keyboard use
- Mobile menu is a modal dialog: focus, Escape, inert background, above
  the header
- Skip to content link, one focus-visible ring, reduced-motion rule,
  focus rings on the calendar inputs
- Region headings hold their button instead of sitting inside it
- font-700 style classes (not Tailwind v4 utilities) replaced with named
  weights, and the 700/800 font files loaded
- Migration 038: alt text for blog covers and schedule graphics; event
  logos next to their title are decorative
- Drop the Church Center script from index.html; Giving loads it itself

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:07:56 -05:00

157 lines
4.5 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'
const TEAL = '#0f7183'
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="inline-flex items-center gap-2 rounded-full px-5 py-2 text-sm font-semibold text-white transition-transform hover:scale-105"
style={{ background: accent }}
>
<PlatformIcon platform={link.platform} />
{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>
)
}