'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { motion, useReducedMotion } from 'framer-motion'; import Card from '@/components/ui/Card'; import Button from '@/components/ui/Button'; import Input from '@/components/ui/Input'; import SponsorHero from '@/components/sponsors/SponsorHero'; import SponsorWorkflowMockup from '@/components/sponsors/SponsorWorkflowMockup'; import SponsorBenefitCard from '@/components/sponsors/SponsorBenefitCard'; import { siteConfig } from '@/lib/siteConfig'; import { Building2, Mail, Globe, Upload, Eye, TrendingUp, Users, ArrowRight, Trophy, Car, Flag, Target, BarChart3, Shield, CheckCircle2, Star, Megaphone } from 'lucide-react'; // Sponsorship type definitions interface SponsorshipType { id: string; title: string; icon: typeof Trophy; description: string; benefits: string[]; priceRange: string; color: string; } const SPONSORSHIP_TYPES: SponsorshipType[] = [ { id: 'leagues', title: 'League Sponsorship', icon: Trophy, description: 'Sponsor entire racing leagues and get your brand in front of all participants and viewers.', benefits: [ 'Logo on all participant liveries', 'League page banner placement', 'Results page branding', 'Social media mentions' ], priceRange: '$200 - $2,000/season', color: 'text-primary-blue', }, { id: 'teams', title: 'Team Sponsorship', icon: Users, description: 'Partner with competitive racing teams to build long-term brand associations.', benefits: [ 'Team livery logo placement', 'Team profile visibility', 'Driver association', 'Event representation' ], priceRange: '$100 - $800/season', color: 'text-purple-400', }, { id: 'drivers', title: 'Driver Sponsorship', icon: Car, description: 'Support individual drivers and grow with rising sim racing talent.', benefits: [ 'Personal livery branding', 'Driver profile sponsor badge', 'Race results association', 'Direct driver partnership' ], priceRange: '$50 - $300/season', color: 'text-performance-green', }, { id: 'races', title: 'Race Sponsorship', icon: Flag, description: 'Sponsor individual race events for targeted, high-impact exposure.', benefits: [ 'Race title naming rights', 'Event page branding', 'Results page placement', 'Social media features' ], priceRange: '$50 - $500/race', color: 'text-warning-amber', }, { id: 'platform', title: 'Platform Advertising', icon: Megaphone, description: 'Reach the entire GridPilot audience with strategic platform placements.', benefits: [ 'Homepage banner ads', 'Sidebar placements', 'Newsletter inclusion', 'Cross-platform exposure' ], priceRange: '$100 - $1,000/month', color: 'text-racing-red', }, ]; // Stats for social proof const PLATFORM_STATS = [ { value: '50,000+', label: 'Monthly Race Views' }, { value: '12,000+', label: 'Active Drivers' }, { value: '500+', label: 'Racing Leagues' }, { value: '4.8%', label: 'Avg. Engagement Rate' }, ]; export default function SponsorSignupPage() { const router = useRouter(); const shouldReduceMotion = useReducedMotion(); const [mode, setMode] = useState<'landing' | 'signup' | 'login'>('landing'); const [formData, setFormData] = useState({ companyName: '', contactEmail: '', websiteUrl: '', logoFile: null as File | null, password: '', confirmPassword: '', interests: [] as string[], acceptTerms: false, acceptVat: false, }); const [errors, setErrors] = useState>({}); const [submitting, setSubmitting] = useState(false); const handleDemoLogin = async () => { setSubmitting(true); try { // Use the demo login API instead of setting cookies const response = await fetch('/api/auth/demo-login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ role: 'sponsor' }), }); if (!response.ok) { throw new Error('Demo login failed'); } router.push('/sponsor/dashboard'); } catch (error) { console.error('Demo login failed:', error); alert('Demo login failed. Please check the API server status.'); } finally { setSubmitting(false); } }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); const newErrors: Record = {}; if (!formData.companyName.trim()) { newErrors.companyName = 'Company name required'; } if (!formData.contactEmail.trim()) { newErrors.contactEmail = 'Contact email required'; } else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.contactEmail)) { newErrors.contactEmail = 'Invalid email format'; } if (mode === 'signup') { if (!formData.password.trim()) { newErrors.password = 'Password required'; } else if (formData.password.length < 8) { newErrors.password = 'Password must be at least 8 characters'; } if (formData.password !== formData.confirmPassword) { newErrors.confirmPassword = 'Passwords do not match'; } if (!formData.acceptTerms) { newErrors.acceptTerms = 'You must accept the terms and conditions'; } if (!formData.acceptVat) { newErrors.acceptVat = 'You must acknowledge the VAT policy'; } } if (Object.keys(newErrors).length > 0) { setErrors(newErrors); return; } setSubmitting(true); try { // For demo purposes, use the demo login API with sponsor role // In production, this would create a real sponsor account const response = await fetch('/api/auth/demo-login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ role: 'sponsor' }), }); if (!response.ok) { throw new Error('Signup failed'); } router.push('/sponsor/dashboard'); } catch (err) { console.error('Sponsor signup failed:', err); alert('Registration failed. Try again.'); } finally { setSubmitting(false); } }; const toggleInterest = (id: string) => { setFormData(prev => ({ ...prev, interests: prev.interests.includes(id) ? prev.interests.filter(i => i !== id) : [...prev.interests, id] })); }; // Landing page for sponsors if (mode === 'landing') { return (
{/* Hero Section */}
{/* Demo Login */}
{/* Platform Stats */}
{PLATFORM_STATS.map((stat, index) => (
{stat.value}
{stat.label}
))}
{/* Sponsorship Types Section */}

Sponsorship Opportunities

Choose how you want to connect with the sim racing community. Multiple sponsorship tiers and types to fit every budget and goal.

{SPONSORSHIP_TYPES.map((type, index) => (

{type.title}

{type.priceRange}

{type.description}

    {type.benefits.map((benefit, i) => (
  • {benefit}
  • ))}
))}
{/* Workflow Mockup Section */}

How It Works

From discovery to results tracking — a seamless sponsorship experience.

{/* Benefits Grid */}

Why Sponsor on GridPilot?

Professional tools and genuine community engagement make your sponsorship worthwhile.

{/* CTA Section */}

Ready to Grow Your Brand?

Join sponsors connecting with sim racing communities worldwide.

); } // Login form if (mode === 'login') { return (

