'use client'; import React from 'react'; import { CreateDriverForm } from '@/components/drivers/CreateDriverForm'; import { ProfileRaceHistory } from '@/components/drivers/ProfileRaceHistory'; import { ProfileSettings } from '@/components/drivers/ProfileSettings'; import { AchievementGrid } from '@/ui/AchievementGrid'; import { ProfileHero } from '@/ui/ProfileHero'; import { ProfileStatGrid } from '@/ui/ProfileStatGrid'; import { ProfileTabs, type ProfileTab as ProfileTabsType } from '@/ui/ProfileTabs'; import { TeamMembershipGrid } from '@/ui/TeamMembershipGrid'; import type { ProfileViewData } from '@/lib/view-data/ProfileViewData'; import { Box } from '@/ui/Box'; import { Button } from '@/ui/Button'; import { Card } from '@/ui/Card'; import { Container } from '@/ui/Container'; import { Heading } from '@/ui/Heading'; import { Icon } from '@/ui/Icon'; import { Stack } from '@/ui/Stack'; import { Surface } from '@/ui/Surface'; import { Text } from '@/ui/Text'; import { Activity, Award, History, User, } from 'lucide-react'; import { Breadcrumbs } from '@/ui/Breadcrumbs'; export type ProfileTab = 'overview' | 'history' | 'stats'; interface ProfileTemplateProps { viewData: ProfileViewData; mode: 'profile-exists' | 'needs-profile'; activeTab: ProfileTab; onTabChange: (tab: ProfileTab) => void; editMode: boolean; onEditModeChange: (edit: boolean) => void; friendRequestSent: boolean; onFriendRequestSend: () => void; onSaveSettings: (updates: { bio?: string; country?: string }) => Promise; } export function ProfileTemplate({ viewData, mode, activeTab, onTabChange, editMode, onEditModeChange, friendRequestSent, onFriendRequestSend, onSaveSettings, }: ProfileTemplateProps) { if (mode === 'needs-profile') { return ( Create Your Driver Profile Join the GridPilot community and start your racing journey Get Started Create your driver profile to join leagues, compete in races, and connect with other drivers. {}} isPending={false} /> ); } if (editMode) { return ( Edit Profile { await onSaveSettings(updates); onEditModeChange(false); }} /> ); } return ( {/* Back Navigation */} {/* Breadcrumb */} ({ ...s, platform: s.platformLabel })) || []} onAddFriend={onFriendRequestSend} friendRequestSent={friendRequestSent} /> {viewData.driver.bio && ( }> About {viewData.driver.bio} )} {viewData.teamMemberships.length > 0 && ( ({ team: { id: m.teamId, name: m.teamName }, role: m.roleLabel, joinedAt: new Date() // Placeholder }))} /> )} void} /> {activeTab === 'history' && ( }> Race History )} {activeTab === 'stats' && viewData.stats && ( }> Performance Overview )} {activeTab === 'overview' && viewData.extendedProfile && ( }> Achievements {viewData.extendedProfile.achievements.length} earned ({ ...a, rarity: a.rarityLabel, earnedAt: new Date() // Placeholder }))} /> )} ); }