'use client'; import { RatingBreakdown } from '@/ui/RatingBreakdown'; import { Breadcrumbs } from '@/ui/Breadcrumbs'; import { AchievementGrid } from '@/ui/AchievementGrid'; import { CareerStats } from '@/ui/CareerStats'; import { FriendsPreview } from '@/ui/FriendsPreview'; import { PerformanceOverview } from '@/ui/PerformanceOverview'; import { ProfileBio } from '@/ui/ProfileBio'; import { ProfileHero } from '@/ui/ProfileHero'; import { ProfileTabs, type ProfileTab } from '@/ui/ProfileTabs'; import { RacingProfile } from '@/ui/RacingProfile'; import { TeamMembershipGrid } from '@/ui/TeamMembershipGrid'; import { Box } from '@/ui/Box'; 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 type { DriverProfileViewData } from '../../../lib/types/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; return ( {/* Back Navigation */} {/* Breadcrumb */} {/* Sponsor Insights Card */} {isSponsorMode && sponsorInsights} {/* Hero Header Section */} {/* Bio Section */} {currentDriver.bio && } {/* Team Memberships */} {teamMemberships.length > 0 && ( ({ team: { id: m.teamId, name: m.teamName }, role: m.role, joinedAt: new Date(m.joinedAt) }))} /> )} {/* Performance Overview */} {stats && ( )} {/* Tab Navigation */} {/* Tab Content */} {activeTab === 'overview' && ( {extendedProfile && ( )} {extendedProfile && extendedProfile.achievements.length > 0 && ( ({ ...a, earnedAt: new Date(a.earnedAt) }))} /> )} {socialSummary.friends.length > 0 && ( )} )} {activeTab === 'stats' && !stats && ( No statistics available yet This driver hasn't completed any races yet )} {activeTab === 'ratings' && ( )} ); }