Sponsor Sign In

Access your sponsor dashboard

setFormData({ ...formData, contactEmail: e.target.value })} placeholder="sponsor@company.com" error={!!errors.contactEmail} errorMessage={errors.contactEmail} />
setFormData({ ...formData, password: e.target.value })} placeholder="••••••••" error={!!errors.password} errorMessage={errors.password} />

Don't have an account?{' '}

); } // Signup form return (
{/* Header */}

Create Sponsor Account

Register your company to sponsor racing entities

{/* Company Information */}

Company Information

setFormData({ ...formData, companyName: e.target.value })} placeholder="Your company name" error={!!errors.companyName} errorMessage={errors.companyName} />
setFormData({ ...formData, contactEmail: e.target.value })} placeholder="sponsor@company.com" error={!!errors.contactEmail} errorMessage={errors.contactEmail} />
setFormData({ ...formData, websiteUrl: e.target.value })} placeholder="https://company.com" />
{/* Sponsorship Interests */}

Sponsorship Interests

Select the types of sponsorships you're interested in (optional)

{SPONSORSHIP_TYPES.map((type) => { const isSelected = formData.interests.includes(type.id); return ( ); })}
{/* Company Logo */}
{ const file = e.target.files?.[0] || null; setFormData({ ...formData, logoFile: file }); }} className="block w-full text-sm text-gray-400 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-primary-blue/10 file:text-primary-blue hover:file:bg-primary-blue/20" />

PNG, JPEG, or SVG. Recommended: 500x500px transparent background.

{/* Account Security */}

Account Security

setFormData({ ...formData, password: e.target.value })} placeholder="Min. 8 characters" error={!!errors.password} errorMessage={errors.password} />
setFormData({ ...formData, confirmPassword: e.target.value })} placeholder="Confirm password" error={!!errors.confirmPassword} errorMessage={errors.confirmPassword} />
{/* Legal Agreements */}
{errors.acceptTerms && (

{errors.acceptTerms}

)} {errors.acceptVat && (

{errors.acceptVat}

)}
{/* Actions */}

Already have an account?{' '}

); }