website refactor
This commit is contained in:
@@ -2,12 +2,11 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Breadcrumbs } from '@/ui/Breadcrumbs';
|
||||
import { SlotTemplates } from '@/components/sponsors/SlotTemplates';
|
||||
import { SponsorInsightsCard } from '@/components/sponsors/SponsorInsightsCard';
|
||||
import { SlotTemplates } from '@/components/sponsors/SlotTemplates';
|
||||
import { useSponsorMode } from '@/hooks/sponsor/useSponsorMode';
|
||||
import { Box } from '@/ui/Box';
|
||||
import { Button } from '@/ui/Button';
|
||||
import { Card } from '@/ui/Card';
|
||||
import { Container } from '@/ui/Container';
|
||||
import { Grid } from '@/ui/Grid';
|
||||
import { GridItem } from '@/ui/GridItem';
|
||||
@@ -15,12 +14,11 @@ import { Heading } from '@/ui/Heading';
|
||||
import { Stack } from '@/ui/Stack';
|
||||
import { Text } from '@/ui/Text';
|
||||
import { HorizontalStatItem } from '@/ui/HorizontalStatItem';
|
||||
import { DateDisplay } from '@/lib/display-objects/DateDisplay';
|
||||
|
||||
import { TeamDetailsHeader } from '@/components/teams/TeamDetailsHeader';
|
||||
import { TeamMembersTable } from '@/components/teams/TeamMembersTable';
|
||||
import { TeamStandingsPanel } from '@/components/teams/TeamStandingsPanel';
|
||||
import { TeamAdmin } from '@/components/teams/TeamAdmin';
|
||||
import { TeamHero } from '@/components/teams/TeamHero';
|
||||
import { TeamRoster } from '@/components/teams/TeamRoster';
|
||||
import { TeamStandings } from '@/components/teams/TeamStandings';
|
||||
import type { TeamDetailViewData } from '@/lib/view-data/TeamDetailViewData';
|
||||
|
||||
type Tab = 'overview' | 'roster' | 'standings' | 'admin';
|
||||
@@ -34,7 +32,6 @@ export interface TeamDetailTemplateProps {
|
||||
onTabChange: (tab: Tab) => void;
|
||||
onUpdate: () => void;
|
||||
onRemoveMember: (driverId: string) => void;
|
||||
onChangeRole: (driverId: string, newRole: 'owner' | 'admin' | 'member') => void;
|
||||
onGoBack: () => void;
|
||||
}
|
||||
|
||||
@@ -45,170 +42,178 @@ export function TeamDetailTemplate({
|
||||
onTabChange,
|
||||
onUpdate,
|
||||
onRemoveMember,
|
||||
onChangeRole,
|
||||
onGoBack,
|
||||
}: TeamDetailTemplateProps) {
|
||||
const isSponsorMode = useSponsorMode();
|
||||
|
||||
const team = viewData.team;
|
||||
|
||||
// Show loading state
|
||||
if (loading) {
|
||||
return (
|
||||
<Container size="lg" py={12}>
|
||||
<Stack align="center">
|
||||
<Text color="text-gray-400">Loading team...</Text>
|
||||
<Box bg="base-black" minH="screen" display="flex" center>
|
||||
<Stack align="center" gap={4}>
|
||||
<Box w="12" h="12" border={4} borderColor="primary-accent" borderOpacity={0.2} borderTop borderTopColor="primary-accent" rounded="full" animate="spin" />
|
||||
<Text color="text-gray-500" font="mono" size="xs" uppercase letterSpacing="widest">Synchronizing Telemetry...</Text>
|
||||
</Stack>
|
||||
</Container>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
// Show not found state
|
||||
if (!team) {
|
||||
return (
|
||||
<Container size="md" py={12}>
|
||||
<Card>
|
||||
<Stack align="center" py={12} gap={6}>
|
||||
<Box textAlign="center">
|
||||
<Heading level={1}>Team Not Found</Heading>
|
||||
<Text color="text-gray-400" block mt={2}>
|
||||
The team you're looking for doesn't exist or has been disbanded.
|
||||
</Text>
|
||||
<Box bg="base-black" minH="screen">
|
||||
<Container size="md" py={24}>
|
||||
<Box border borderColor="outline-steel" bg="surface-charcoal" p={12} textAlign="center">
|
||||
<Heading level={1}>404: Team Disconnected</Heading>
|
||||
<Text color="text-gray-500" block mt={4} font="mono">
|
||||
The requested team entity is no longer broadcasting.
|
||||
</Text>
|
||||
<Box mt={8}>
|
||||
<Button variant="primary" onClick={onGoBack}>
|
||||
Return to Base
|
||||
</Button>
|
||||
</Box>
|
||||
<Button variant="primary" onClick={onGoBack}>
|
||||
Go Back
|
||||
</Button>
|
||||
</Stack>
|
||||
</Card>
|
||||
</Container>
|
||||
</Box>
|
||||
</Container>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container size="lg" py={8}>
|
||||
<Stack gap={6}>
|
||||
{/* Breadcrumb */}
|
||||
<Breadcrumbs
|
||||
items={[
|
||||
{ label: 'Home', href: '/' },
|
||||
{ label: 'Teams', href: '/teams' },
|
||||
{ label: team.name }
|
||||
]}
|
||||
/>
|
||||
|
||||
{/* Sponsor Insights Card */}
|
||||
{isSponsorMode && team && (
|
||||
<SponsorInsightsCard
|
||||
entityType="team"
|
||||
entityId={team.id}
|
||||
entityName={team.name}
|
||||
tier="standard"
|
||||
metrics={viewData.teamMetrics}
|
||||
slots={SlotTemplates.team(true, true, 500, 250)}
|
||||
trustScore={90}
|
||||
monthlyActivity={85}
|
||||
onNavigate={(href) => window.location.href = href}
|
||||
<Box bg="base-black" minH="screen">
|
||||
<Container size="lg" py={8}>
|
||||
<Stack gap={8}>
|
||||
<Breadcrumbs
|
||||
items={[
|
||||
{ label: 'Home', href: '/' },
|
||||
{ label: 'Teams', href: '/teams' },
|
||||
{ label: team.name }
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
|
||||
<TeamHero
|
||||
team={{
|
||||
...team,
|
||||
leagues: team.leagues.map(id => ({ id }))
|
||||
}}
|
||||
memberCount={viewData.memberships.length}
|
||||
onUpdate={onUpdate}
|
||||
/>
|
||||
|
||||
{/* Tabs */}
|
||||
<Box borderBottom={true} borderColor="border-charcoal-outline">
|
||||
<Stack direction="row" gap={6}>
|
||||
{viewData.tabs.map((tab) => (
|
||||
tab.visible && (
|
||||
<Box
|
||||
key={tab.id}
|
||||
onClick={() => onTabChange(tab.id)}
|
||||
pb={3}
|
||||
cursor="pointer"
|
||||
borderBottom={activeTab === tab.id ? '2px solid' : '2px solid'}
|
||||
borderColor={activeTab === tab.id ? 'border-primary-blue' : 'border-transparent'}
|
||||
color={activeTab === tab.id ? 'text-primary-blue' : 'text-gray-400'}
|
||||
>
|
||||
<Text weight="medium">{tab.label}</Text>
|
||||
</Box>
|
||||
)
|
||||
))}
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
{activeTab === 'overview' && (
|
||||
<Stack gap={6}>
|
||||
<Grid cols={12} gap={6}>
|
||||
<GridItem colSpan={12} lgSpan={8}>
|
||||
<Card>
|
||||
<Box mb={4}>
|
||||
<Heading level={2}>About</Heading>
|
||||
</Box>
|
||||
<Text color="text-gray-300" leading="relaxed">{team.description}</Text>
|
||||
</Card>
|
||||
</GridItem>
|
||||
|
||||
<GridItem colSpan={12} lgSpan={4}>
|
||||
<Card>
|
||||
<Box mb={4}>
|
||||
<Heading level={2}>Quick Stats</Heading>
|
||||
</Box>
|
||||
<Stack gap={3}>
|
||||
<HorizontalStatItem label="Members" value={viewData.memberships.length.toString()} color="text-primary-blue" />
|
||||
{team.category && (
|
||||
<HorizontalStatItem label="Category" value={team.category} color="text-purple-400" />
|
||||
)}
|
||||
{team.leagues && team.leagues.length > 0 && (
|
||||
<HorizontalStatItem label="Leagues" value={team.leagues.length.toString()} color="text-green-400" />
|
||||
)}
|
||||
{team.createdAt && (
|
||||
<HorizontalStatItem
|
||||
label="Founded"
|
||||
value={DateDisplay.formatMonthYear(team.createdAt)}
|
||||
color="text-gray-300"
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
</Card>
|
||||
</GridItem>
|
||||
</Grid>
|
||||
|
||||
<Card>
|
||||
<Box mb={4}>
|
||||
<Heading level={2}>Recent Activity</Heading>
|
||||
</Box>
|
||||
<Box py={8}>
|
||||
<Text color="text-gray-400" block align="center">No recent activity to display</Text>
|
||||
</Box>
|
||||
</Card>
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
{activeTab === 'roster' && (
|
||||
<TeamRoster
|
||||
teamId={team.id}
|
||||
memberships={viewData.memberships}
|
||||
isAdmin={viewData.isAdmin}
|
||||
onRemoveMember={onRemoveMember}
|
||||
onChangeRole={onChangeRole}
|
||||
{isSponsorMode && (
|
||||
<SponsorInsightsCard
|
||||
entityType="team"
|
||||
entityId={team.id}
|
||||
entityName={team.name}
|
||||
tier="standard"
|
||||
metrics={viewData.teamMetrics}
|
||||
slots={SlotTemplates.team(true, true, 500, 250)}
|
||||
trustScore={90}
|
||||
monthlyActivity={85}
|
||||
onNavigate={(href) => window.location.href = href}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeTab === 'standings' && (
|
||||
<TeamStandings teamId={team.id} leagues={team.leagues} />
|
||||
)}
|
||||
<TeamDetailsHeader
|
||||
teamId={team.id}
|
||||
name={team.name}
|
||||
tag={team.tag}
|
||||
description={team.description}
|
||||
memberCount={viewData.memberships.length}
|
||||
foundedDate={team.createdAt}
|
||||
isAdmin={viewData.isAdmin}
|
||||
onAdminClick={() => onTabChange('admin')}
|
||||
/>
|
||||
|
||||
{activeTab === 'admin' && viewData.isAdmin && (
|
||||
<TeamAdmin team={team} onUpdate={onUpdate} />
|
||||
)}
|
||||
</Box>
|
||||
</Stack>
|
||||
</Container>
|
||||
{/* Tabs */}
|
||||
<Box borderBottom borderColor="outline-steel">
|
||||
<Stack direction="row" gap={8}>
|
||||
{viewData.tabs.map((tab) => (
|
||||
tab.visible && (
|
||||
<Box
|
||||
key={tab.id}
|
||||
onClick={() => onTabChange(tab.id)}
|
||||
pb={4}
|
||||
cursor="pointer"
|
||||
position="relative"
|
||||
>
|
||||
<Text
|
||||
weight="bold"
|
||||
size="xs"
|
||||
uppercase
|
||||
letterSpacing="widest"
|
||||
color={activeTab === tab.id ? 'text-primary-accent' : 'text-gray-500'}
|
||||
>
|
||||
{tab.label}
|
||||
</Text>
|
||||
{activeTab === tab.id && (
|
||||
<Box
|
||||
position="absolute"
|
||||
bottom="-1px"
|
||||
left="0"
|
||||
right="0"
|
||||
h="2px"
|
||||
bg="primary-accent"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
))}
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
{activeTab === 'overview' && (
|
||||
<Stack gap={8}>
|
||||
<Grid cols={12} gap={8}>
|
||||
<GridItem colSpan={12} lgSpan={8}>
|
||||
<Stack gap={8}>
|
||||
<Box border borderColor="outline-steel" bg="surface-charcoal" bgOpacity={0.3} p={6}>
|
||||
<Text size="xs" weight="bold" color="text-gray-400" uppercase>Mission Statement</Text>
|
||||
<Text color="text-gray-300" leading="relaxed" size="sm" block mt={4}>
|
||||
{team.description || 'No description provided.'}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Text size="xs" weight="bold" color="text-gray-400" uppercase mb={4} block>Recent Operations</Text>
|
||||
<Box py={12} border borderStyle="dashed" borderColor="outline-steel" bg="surface-charcoal" bgOpacity={0.1} textAlign="center">
|
||||
<Text color="text-gray-600" font="mono" size="xs">NO RECENT TELEMETRY DATA</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</Stack>
|
||||
</GridItem>
|
||||
|
||||
<GridItem colSpan={12} lgSpan={4}>
|
||||
<Stack gap={6}>
|
||||
<Box border borderColor="outline-steel" bg="surface-charcoal" bgOpacity={0.5} p={6}>
|
||||
<Text size="xs" weight="bold" color="text-gray-400" uppercase mb={4} block>Performance Metrics</Text>
|
||||
<Stack gap={4}>
|
||||
<HorizontalStatItem label="Avg Rating" value="1450" color="text-primary-accent" />
|
||||
<HorizontalStatItem label="Win Rate" value="12.5%" color="text-telemetry-aqua" />
|
||||
<HorizontalStatItem label="Total Podiums" value="42" color="text-warning-amber" />
|
||||
</Stack>
|
||||
</Box>
|
||||
</Stack>
|
||||
</GridItem>
|
||||
</Grid>
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
{activeTab === 'roster' && (
|
||||
<Box>
|
||||
<Stack direction="row" align="center" justify="between" mb={6}>
|
||||
<Text size="xs" weight="bold" color="text-gray-400" uppercase>Active Personnel</Text>
|
||||
<Text size="xs" color="text-gray-500" font="mono">{viewData.memberships.length} UNITS ACTIVE</Text>
|
||||
</Stack>
|
||||
<TeamMembersTable
|
||||
members={viewData.memberships}
|
||||
isAdmin={viewData.isAdmin}
|
||||
onRemoveMember={onRemoveMember}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{activeTab === 'standings' && (
|
||||
<TeamStandingsPanel standings={[]} /> // Mocked for now as in original
|
||||
)}
|
||||
|
||||
{activeTab === 'admin' && viewData.isAdmin && (
|
||||
<TeamAdmin team={team} onUpdate={onUpdate} />
|
||||
)}
|
||||
</Box>
|
||||
</Stack>
|
||||
</Container>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user