'use client'; import { useState, FormEvent } from 'react'; import { useRouter } from 'next/navigation'; import Image from 'next/image'; import { User, Globe, Flag, Car, Heart, Clock, Check, ChevronRight, ChevronLeft, Gamepad2, Target, Zap, Trophy, Users, MapPin, Mail, Calendar, AlertCircle, } from 'lucide-react'; import Card from '@/components/ui/Card'; import Button from '@/components/ui/Button'; import Input from '@/components/ui/Input'; import Heading from '@/components/ui/Heading'; import { Driver } from '@gridpilot/racing'; import { getDriverRepository } from '@/lib/di-container'; // ============================================================================ // TYPES // ============================================================================ type OnboardingStep = 1 | 2 | 3 | 4; interface PersonalInfo { firstName: string; lastName: string; displayName: string; email: string; country: string; timezone: string; } interface RacingInfo { iracingId: string; experienceLevel: 'beginner' | 'intermediate' | 'advanced' | 'pro'; preferredDiscipline: string; yearsRacing: string; } interface PreferencesInfo { favoriteTrack: string; favoriteCar: string; racingStyle: string; availability: string; lookingForTeam: boolean; openToRequests: boolean; } interface BioInfo { bio: string; goals: string; } interface FormErrors { firstName?: string; lastName?: string; displayName?: string; email?: string; country?: string; iracingId?: string; submit?: string; } // ============================================================================ // CONSTANTS // ============================================================================ const COUNTRIES = [ { code: 'US', name: 'United States' }, { code: 'GB', name: 'United Kingdom' }, { code: 'DE', name: 'Germany' }, { code: 'NL', name: 'Netherlands' }, { code: 'FR', name: 'France' }, { code: 'IT', name: 'Italy' }, { code: 'ES', name: 'Spain' }, { code: 'AU', name: 'Australia' }, { code: 'CA', name: 'Canada' }, { code: 'BR', name: 'Brazil' }, { code: 'JP', name: 'Japan' }, { code: 'BE', name: 'Belgium' }, { code: 'AT', name: 'Austria' }, { code: 'CH', name: 'Switzerland' }, { code: 'SE', name: 'Sweden' }, { code: 'NO', name: 'Norway' }, { code: 'DK', name: 'Denmark' }, { code: 'FI', name: 'Finland' }, { code: 'PL', name: 'Poland' }, { code: 'PT', name: 'Portugal' }, ]; const TIMEZONES = [ { value: 'America/New_York', label: 'Eastern Time (ET)' }, { value: 'America/Chicago', label: 'Central Time (CT)' }, { value: 'America/Denver', label: 'Mountain Time (MT)' }, { value: 'America/Los_Angeles', label: 'Pacific Time (PT)' }, { value: 'Europe/London', label: 'Greenwich Mean Time (GMT)' }, { value: 'Europe/Berlin', label: 'Central European Time (CET)' }, { value: 'Europe/Paris', label: 'Central European Time (CET)' }, { value: 'Australia/Sydney', label: 'Australian Eastern Time (AET)' }, { value: 'Asia/Tokyo', label: 'Japan Standard Time (JST)' }, { value: 'America/Sao_Paulo', label: 'BrasΓlia Time (BRT)' }, ]; const EXPERIENCE_LEVELS = [ { value: 'beginner', label: 'Beginner', description: 'Just getting started with sim racing' }, { value: 'intermediate', label: 'Intermediate', description: '1-2 years of experience' }, { value: 'advanced', label: 'Advanced', description: '3+ years, competitive racing' }, { value: 'pro', label: 'Pro/Semi-Pro', description: 'Professional level competition' }, ]; const DISCIPLINES = [ { value: 'road', label: 'Road Racing', icon: 'ποΈ' }, { value: 'oval', label: 'Oval Racing', icon: 'π' }, { value: 'dirt-road', label: 'Dirt Road', icon: 'π' }, { value: 'dirt-oval', label: 'Dirt Oval', icon: 'ποΈ' }, { value: 'multi', label: 'Multi-discipline', icon: 'π―' }, ]; const RACING_STYLES = [ { value: 'aggressive', label: 'Aggressive Overtaker', icon: 'β‘' }, { value: 'consistent', label: 'Consistent Pacer', icon: 'π' }, { value: 'strategic', label: 'Strategic Calculator', icon: 'π§ ' }, { value: 'late-braker', label: 'Late Braker', icon: 'π―' }, { value: 'smooth', label: 'Smooth Operator', icon: 'β¨' }, ]; const AVAILABILITY = [ { value: 'weekday-evenings', label: 'Weekday Evenings (18:00-23:00)' }, { value: 'weekends', label: 'Weekends Only' }, { value: 'late-nights', label: 'Late Nights (22:00-02:00)' }, { value: 'flexible', label: 'Flexible Schedule' }, { value: 'mornings', label: 'Mornings (06:00-12:00)' }, ]; // ============================================================================ // HELPER COMPONENTS // ============================================================================ function StepIndicator({ currentStep, totalSteps }: { currentStep: number; totalSteps: number }) { const steps = [ { id: 1, label: 'Personal', icon: User }, { id: 2, label: 'Racing', icon: Gamepad2 }, { id: 3, label: 'Preferences', icon: Heart }, { id: 4, label: 'Bio & Goals', icon: Target }, ]; return (
Let's set up your racing profile in just a few steps
You can always update your profile later in the settings