import { AchievementGrid } from '@/components/achievements/AchievementGrid'; import { RatingBreakdown } from '@/components/drivers/RatingBreakdown'; import { FriendsPreview } from '@/components/social/FriendsPreview'; import { TeamMembershipGrid } from '@/components/teams/TeamMembershipGrid'; import { Box } from '@/ui/Box'; import { Breadcrumbs } from '@/ui/Breadcrumbs'; import { Button } from '@/ui/Button'; import { Container } from '@/ui/Container'; import { LoadingSpinner } from '@/ui/LoadingSpinner'; import { Stack } from '@/ui/Stack'; import { Text } from '@/ui/Text'; import { ArrowLeft } from 'lucide-react'; import React from 'react'; import { CareerStats } from '@/components/drivers/CareerStats'; import { DriverPerformanceOverview } from '@/components/drivers/DriverPerformanceOverview'; import { DriverProfileHeader } from '@/components/drivers/DriverProfileHeader'; import { DriverProfileTabs, type ProfileTab } from '@/components/drivers/DriverProfileTabs'; import { DriverRacingProfile } from '@/components/drivers/DriverRacingProfile'; import { DriverStatsPanel } from '@/components/drivers/DriverStatsPanel'; import type { DriverProfileViewData } from '@/lib/view-data/DriverProfileViewData'; interface DriverProfileTemplateProps { viewData: DriverProfileViewData; isLoading?: boolean; error?: string | null; onBackClick: () => void; onAddFriend: () => void; friendRequestSent: boolean; activeTab: ProfileTab; onTabChange: (tab: ProfileTab) => void; isSponsorMode?: boolean; sponsorInsights?: React.ReactNode; } export function DriverProfileTemplate({ viewData, isLoading = false, error = null, onBackClick, onAddFriend, friendRequestSent, activeTab, onTabChange, isSponsorMode = false, sponsorInsights = null, }: DriverProfileTemplateProps) { if (isLoading) { return ( Loading driver profile... ); } if (error || !viewData?.currentDriver) { return ( {error || 'Driver not found'} ); } const { currentDriver, stats, teamMemberships, socialSummary, extendedProfile } = viewData; const careerStats = stats ? [ { label: 'Rating', value: stats.ratingLabel, color: 'text-primary-blue' }, { label: 'Wins', value: stats.winsLabel, color: 'text-performance-green' }, { label: 'Podiums', value: stats.podiumsLabel, color: 'text-warning-amber' }, { label: 'Total Races', value: stats.totalRacesLabel }, { label: 'Avg Finish', value: stats.avgFinishLabel, subValue: 'POS' }, { label: 'Consistency', value: stats.consistencyLabel, color: 'text-primary-blue' }, ] : []; return ( {/* Back Navigation & Breadcrumbs */} {/* Sponsor Insights Card */} {isSponsorMode && sponsorInsights} {/* Hero Header Section */} {/* Stats Grid */} {careerStats.length > 0 && ( )} {/* Team Memberships */} {teamMemberships.length > 0 && ( ({ team: { id: m.teamId, name: m.teamName }, role: m.role, joinedAtLabel: m.joinedAtLabel }))} /> )} {/* Tab Navigation */} {/* Tab Content */} {activeTab === 'overview' && ( {stats && ( )} {extendedProfile && ( )} {extendedProfile && extendedProfile.achievements.length > 0 && ( ({ ...a, rarity: a.rarityLabel, earnedAtLabel: a.earnedAtLabel }))} /> )} {socialSummary.friends.length > 0 && ( )} )} {activeTab === 'stats' && ( {stats ? ( ) : ( No statistics available yet This driver hasn't completed any races yet )} )} {activeTab === 'ratings' && ( )} ); }