'use client'; import React from 'react'; import { Mail, Lock, Eye, EyeOff, UserPlus, AlertCircle, Flag, User, Check, X, Car, Users, Trophy, Shield, Sparkles, } from 'lucide-react'; import { Card } from '@/ui/Card'; import { Button } from '@/ui/Button'; import { Input } from '@/ui/Input'; import { Heading } from '@/ui/Heading'; import { Box } from '@/ui/Box'; import { Stack } from '@/ui/Stack'; import { Text } from '@/ui/Text'; import { Link } from '@/ui/Link'; import { Surface } from '@/ui/Surface'; import { Icon } from '@/ui/Icon'; import { LoadingSpinner } from '@/ui/LoadingSpinner'; import { SignupViewData } from '@/lib/builders/view-data/types/SignupViewData'; import { checkPasswordStrength } from '@/lib/utils/validation'; interface SignupTemplateProps { viewData: SignupViewData; formActions: { handleChange: (e: React.ChangeEvent) => void; handleSubmit: (e: React.FormEvent) => Promise; setShowPassword: (show: boolean) => void; setShowConfirmPassword: (show: boolean) => void; }; uiState: { showPassword: boolean; showConfirmPassword: boolean; }; mutationState: { isPending: boolean; error: string | null; }; } const USER_ROLES = [ { icon: Car, title: 'Driver', description: 'Race, track stats, join teams', color: '#3b82f6', bg: 'bg-blue-500/10', }, { icon: Trophy, title: 'League Admin', description: 'Organize leagues and events', color: '#10b981', bg: 'bg-green-500/10', }, { icon: Users, title: 'Team Manager', description: 'Manage team and drivers', color: '#a855f7', bg: 'bg-purple-500/10', }, ]; const FEATURES = [ 'Track your racing statistics and progress', 'Join or create competitive leagues', 'Build or join racing teams', 'Connect your iRacing account', 'Compete in organized events', 'Access detailed performance analytics', ]; export function SignupTemplate({ viewData, formActions, uiState, mutationState }: SignupTemplateProps) { const passwordStrength = checkPasswordStrength(viewData.formState.fields.password.value); const passwordRequirements = [ { met: viewData.formState.fields.password.value.length >= 8, label: 'At least 8 characters' }, { met: /[a-z]/.test(viewData.formState.fields.password.value) && /[A-Z]/.test(viewData.formState.fields.password.value), label: 'Upper and lowercase letters' }, { met: /\d/.test(viewData.formState.fields.password.value), label: 'At least one number' }, { met: /[^a-zA-Z\d]/.test(viewData.formState.fields.password.value), label: 'At least one special character' }, ]; return ( {/* Background Pattern */} {/* Left Side - Info Panel (Hidden on mobile) */} {/* Logo */} GridPilot Start Your Racing Journey Join thousands of sim racers. One account gives you access to all roles - race as a driver, organize leagues, or manage teams. {/* Role Cards */} {USER_ROLES.map((role) => ( {role.title} {role.description} ))} {/* Features List */} What you'll get {FEATURES.map((feature, index) => ( {feature} ))} {/* Trust Indicators */} Secure signup iRacing integration {/* Right Side - Signup Form */} {/* Mobile Logo/Header */} Join GridPilot Create your account and start racing {/* Desktop Header */} Create Account Get started with your free account {/* Background accent */} {/* First Name */} First Name {viewData.formState.fields.firstName.error && ( {viewData.formState.fields.firstName.error} )} {/* Last Name */} Last Name {viewData.formState.fields.lastName.error && ( {viewData.formState.fields.lastName.error} )} Your name will be used as-is and cannot be changed later {/* Name Immutability Warning */} Important: Your name cannot be changed after signup. Please ensure it's correct. {/* Email */} Email Address {viewData.formState.fields.email.error && ( {viewData.formState.fields.email.error} )} {/* Password */} Password formActions.setShowPassword(!uiState.showPassword)} position="absolute" right="3" top="50%" zIndex={10} bg="transparent" borderStyle="none" cursor="pointer" > {viewData.formState.fields.password.error && ( {viewData.formState.fields.password.error} )} {/* Password Strength */} {viewData.formState.fields.password.value && ( {passwordStrength.label} {passwordRequirements.map((req, index) => ( {req.label} ))} )} {/* Confirm Password */} Confirm Password formActions.setShowConfirmPassword(!uiState.showConfirmPassword)} position="absolute" right="3" top="50%" zIndex={10} bg="transparent" borderStyle="none" cursor="pointer" > {viewData.formState.fields.confirmPassword.error && ( {viewData.formState.fields.confirmPassword.error} )} {viewData.formState.fields.confirmPassword.value && viewData.formState.fields.password.value === viewData.formState.fields.confirmPassword.value && ( Passwords match )} {/* Submit Button */} {/* Divider */} or continue with {/* Login Link */} Already have an account?{' '} Sign in {/* Footer */} By creating an account, you agree to our{' '} Terms of Service {' '}and{' '} Privacy Policy {/* Mobile Role Info */} One account for all roles {USER_ROLES.map((role) => ( {role.title} ))} ); }