auth rework

This commit is contained in:
2025-12-17 15:34:56 +01:00
parent a213a5cf9f
commit 75eaa1aa9f
24 changed files with 6115 additions and 1992 deletions

View File

@@ -1,40 +1,78 @@
'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 {
CreditCard,
DollarSign,
import StatCard from '@/components/ui/StatCard';
import SectionHeader from '@/components/ui/SectionHeader';
import StatusBadge from '@/components/ui/StatusBadge';
import InfoBanner from '@/components/ui/InfoBanner';
import PageHeader from '@/components/ui/PageHeader';
import { siteConfig } from '@/lib/siteConfig';
import {
CreditCard,
DollarSign,
Calendar,
Download,
Plus,
Check,
AlertTriangle,
FileText,
ArrowRight
ArrowRight,
TrendingUp,
Receipt,
Building2,
Wallet,
Clock,
ChevronRight,
Info,
ExternalLink,
Percent
} from 'lucide-react';
// ============================================================================
// Types
// ============================================================================
interface PaymentMethod {
id: string;
type: 'card' | 'bank';
type: 'card' | 'bank' | 'sepa';
last4: string;
brand?: string;
isDefault: boolean;
expiryMonth?: number;
expiryYear?: number;
bankName?: string;
}
interface Invoice {
id: string;
invoiceNumber: string;
date: Date;
dueDate: Date;
amount: number;
status: 'paid' | 'pending' | 'failed';
vatAmount: number;
totalAmount: number;
status: 'paid' | 'pending' | 'overdue' | 'failed';
description: string;
sponsorshipType: 'league' | 'team' | 'driver' | 'race' | 'platform';
pdfUrl: string;
}
// Mock data
interface BillingStats {
totalSpent: number;
pendingAmount: number;
nextPaymentDate: Date;
nextPaymentAmount: number;
activeSponsorships: number;
averageMonthlySpend: number;
}
// ============================================================================
// Mock Data
// ============================================================================
const MOCK_PAYMENT_METHODS: PaymentMethod[] = [
{
id: 'pm-1',
@@ -54,49 +92,142 @@ const MOCK_PAYMENT_METHODS: PaymentMethod[] = [
expiryMonth: 6,
expiryYear: 2026,
},
{
id: 'pm-3',
type: 'sepa',
last4: '8901',
bankName: 'Deutsche Bank',
isDefault: false,
},
];
const MOCK_INVOICES: Invoice[] = [
{
id: 'inv-1',
invoiceNumber: 'GP-2025-001234',
date: new Date('2025-11-01'),
amount: 1200,
dueDate: new Date('2025-11-15'),
amount: 1090.91,
vatAmount: 207.27,
totalAmount: 1298.18,
status: 'paid',
description: 'GT3 Pro Championship - Main Sponsor (Q4 2025)',
description: 'GT3 Pro Championship - Primary Sponsor (Q4 2025)',
sponsorshipType: 'league',
pdfUrl: '#',
},
{
id: 'inv-2',
invoiceNumber: 'GP-2025-001235',
date: new Date('2025-10-01'),
amount: 400,
dueDate: new Date('2025-10-15'),
amount: 363.64,
vatAmount: 69.09,
totalAmount: 432.73,
status: 'paid',
description: 'Formula Sim Series - Secondary Sponsor (Q4 2025)',
description: 'Team Velocity - Gear Sponsor (Q4 2025)',
sponsorshipType: 'team',
pdfUrl: '#',
},
{
id: 'inv-3',
invoiceNumber: 'GP-2025-001236',
date: new Date('2025-12-01'),
amount: 350,
dueDate: new Date('2025-12-15'),
amount: 318.18,
vatAmount: 60.45,
totalAmount: 378.63,
status: 'pending',
description: 'Alex Thompson - Driver Sponsorship (Dec 2025)',
sponsorshipType: 'driver',
pdfUrl: '#',
},
{
id: 'inv-4',
invoiceNumber: 'GP-2025-001237',
date: new Date('2025-11-15'),
dueDate: new Date('2025-11-29'),
amount: 454.55,
vatAmount: 86.36,
totalAmount: 540.91,
status: 'overdue',
description: 'Touring Car Cup - Secondary Sponsor (Q1 2026)',
sponsorshipType: 'league',
pdfUrl: '#',
},
];
function PaymentMethodCard({ method, onSetDefault }: { method: PaymentMethod; onSetDefault: () => void }) {
const MOCK_STATS: BillingStats = {
totalSpent: 12450,
pendingAmount: 919.54,
nextPaymentDate: new Date('2025-12-15'),
nextPaymentAmount: 378.63,
activeSponsorships: 6,
averageMonthlySpend: 2075,
};
// ============================================================================
// Components
// ============================================================================
function PaymentMethodCard({
method,
onSetDefault,
onRemove
}: {
method: PaymentMethod;
onSetDefault: () => void;
onRemove: () => void;
}) {
const shouldReduceMotion = useReducedMotion();
const getIcon = () => {
if (method.type === 'sepa') return Building2;
return CreditCard;
};
const Icon = getIcon();
const getLabel = () => {
if (method.type === 'sepa' && method.bankName) {
return `${method.bankName} •••• ${method.last4}`;
}
return `${method.brand} •••• ${method.last4}`;
};
return (
<div className={`p-4 rounded-lg border ${method.isDefault ? 'border-primary-blue/50 bg-primary-blue/5' : 'border-charcoal-outline bg-iron-gray/30'}`}>
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: shouldReduceMotion ? 0 : 0.2 }}
className={`p-4 rounded-xl border transition-all ${
method.isDefault
? 'border-primary-blue/50 bg-gradient-to-r from-primary-blue/10 to-transparent shadow-[0_0_20px_rgba(25,140,255,0.1)]'
: 'border-charcoal-outline bg-iron-gray/30 hover:border-charcoal-outline/80'
}`}
>
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-lg bg-iron-gray flex items-center justify-center">
<CreditCard className="w-5 h-5 text-gray-400" />
<div className="flex items-center gap-4">
<div className={`w-12 h-12 rounded-xl flex items-center justify-center ${
method.isDefault ? 'bg-primary-blue/20' : 'bg-iron-gray'
}`}>
<Icon className={`w-6 h-6 ${method.isDefault ? 'text-primary-blue' : 'text-gray-400'}`} />
</div>
<div>
<div className="flex items-center gap-2">
<span className="font-medium text-white">{method.brand} {method.last4}</span>
<span className="font-medium text-white">{getLabel()}</span>
{method.isDefault && (
<span className="px-2 py-0.5 rounded text-xs bg-primary-blue/20 text-primary-blue">Default</span>
<span className="px-2 py-0.5 rounded-full text-xs bg-primary-blue/20 text-primary-blue font-medium">
Default
</span>
)}
</div>
{method.expiryMonth && method.expiryYear && (
<span className="text-sm text-gray-500">Expires {method.expiryMonth}/{method.expiryYear}</span>
<span className="text-sm text-gray-500">
Expires {String(method.expiryMonth).padStart(2, '0')}/{method.expiryYear}
</span>
)}
{method.type === 'sepa' && (
<span className="text-sm text-gray-500">SEPA Direct Debit</span>
)}
</div>
</div>
@@ -106,58 +237,120 @@ function PaymentMethodCard({ method, onSetDefault }: { method: PaymentMethod; on
Set Default
</Button>
)}
<Button variant="secondary" className="text-xs text-gray-400">
<Button variant="secondary" onClick={onRemove} className="text-xs text-gray-400 hover:text-racing-red">
Remove
</Button>
</div>
</div>
</div>
</motion.div>
);
}
function InvoiceRow({ invoice }: { invoice: Invoice }) {
function InvoiceRow({ invoice, index }: { invoice: Invoice; index: number }) {
const shouldReduceMotion = useReducedMotion();
const statusConfig = {
paid: { icon: Check, color: 'text-performance-green', bg: 'bg-performance-green/10' },
pending: { icon: AlertTriangle, color: 'text-warning-amber', bg: 'bg-warning-amber/10' },
failed: { icon: AlertTriangle, color: 'text-racing-red', bg: 'bg-racing-red/10' },
paid: {
icon: Check,
label: 'Paid',
color: 'text-performance-green',
bg: 'bg-performance-green/10',
border: 'border-performance-green/30'
},
pending: {
icon: Clock,
label: 'Pending',
color: 'text-warning-amber',
bg: 'bg-warning-amber/10',
border: 'border-warning-amber/30'
},
overdue: {
icon: AlertTriangle,
label: 'Overdue',
color: 'text-racing-red',
bg: 'bg-racing-red/10',
border: 'border-racing-red/30'
},
failed: {
icon: AlertTriangle,
label: 'Failed',
color: 'text-racing-red',
bg: 'bg-racing-red/10',
border: 'border-racing-red/30'
},
};
const typeLabels = {
league: 'League',
team: 'Team',
driver: 'Driver',
race: 'Race',
platform: 'Platform',
};
const status = statusConfig[invoice.status];
const StatusIcon = status.icon;
return (
<div className="flex items-center justify-between p-4 border-b border-charcoal-outline last:border-b-0 hover:bg-iron-gray/20 transition-colors">
<div className="flex items-center gap-4">
<motion.div
initial={{ opacity: 0, x: -10 }}
animate={{ opacity: 1, x: 0 }}
transition={{ duration: shouldReduceMotion ? 0 : 0.2, delay: shouldReduceMotion ? 0 : index * 0.05 }}
className="flex items-center justify-between p-4 border-b border-charcoal-outline/50 last:border-b-0 hover:bg-iron-gray/20 transition-colors group"
>
<div className="flex items-center gap-4 flex-1">
<div className="w-10 h-10 rounded-lg bg-iron-gray flex items-center justify-center">
<FileText className="w-5 h-5 text-gray-400" />
<Receipt className="w-5 h-5 text-gray-400" />
</div>
<div>
<div className="font-medium text-white">{invoice.description}</div>
<div className="text-sm text-gray-500">
{invoice.date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2 mb-0.5">
<span className="font-medium text-white truncate">{invoice.description}</span>
<span className="px-2 py-0.5 rounded text-xs bg-iron-gray text-gray-400 flex-shrink-0">
{typeLabels[invoice.sponsorshipType]}
</span>
</div>
<div className="flex items-center gap-3 text-sm text-gray-500">
<span>{invoice.invoiceNumber}</span>
<span></span>
<span>
{invoice.date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })}
</span>
</div>
</div>
</div>
<div className="flex items-center gap-4">
<div className="flex items-center gap-6">
<div className="text-right">
<div className="font-semibold text-white">${invoice.amount.toLocaleString()}</div>
<div className={`flex items-center gap-1 text-xs ${status.color}`}>
<StatusIcon className="w-3 h-3" />
{invoice.status.charAt(0).toUpperCase() + invoice.status.slice(1)}
<div className="font-semibold text-white">
{invoice.totalAmount.toLocaleString('de-DE', { minimumFractionDigits: 2 })}
</div>
<div className="text-xs text-gray-500">
incl. {invoice.vatAmount.toLocaleString('de-DE', { minimumFractionDigits: 2 })} VAT
</div>
</div>
<Button variant="secondary" className="text-xs">
<div className={`flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium ${status.bg} ${status.color} border ${status.border}`}>
<StatusIcon className="w-3 h-3" />
{status.label}
</div>
<Button variant="secondary" className="text-xs opacity-0 group-hover:opacity-100 transition-opacity">
<Download className="w-3 h-3 mr-1" />
PDF
</Button>
</div>
</div>
</motion.div>
);
}
// ============================================================================
// Main Component
// ============================================================================
export default function SponsorBillingPage() {
const router = useRouter();
const shouldReduceMotion = useReducedMotion();
const [paymentMethods, setPaymentMethods] = useState(MOCK_PAYMENT_METHODS);
const [showAllInvoices, setShowAllInvoices] = useState(false);
const handleSetDefault = (methodId: string) => {
setPaymentMethods(methods =>
@@ -165,103 +358,229 @@ export default function SponsorBillingPage() {
);
};
const totalSpent = MOCK_INVOICES.filter(i => i.status === 'paid').reduce((sum, i) => sum + i.amount, 0);
const pendingAmount = MOCK_INVOICES.filter(i => i.status === 'pending').reduce((sum, i) => sum + i.amount, 0);
const handleRemoveMethod = (methodId: string) => {
if (confirm('Remove this payment method?')) {
setPaymentMethods(methods => methods.filter(m => m.id !== methodId));
}
};
const displayedInvoices = showAllInvoices ? MOCK_INVOICES : MOCK_INVOICES.slice(0, 4);
const containerVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: shouldReduceMotion ? 0 : 0.1,
},
},
};
const itemVariants = {
hidden: { opacity: 0, y: 20 },
visible: { opacity: 1, y: 0 },
};
return (
<div className="max-w-4xl mx-auto py-8 px-4">
<motion.div
className="max-w-5xl mx-auto py-8 px-4"
variants={containerVariants}
initial="hidden"
animate="visible"
>
{/* Header */}
<div className="mb-8">
<h1 className="text-2xl font-bold text-white flex items-center gap-3">
<CreditCard className="w-7 h-7 text-warning-amber" />
Billing & Payments
</h1>
<p className="text-gray-400 mt-1">Manage payment methods and view invoices</p>
</div>
<motion.div variants={itemVariants}>
<PageHeader
icon={Wallet}
title="Billing & Payments"
description="Manage payment methods, view invoices, and track your sponsorship spending"
iconGradient="from-warning-amber/20 to-warning-amber/5"
iconBorder="border-warning-amber/30"
/>
</motion.div>
{/* Summary Cards */}
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 mb-8">
<Card className="p-4">
<div className="flex items-center gap-3 mb-2">
<DollarSign className="w-5 h-5 text-performance-green" />
<span className="text-sm text-gray-400">Total Spent</span>
</div>
<div className="text-2xl font-bold text-white">${totalSpent.toLocaleString()}</div>
</Card>
<Card className="p-4">
<div className="flex items-center gap-3 mb-2">
<AlertTriangle className="w-5 h-5 text-warning-amber" />
<span className="text-sm text-gray-400">Pending</span>
</div>
<div className="text-2xl font-bold text-warning-amber">${pendingAmount.toLocaleString()}</div>
</Card>
<Card className="p-4">
<div className="flex items-center gap-3 mb-2">
<Calendar className="w-5 h-5 text-primary-blue" />
<span className="text-sm text-gray-400">Next Payment</span>
</div>
<div className="text-lg font-bold text-white">Dec 15, 2025</div>
</Card>
</div>
{/* Stats Grid */}
<motion.div variants={itemVariants} className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
<StatCard
icon={DollarSign}
label="Total Spent"
value={`${MOCK_STATS.totalSpent.toLocaleString('de-DE')}`}
subValue="All time"
color="text-performance-green"
bgColor="bg-performance-green/10"
/>
<StatCard
icon={AlertTriangle}
label="Pending Payments"
value={`${MOCK_STATS.pendingAmount.toLocaleString('de-DE', { minimumFractionDigits: 2 })}`}
subValue={`${MOCK_INVOICES.filter(i => i.status === 'pending' || i.status === 'overdue').length} invoices`}
color="text-warning-amber"
bgColor="bg-warning-amber/10"
/>
<StatCard
icon={Calendar}
label="Next Payment"
value={MOCK_STATS.nextPaymentDate.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })}
subValue={`${MOCK_STATS.nextPaymentAmount.toLocaleString('de-DE', { minimumFractionDigits: 2 })}`}
color="text-primary-blue"
bgColor="bg-primary-blue/10"
/>
<StatCard
icon={TrendingUp}
label="Monthly Average"
value={`${MOCK_STATS.averageMonthlySpend.toLocaleString('de-DE')}`}
subValue="Last 6 months"
color="text-gray-400"
bgColor="bg-iron-gray"
/>
</motion.div>
{/* Payment Methods */}
<Card className="mb-8">
<div className="flex items-center justify-between p-4 border-b border-charcoal-outline">
<h2 className="text-lg font-semibold text-white">Payment Methods</h2>
<Button variant="secondary" className="text-sm">
<Plus className="w-4 h-4 mr-2" />
Add Payment Method
</Button>
</div>
<div className="p-4 space-y-3">
{paymentMethods.map((method) => (
<PaymentMethodCard
key={method.id}
method={method}
onSetDefault={() => handleSetDefault(method.id)}
/>
))}
</div>
</Card>
<motion.div variants={itemVariants}>
<Card className="mb-8 overflow-hidden">
<SectionHeader
icon={CreditCard}
title="Payment Methods"
action={
<Button variant="secondary" className="text-sm">
<Plus className="w-4 h-4 mr-2" />
Add Payment Method
</Button>
}
/>
<div className="p-5 space-y-3">
{paymentMethods.map((method) => (
<PaymentMethodCard
key={method.id}
method={method}
onSetDefault={() => handleSetDefault(method.id)}
onRemove={() => handleRemoveMethod(method.id)}
/>
))}
</div>
<div className="px-5 pb-5">
<InfoBanner type="info">
<p className="mb-1">We support Visa, Mastercard, American Express, and SEPA Direct Debit.</p>
<p>All payment information is securely processed and stored by our payment provider.</p>
</InfoBanner>
</div>
</Card>
</motion.div>
{/* Billing History */}
<Card>
<div className="flex items-center justify-between p-4 border-b border-charcoal-outline">
<h2 className="text-lg font-semibold text-white">Billing History</h2>
<Button variant="secondary" className="text-sm">
<Download className="w-4 h-4 mr-2" />
Export All
</Button>
</div>
<div>
{MOCK_INVOICES.map((invoice) => (
<InvoiceRow key={invoice.id} invoice={invoice} />
))}
</div>
<div className="p-4 border-t border-charcoal-outline">
<Button variant="secondary" className="w-full">
View All Invoices
<ArrowRight className="w-4 h-4 ml-2" />
</Button>
</div>
</Card>
<motion.div variants={itemVariants}>
<Card className="mb-8 overflow-hidden">
<SectionHeader
icon={FileText}
title="Billing History"
color="text-warning-amber"
action={
<Button variant="secondary" className="text-sm">
<Download className="w-4 h-4 mr-2" />
Export All
</Button>
}
/>
<div>
{displayedInvoices.map((invoice, index) => (
<InvoiceRow key={invoice.id} invoice={invoice} index={index} />
))}
</div>
{MOCK_INVOICES.length > 4 && (
<div className="p-4 border-t border-charcoal-outline">
<Button
variant="secondary"
className="w-full"
onClick={() => setShowAllInvoices(!showAllInvoices)}
>
{showAllInvoices ? 'Show Less' : `View All ${MOCK_INVOICES.length} Invoices`}
<ChevronRight className={`w-4 h-4 ml-2 transition-transform ${showAllInvoices ? 'rotate-90' : ''}`} />
</Button>
</div>
)}
</Card>
</motion.div>
{/* Platform Fee Notice */}
<div className="mt-6 rounded-lg bg-iron-gray/50 border border-charcoal-outline p-4">
<h3 className="font-medium text-white mb-2">Platform Fee</h3>
<p className="text-sm text-gray-400">
A 10% platform fee is applied to all sponsorship payments. This fee helps maintain the platform,
provide analytics, and ensure quality sponsorship placements.
</p>
</div>
{/* Platform Fee & VAT Information */}
<motion.div variants={itemVariants} className="grid grid-cols-1 md:grid-cols-2 gap-6">
{/* Platform Fee */}
<Card className="overflow-hidden">
<div className="p-5 border-b border-charcoal-outline bg-gradient-to-r from-iron-gray/30 to-transparent">
<h3 className="font-semibold text-white flex items-center gap-3">
<div className="p-2 rounded-lg bg-iron-gray/50">
<Percent className="w-4 h-4 text-primary-blue" />
</div>
Platform Fee
</h3>
</div>
<div className="p-5">
<div className="text-3xl font-bold text-white mb-2">
{siteConfig.fees.platformFeePercent}%
</div>
<p className="text-sm text-gray-400 mb-4">
{siteConfig.fees.description}
</p>
<div className="text-xs text-gray-500 space-y-1">
<p> Applied to all sponsorship payments</p>
<p> Covers platform maintenance and analytics</p>
<p> Ensures quality sponsorship placements</p>
</div>
</div>
</Card>
{/* Alpha Notice */}
<div className="mt-6 rounded-lg bg-warning-amber/10 border border-warning-amber/30 p-4">
<p className="text-xs text-gray-400">
<strong className="text-warning-amber">Alpha Note:</strong> Payment processing is demonstration-only.
Real billing will be available when the payment system is fully implemented.
</p>
</div>
</div>
{/* VAT Information */}
<Card className="overflow-hidden">
<div className="p-5 border-b border-charcoal-outline bg-gradient-to-r from-iron-gray/30 to-transparent">
<h3 className="font-semibold text-white flex items-center gap-3">
<div className="p-2 rounded-lg bg-iron-gray/50">
<Receipt className="w-4 h-4 text-performance-green" />
</div>
VAT Information
</h3>
</div>
<div className="p-5">
<p className="text-sm text-gray-400 mb-4">
{siteConfig.vat.notice}
</p>
<div className="space-y-3 text-sm">
<div className="flex justify-between items-center py-2 border-b border-charcoal-outline/50">
<span className="text-gray-500">Standard VAT Rate</span>
<span className="text-white font-medium">{siteConfig.vat.standardRate}%</span>
</div>
<div className="flex justify-between items-center py-2">
<span className="text-gray-500">B2B Reverse Charge</span>
<span className="text-performance-green font-medium">Available</span>
</div>
</div>
<p className="text-xs text-gray-500 mt-4">
Enter your VAT ID in Settings to enable reverse charge for B2B transactions.
</p>
</div>
</Card>
</motion.div>
{/* Billing Support */}
<motion.div variants={itemVariants} className="mt-6">
<Card className="p-5">
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="p-3 rounded-xl bg-iron-gray">
<Info className="w-5 h-5 text-gray-400" />
</div>
<div>
<h3 className="font-medium text-white">Need help with billing?</h3>
<p className="text-sm text-gray-500">
Contact our billing support for questions about invoices, payments, or refunds.
</p>
</div>
</div>
<Button variant="secondary">
Contact Support
<ExternalLink className="w-4 h-4 ml-2" />
</Button>
</div>
</Card>
</motion.div>
</motion.div>
);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,355 +1,652 @@
'use client';
import { useState, useEffect } from 'react';
import { motion, useReducedMotion, AnimatePresence } from 'framer-motion';
import Card from '@/components/ui/Card';
import Button from '@/components/ui/Button';
import {
BarChart3,
Eye,
Users,
Trophy,
TrendingUp,
import StatusBadge from '@/components/ui/StatusBadge';
import InfoBanner from '@/components/ui/InfoBanner';
import {
BarChart3,
Eye,
Users,
Trophy,
TrendingUp,
Calendar,
DollarSign,
Target,
ArrowUpRight,
ArrowDownRight,
ExternalLink,
Loader2
Loader2,
Car,
Flag,
Megaphone,
ChevronRight,
Plus,
Bell,
Settings,
CreditCard,
FileText,
RefreshCw
} from 'lucide-react';
import Link from 'next/link';
interface SponsorshipMetrics {
impressions: number;
impressionsChange: number;
uniqueViewers: number;
viewersChange: number;
races: number;
drivers: number;
exposure: number;
exposureChange: number;
}
interface SponsoredLeague {
id: string;
name: string;
tier: 'main' | 'secondary';
drivers: number;
races: number;
impressions: number;
status: 'active' | 'upcoming' | 'completed';
}
interface SponsorDashboardData {
sponsorId: string;
sponsorName: string;
metrics: SponsorshipMetrics;
sponsoredLeagues: SponsoredLeague[];
investment: {
activeSponsorships: number;
totalInvestment: number;
costPerThousandViews: number;
};
}
// Static mock data for prototype
const MOCK_SPONSOR_DATA = {
sponsorId: 'demo-sponsor-1',
sponsorName: 'Acme Racing Co.',
metrics: {
totalImpressions: 127450,
impressionsChange: 12.5,
uniqueViewers: 34200,
viewersChange: 8.3,
activeSponsors: 7,
totalInvestment: 4850,
avgEngagement: 4.2,
engagementChange: 0.8,
},
sponsorships: {
leagues: [
{ id: 'l1', name: 'GT3 Masters Championship', tier: 'main', drivers: 48, impressions: 45200, status: 'active' },
{ id: 'l2', name: 'Endurance Pro Series', tier: 'secondary', drivers: 72, impressions: 38400, status: 'active' },
],
teams: [
{ id: 't1', name: 'Velocity Racing', drivers: 4, impressions: 12300, status: 'active' },
{ id: 't2', name: 'Storm Motorsport', drivers: 3, impressions: 8900, status: 'active' },
],
drivers: [
{ id: 'd1', name: 'Max Velocity', team: 'Velocity Racing', impressions: 8200, status: 'active' },
{ id: 'd2', name: 'Sarah Storm', team: 'Storm Motorsport', impressions: 6100, status: 'active' },
],
races: [
{ id: 'r1', name: 'Spa 24 Hours', league: 'Endurance Pro', impressions: 15600, date: '2025-12-20', status: 'upcoming' },
],
platform: [
{ id: 'p1', name: 'Homepage Banner', placement: 'Header', impressions: 52000, status: 'active' },
],
},
recentActivity: [
{ id: 'a1', type: 'race', message: 'GT3 Masters Championship race completed', time: '2 hours ago', impressions: 1240 },
{ id: 'a2', type: 'driver', message: 'Max Velocity finished P1 at Monza', time: '5 hours ago', impressions: 890 },
{ id: 'a3', type: 'league', message: 'New driver joined Endurance Pro Series', time: '1 day ago', impressions: null },
{ id: 'a4', type: 'team', message: 'Velocity Racing won team championship', time: '2 days ago', impressions: 2100 },
],
upcomingRenewals: [
{ id: 'ren1', name: 'GT3 Masters Championship', type: 'league', renewDate: '2026-01-15', price: 1200 },
{ id: 'ren2', name: 'Homepage Banner', type: 'platform', renewDate: '2025-12-31', price: 500 },
],
};
// Metric Card Component
function MetricCard({
title,
value,
change,
icon: Icon,
suffix = '',
prefix = '',
delay = 0,
}: {
title: string;
value: number | string;
change?: number;
icon: typeof Eye;
suffix?: string;
prefix?: string;
delay?: number;
}) {
const shouldReduceMotion = useReducedMotion();
const isPositive = change && change > 0;
const isNegative = change && change < 0;
return (
<Card className="p-4">
<div className="flex items-start justify-between mb-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-primary-blue/10">
<Icon className="w-5 h-5 text-primary-blue" />
</div>
{change !== undefined && (
<div className={`flex items-center gap-1 text-sm ${
isPositive ? 'text-performance-green' : isNegative ? 'text-racing-red' : 'text-gray-400'
}`}>
{isPositive ? <ArrowUpRight className="w-4 h-4" /> : isNegative ? <ArrowDownRight className="w-4 h-4" /> : null}
{Math.abs(change)}%
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay }}
>
<Card className="p-5 h-full">
<div className="flex items-start justify-between mb-3">
<div className="flex h-11 w-11 items-center justify-center rounded-xl bg-primary-blue/10">
<Icon className="w-5 h-5 text-primary-blue" />
</div>
)}
</div>
<div className="text-2xl font-bold text-white mb-1">
{typeof value === 'number' ? value.toLocaleString() : value}{suffix}
</div>
<div className="text-sm text-gray-400">{title}</div>
</Card>
{change !== undefined && (
<div className={`flex items-center gap-1 text-sm font-medium ${
isPositive ? 'text-performance-green' : isNegative ? 'text-racing-red' : 'text-gray-400'
}`}>
{isPositive ? <ArrowUpRight className="w-4 h-4" /> : isNegative ? <ArrowDownRight className="w-4 h-4" /> : null}
{Math.abs(change)}%
</div>
)}
</div>
<div className="text-2xl font-bold text-white mb-1">
{prefix}{typeof value === 'number' ? value.toLocaleString() : value}{suffix}
</div>
<div className="text-sm text-gray-400">{title}</div>
</Card>
</motion.div>
);
}
function LeagueRow({ league }: { league: SponsoredLeague }) {
const statusColors = {
active: 'bg-performance-green/20 text-performance-green',
upcoming: 'bg-warning-amber/20 text-warning-amber',
completed: 'bg-gray-500/20 text-gray-400',
};
// Sponsorship Category Card
function SponsorshipCategoryCard({
icon: Icon,
title,
count,
impressions,
color,
href
}: {
icon: typeof Trophy;
title: string;
count: number;
impressions: number;
color: string;
href: string;
}) {
return (
<Link href={href}>
<Card className="p-4 hover:border-primary-blue/50 transition-all duration-300 cursor-pointer group">
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<div className={`w-10 h-10 rounded-lg bg-iron-gray flex items-center justify-center group-hover:bg-primary-blue/10 transition-colors`}>
<Icon className={`w-5 h-5 ${color}`} />
</div>
<div>
<p className="text-white font-medium">{title}</p>
<p className="text-sm text-gray-500">{count} active</p>
</div>
</div>
<div className="text-right">
<p className="text-white font-semibold">{impressions.toLocaleString()}</p>
<p className="text-xs text-gray-500">impressions</p>
</div>
</div>
</Card>
</Link>
);
}
const tierColors = {
main: 'bg-primary-blue/20 text-primary-blue border-primary-blue/30',
secondary: 'bg-purple-500/20 text-purple-400 border-purple-500/30',
// Activity Item
function ActivityItem({ activity }: { activity: typeof MOCK_SPONSOR_DATA.recentActivity[0] }) {
const typeColors = {
race: 'bg-warning-amber',
league: 'bg-primary-blue',
team: 'bg-purple-400',
driver: 'bg-performance-green',
platform: 'bg-racing-red',
};
return (
<div className="flex items-center justify-between p-4 border-b border-charcoal-outline last:border-b-0 hover:bg-iron-gray/30 transition-colors">
<div className="flex items-center gap-4">
<div className={`px-2 py-1 rounded text-xs font-medium border ${tierColors[league.tier]}`}>
{league.tier === 'main' ? 'Main Sponsor' : 'Secondary'}
</div>
<div>
<div className="font-medium text-white">{league.name}</div>
<div className="text-sm text-gray-400">
{league.drivers} drivers {league.races} races
</div>
<div className="flex items-start gap-3 py-3 border-b border-charcoal-outline/50 last:border-b-0">
<div className={`w-2 h-2 rounded-full mt-2 ${typeColors[activity.type as keyof typeof typeColors] || 'bg-gray-500'}`} />
<div className="flex-1 min-w-0">
<p className="text-sm text-white truncate">{activity.message}</p>
<div className="flex items-center gap-2 mt-1">
<span className="text-xs text-gray-500">{activity.time}</span>
{activity.impressions && (
<>
<span className="text-xs text-gray-600"></span>
<span className="text-xs text-gray-400">{activity.impressions.toLocaleString()} views</span>
</>
)}
</div>
</div>
<div className="flex items-center gap-6">
<div className="text-right">
<div className="text-sm font-medium text-white">{league.impressions.toLocaleString()}</div>
<div className="text-xs text-gray-500">impressions</div>
</div>
);
}
// Renewal Alert
function RenewalAlert({ renewal }: { renewal: typeof MOCK_SPONSOR_DATA.upcomingRenewals[0] }) {
const typeIcons = {
league: Trophy,
team: Users,
driver: Car,
race: Flag,
platform: Megaphone,
};
const Icon = typeIcons[renewal.type as keyof typeof typeIcons] || Trophy;
return (
<div className="flex items-center justify-between p-3 rounded-lg bg-warning-amber/10 border border-warning-amber/30">
<div className="flex items-center gap-3">
<Icon className="w-4 h-4 text-warning-amber" />
<div>
<p className="text-sm text-white">{renewal.name}</p>
<p className="text-xs text-gray-400">Renews {renewal.renewDate}</p>
</div>
<div className={`px-2 py-1 rounded text-xs font-medium ${statusColors[league.status]}`}>
{league.status}
</div>
<Link href={`/leagues/${league.id}`}>
<Button variant="secondary" className="text-xs">
<ExternalLink className="w-3 h-3 mr-1" />
View
</Button>
</Link>
</div>
<div className="text-right">
<p className="text-sm font-semibold text-white">${renewal.price}</p>
<Button variant="secondary" className="text-xs mt-1 py-1 px-2 min-h-0">
Renew
</Button>
</div>
</div>
);
}
export default function SponsorDashboardPage() {
const shouldReduceMotion = useReducedMotion();
const [timeRange, setTimeRange] = useState<'7d' | '30d' | '90d' | 'all'>('30d');
const [data, setData] = useState<SponsorDashboardData | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
// Simulate loading
useEffect(() => {
async function fetchDashboard() {
try {
const response = await fetch('/api/sponsors/dashboard');
if (response.ok) {
const dashboardData: SponsorDashboardData = await response.json();
setData(dashboardData);
} else {
setError('Failed to load sponsor dashboard');
}
} catch {
setError('Failed to load sponsor dashboard');
} finally {
setLoading(false);
}
}
fetchDashboard();
const timer = setTimeout(() => setLoading(false), 500);
return () => clearTimeout(timer);
}, []);
const data = MOCK_SPONSOR_DATA;
// Calculate category totals
const categoryData = {
leagues: {
count: data.sponsorships.leagues.length,
impressions: data.sponsorships.leagues.reduce((sum, l) => sum + l.impressions, 0),
},
teams: {
count: data.sponsorships.teams.length,
impressions: data.sponsorships.teams.reduce((sum, t) => sum + t.impressions, 0),
},
drivers: {
count: data.sponsorships.drivers.length,
impressions: data.sponsorships.drivers.reduce((sum, d) => sum + d.impressions, 0),
},
races: {
count: data.sponsorships.races.length,
impressions: data.sponsorships.races.reduce((sum, r) => sum + r.impressions, 0),
},
platform: {
count: data.sponsorships.platform.length,
impressions: data.sponsorships.platform.reduce((sum, p) => sum + p.impressions, 0),
},
};
if (loading) {
return (
<div className="max-w-7xl mx-auto py-8 px-4 flex items-center justify-center min-h-[400px]">
<Loader2 className="w-8 h-8 animate-spin text-primary-blue" />
</div>
);
}
if (!data) {
return (
<div className="max-w-7xl mx-auto py-8 px-4">
<div className="rounded-lg bg-warning-amber/10 border border-warning-amber/30 p-4">
<p className="text-sm text-warning-amber">
{error ?? 'No sponsor dashboard data available yet.'}
</p>
<div className="max-w-7xl mx-auto py-8 px-4 flex items-center justify-center min-h-[600px]">
<div className="text-center">
<Loader2 className="w-8 h-8 animate-spin text-primary-blue mx-auto mb-4" />
<p className="text-gray-400">Loading dashboard...</p>
</div>
</div>
);
}
const dashboardData = data;
return (
<div className="max-w-7xl mx-auto py-8 px-4">
{/* Header */}
<div className="flex items-center justify-between mb-8">
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-8">
<div>
<h1 className="text-2xl font-bold text-white">Sponsor Dashboard</h1>
<p className="text-gray-400">Track your sponsorship performance and exposure</p>
<p className="text-gray-400">Welcome back, {data.sponsorName}</p>
</div>
<div className="flex items-center gap-2">
{(['7d', '30d', '90d', 'all'] as const).map((range) => (
<button
key={range}
onClick={() => setTimeRange(range)}
className={`px-3 py-1.5 rounded-lg text-sm transition-colors ${
timeRange === range
? 'bg-primary-blue text-white'
: 'bg-iron-gray/50 text-gray-400 hover:bg-iron-gray'
}`}
>
{range === 'all' ? 'All Time' : range}
</button>
))}
<div className="flex items-center gap-3">
{/* Time Range Selector */}
<div className="flex items-center bg-iron-gray/50 rounded-lg p-1">
{(['7d', '30d', '90d', 'all'] as const).map((range) => (
<button
key={range}
onClick={() => setTimeRange(range)}
className={`px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${
timeRange === range
? 'bg-primary-blue text-white'
: 'text-gray-400 hover:text-white'
}`}
>
{range === 'all' ? 'All' : range}
</button>
))}
</div>
{/* Quick Actions */}
<Button variant="secondary" className="hidden sm:flex">
<RefreshCw className="w-4 h-4" />
</Button>
<Link href="/sponsor/settings">
<Button variant="secondary" className="hidden sm:flex">
<Settings className="w-4 h-4" />
</Button>
</Link>
</div>
</div>
{/* Metrics Grid */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
{/* Key Metrics */}
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
<MetricCard
title="Total Impressions"
value={dashboardData.metrics.impressions}
change={dashboardData.metrics.impressionsChange}
value={data.metrics.totalImpressions}
change={data.metrics.impressionsChange}
icon={Eye}
delay={0}
/>
<MetricCard
title="Unique Viewers"
value={dashboardData.metrics.uniqueViewers}
change={dashboardData.metrics.viewersChange}
value={data.metrics.uniqueViewers}
change={data.metrics.viewersChange}
icon={Users}
delay={0.1}
/>
<MetricCard
title="Exposure Score"
value={dashboardData.metrics.exposure}
change={dashboardData.metrics.exposureChange}
icon={Target}
title="Engagement Rate"
value={data.metrics.avgEngagement}
change={data.metrics.engagementChange}
icon={TrendingUp}
suffix="%"
delay={0.2}
/>
<MetricCard
title="Active Drivers"
value={dashboardData.metrics.drivers}
icon={Trophy}
title="Total Investment"
value={data.metrics.totalInvestment}
icon={DollarSign}
prefix="$"
delay={0.3}
/>
</div>
{/* Sponsorship Categories */}
<div className="mb-8">
<div className="flex items-center justify-between mb-4">
<h2 className="text-lg font-semibold text-white">Your Sponsorships</h2>
<Link href="/sponsor/campaigns">
<Button variant="secondary" className="text-sm">
View All
<ChevronRight className="w-4 h-4 ml-1" />
</Button>
</Link>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4">
<SponsorshipCategoryCard
icon={Trophy}
title="Leagues"
count={categoryData.leagues.count}
impressions={categoryData.leagues.impressions}
color="text-primary-blue"
href="/sponsor/campaigns?type=leagues"
/>
<SponsorshipCategoryCard
icon={Users}
title="Teams"
count={categoryData.teams.count}
impressions={categoryData.teams.impressions}
color="text-purple-400"
href="/sponsor/campaigns?type=teams"
/>
<SponsorshipCategoryCard
icon={Car}
title="Drivers"
count={categoryData.drivers.count}
impressions={categoryData.drivers.impressions}
color="text-performance-green"
href="/sponsor/campaigns?type=drivers"
/>
<SponsorshipCategoryCard
icon={Flag}
title="Races"
count={categoryData.races.count}
impressions={categoryData.races.impressions}
color="text-warning-amber"
href="/sponsor/campaigns?type=races"
/>
<SponsorshipCategoryCard
icon={Megaphone}
title="Platform Ads"
count={categoryData.platform.count}
impressions={categoryData.platform.impressions}
color="text-racing-red"
href="/sponsor/campaigns?type=platform"
/>
</div>
</div>
{/* Main Content Grid */}
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
{/* Sponsored Leagues */}
<div className="lg:col-span-2">
{/* Left Column - Sponsored Entities */}
<div className="lg:col-span-2 space-y-6">
{/* Top Performing Sponsorships */}
<Card>
<div className="flex items-center justify-between p-4 border-b border-charcoal-outline">
<h2 className="text-lg font-semibold text-white">Sponsored Leagues</h2>
<h2 className="text-lg font-semibold text-white">Top Performing</h2>
<Link href="/leagues">
<Button variant="secondary" className="text-sm">
Browse Leagues
<Plus className="w-4 h-4 mr-1" />
Find More
</Button>
</Link>
</div>
<div>
{dashboardData.sponsoredLeagues.length > 0 ? (
dashboardData.sponsoredLeagues.map((league) => (
<LeagueRow key={league.id} league={league} />
))
<div className="divide-y divide-charcoal-outline/50">
{/* Leagues */}
{data.sponsorships.leagues.map((league) => (
<div key={league.id} className="flex items-center justify-between p-4 hover:bg-iron-gray/30 transition-colors">
<div className="flex items-center gap-4">
<div className={`px-2 py-1 rounded text-xs font-medium ${
league.tier === 'main'
? 'bg-primary-blue/20 text-primary-blue border border-primary-blue/30'
: 'bg-purple-500/20 text-purple-400 border border-purple-500/30'
}`}>
{league.tier === 'main' ? 'Main' : 'Secondary'}
</div>
<div>
<div className="flex items-center gap-2">
<Trophy className="w-4 h-4 text-gray-500" />
<span className="font-medium text-white">{league.name}</span>
</div>
<div className="text-sm text-gray-500">{league.drivers} drivers</div>
</div>
</div>
<div className="flex items-center gap-4">
<div className="text-right">
<div className="font-semibold text-white">{league.impressions.toLocaleString()}</div>
<div className="text-xs text-gray-500">impressions</div>
</div>
<Link href={`/sponsor/leagues/${league.id}`}>
<Button variant="secondary" className="text-xs">
<ExternalLink className="w-3 h-3" />
</Button>
</Link>
</div>
</div>
))}
{/* Teams */}
{data.sponsorships.teams.map((team) => (
<div key={team.id} className="flex items-center justify-between p-4 hover:bg-iron-gray/30 transition-colors">
<div className="flex items-center gap-4">
<div className="px-2 py-1 rounded text-xs font-medium bg-purple-500/20 text-purple-400 border border-purple-500/30">
Team
</div>
<div>
<div className="flex items-center gap-2">
<Users className="w-4 h-4 text-gray-500" />
<span className="font-medium text-white">{team.name}</span>
</div>
<div className="text-sm text-gray-500">{team.drivers} drivers</div>
</div>
</div>
<div className="flex items-center gap-4">
<div className="text-right">
<div className="font-semibold text-white">{team.impressions.toLocaleString()}</div>
<div className="text-xs text-gray-500">impressions</div>
</div>
<Button variant="secondary" className="text-xs">
<ExternalLink className="w-3 h-3" />
</Button>
</div>
</div>
))}
{/* Drivers */}
{data.sponsorships.drivers.slice(0, 2).map((driver) => (
<div key={driver.id} className="flex items-center justify-between p-4 hover:bg-iron-gray/30 transition-colors">
<div className="flex items-center gap-4">
<div className="px-2 py-1 rounded text-xs font-medium bg-performance-green/20 text-performance-green border border-performance-green/30">
Driver
</div>
<div>
<div className="flex items-center gap-2">
<Car className="w-4 h-4 text-gray-500" />
<span className="font-medium text-white">{driver.name}</span>
</div>
<div className="text-sm text-gray-500">{driver.team}</div>
</div>
</div>
<div className="flex items-center gap-4">
<div className="text-right">
<div className="font-semibold text-white">{driver.impressions.toLocaleString()}</div>
<div className="text-xs text-gray-500">impressions</div>
</div>
<Button variant="secondary" className="text-xs">
<ExternalLink className="w-3 h-3" />
</Button>
</div>
</div>
))}
</div>
</Card>
{/* Upcoming Events */}
<Card>
<div className="p-4 border-b border-charcoal-outline">
<h2 className="text-lg font-semibold text-white flex items-center gap-2">
<Calendar className="w-5 h-5 text-warning-amber" />
Upcoming Sponsored Events
</h2>
</div>
<div className="p-4">
{data.sponsorships.races.length > 0 ? (
<div className="space-y-3">
{data.sponsorships.races.map((race) => (
<div key={race.id} className="flex items-center justify-between p-3 rounded-lg bg-iron-gray/30">
<div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-lg bg-warning-amber/10 flex items-center justify-center">
<Flag className="w-5 h-5 text-warning-amber" />
</div>
<div>
<p className="font-medium text-white">{race.name}</p>
<p className="text-sm text-gray-500">{race.league} {race.date}</p>
</div>
</div>
<div className="text-right">
<span className="px-2 py-1 rounded text-xs font-medium bg-warning-amber/20 text-warning-amber">
{race.status}
</span>
</div>
</div>
))}
</div>
) : (
<div className="p-8 text-center text-gray-400">
<p>No active sponsorships yet.</p>
<Link href="/leagues" className="text-primary-blue hover:underline mt-2 inline-block">
Browse leagues to sponsor
</Link>
<div className="text-center py-8 text-gray-500">
<Calendar className="w-8 h-8 mx-auto mb-2 opacity-50" />
<p>No upcoming sponsored events</p>
</div>
)}
</div>
</Card>
</div>
{/* Quick Stats & Actions */}
{/* Right Column - Activity & Quick Actions */}
<div className="space-y-6">
{/* Investment Summary */}
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4">Investment Summary</h3>
<div className="space-y-3">
<div className="flex items-center justify-between">
<span className="text-gray-400">Active Sponsorships</span>
<span className="font-medium text-white">{dashboardData.investment.activeSponsorships}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-400">Total Investment</span>
<span className="font-medium text-white">${dashboardData.investment.totalInvestment.toLocaleString()}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-400">Cost per 1K Views</span>
<span className="font-medium text-performance-green">${dashboardData.investment.costPerThousandViews.toFixed(2)}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-400">Next Payment</span>
<span className="font-medium text-white">Dec 15, 2025</span>
</div>
</div>
</Card>
{/* Recent Activity */}
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4">Recent Activity</h3>
<div className="space-y-3">
<div className="flex items-start gap-3">
<div className="w-2 h-2 rounded-full bg-performance-green mt-2" />
<div>
<p className="text-sm text-white">GT3 Pro Championship race completed</p>
<p className="text-xs text-gray-500">2 hours ago 1,240 views</p>
</div>
</div>
<div className="flex items-start gap-3">
<div className="w-2 h-2 rounded-full bg-primary-blue mt-2" />
<div>
<p className="text-sm text-white">New driver joined Endurance Masters</p>
<p className="text-xs text-gray-500">5 hours ago</p>
</div>
</div>
<div className="flex items-start gap-3">
<div className="w-2 h-2 rounded-full bg-warning-amber mt-2" />
<div>
<p className="text-sm text-white">Touring Car Cup season starting soon</p>
<p className="text-xs text-gray-500">1 day ago</p>
</div>
</div>
</div>
</Card>
{/* Quick Actions */}
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4">Quick Actions</h3>
<div className="space-y-2">
<Button variant="secondary" className="w-full justify-start">
<BarChart3 className="w-4 h-4 mr-2" />
View Detailed Analytics
</Button>
<Link href="/sponsor/billing" className="block">
<Button variant="secondary" className="w-full justify-start">
<DollarSign className="w-4 h-4 mr-2" />
Manage Payments
</Button>
</Link>
<Link href="/leagues" className="block">
<Button variant="secondary" className="w-full justify-start">
<Target className="w-4 h-4 mr-2" />
Find New Leagues
Find Leagues to Sponsor
</Button>
</Link>
<Link href="/teams" className="block">
<Button variant="secondary" className="w-full justify-start">
<Users className="w-4 h-4 mr-2" />
Browse Teams
</Button>
</Link>
<Link href="/drivers" className="block">
<Button variant="secondary" className="w-full justify-start">
<Car className="w-4 h-4 mr-2" />
Discover Drivers
</Button>
</Link>
<Link href="/sponsor/billing" className="block">
<Button variant="secondary" className="w-full justify-start">
<CreditCard className="w-4 h-4 mr-2" />
Manage Billing
</Button>
</Link>
<Link href="/sponsor/campaigns" className="block">
<Button variant="secondary" className="w-full justify-start">
<BarChart3 className="w-4 h-4 mr-2" />
View Analytics
</Button>
</Link>
</div>
</Card>
</div>
</div>
{/* Alpha Notice */}
<div className="mt-8 rounded-lg bg-warning-amber/10 border border-warning-amber/30 p-4">
<p className="text-xs text-gray-400">
<strong className="text-warning-amber">Alpha Note:</strong> Sponsor analytics data shown here is demonstration-only.
Real analytics will be available when the sponsorship system is fully implemented.
</p>
{/* Renewal Alerts */}
{data.upcomingRenewals.length > 0 && (
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4 flex items-center gap-2">
<Bell className="w-5 h-5 text-warning-amber" />
Upcoming Renewals
</h3>
<div className="space-y-3">
{data.upcomingRenewals.map((renewal) => (
<RenewalAlert key={renewal.id} renewal={renewal} />
))}
</div>
</Card>
)}
{/* Recent Activity */}
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4">Recent Activity</h3>
<div>
{data.recentActivity.map((activity) => (
<ActivityItem key={activity.id} activity={activity} />
))}
</div>
</Card>
{/* Investment Summary */}
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4 flex items-center gap-2">
<FileText className="w-5 h-5 text-primary-blue" />
Investment Summary
</h3>
<div className="space-y-3">
<div className="flex items-center justify-between">
<span className="text-gray-400">Active Sponsorships</span>
<span className="font-medium text-white">{data.metrics.activeSponsors}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-400">Total Investment</span>
<span className="font-medium text-white">${data.metrics.totalInvestment.toLocaleString()}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-400">Cost per 1K Views</span>
<span className="font-medium text-performance-green">
${(data.metrics.totalInvestment / data.metrics.totalImpressions * 1000).toFixed(2)}
</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-400">Next Invoice</span>
<span className="font-medium text-white">Jan 1, 2026</span>
</div>
<div className="pt-3 border-t border-charcoal-outline">
<Link href="/sponsor/billing">
<Button variant="secondary" className="w-full text-sm">
<CreditCard className="w-4 h-4 mr-2" />
View Billing Details
</Button>
</Link>
</div>
</div>
</Card>
</div>
</div>
</div>
);

View File

@@ -1,10 +1,12 @@
'use client';
import { useState } from 'react';
import { useParams } from 'next/navigation';
import { useParams, useSearchParams } from 'next/navigation';
import { motion, useReducedMotion } from 'framer-motion';
import Link from 'next/link';
import Card from '@/components/ui/Card';
import Button from '@/components/ui/Button';
import { siteConfig } from '@/lib/siteConfig';
import {
Trophy,
Users,
@@ -14,147 +16,246 @@ import {
Download,
Image as ImageIcon,
ExternalLink,
ChevronRight
ChevronRight,
Star,
Clock,
CheckCircle2,
Flag,
Car,
BarChart3,
ArrowUpRight,
Megaphone,
CreditCard,
FileText
} from 'lucide-react';
interface LeagueDriver {
id: string;
name: string;
country: string;
position: number;
races: number;
impressions: number;
}
// Mock data
// Mock data for league detail
const MOCK_LEAGUE = {
id: 'league-1',
name: 'GT3 Pro Championship',
tier: 'main' as const,
name: 'GT3 Masters Championship',
game: 'iRacing',
tier: 'premium' as const,
season: 'Season 3',
drivers: 32,
description: 'Premier GT3 racing with top-tier drivers competing across the world\'s most iconic circuits. Weekly broadcasts and an active community make this league a premium sponsorship opportunity.',
drivers: 48,
races: 12,
completedRaces: 8,
impressions: 45200,
totalImpressions: 45200,
avgViewsPerRace: 5650,
logoPlacement: 'Primary hood placement + League page banner',
status: 'active' as const,
engagement: 4.2,
rating: 4.8,
seasonStatus: 'active' as const,
seasonDates: { start: '2025-10-01', end: '2026-02-28' },
nextRace: { name: 'Spa-Francorchamps', date: '2025-12-20' },
sponsorSlots: {
main: {
available: true,
price: 1200,
benefits: [
'Primary logo placement on all liveries',
'League page header banner',
'Race results page branding',
'Social media feature posts',
'Newsletter sponsor spot',
]
},
secondary: {
available: 1,
total: 2,
price: 400,
benefits: [
'Secondary logo on liveries',
'League page sidebar placement',
'Race results mention',
'Social media mentions',
]
},
},
};
const MOCK_DRIVERS: LeagueDriver[] = [
{ id: 'd1', name: 'Max Verstappen', country: 'NL', position: 1, races: 8, impressions: 4200 },
{ id: 'd2', name: 'Lewis Hamilton', country: 'GB', position: 2, races: 8, impressions: 3980 },
{ id: 'd3', name: 'Charles Leclerc', country: 'MC', position: 3, races: 8, impressions: 3750 },
{ id: 'd4', name: 'Lando Norris', country: 'GB', position: 4, races: 7, impressions: 3420 },
{ id: 'd5', name: 'Carlos Sainz', country: 'ES', position: 5, races: 8, impressions: 3100 },
const MOCK_DRIVERS = [
{ id: 'd1', name: 'Max Verstappen', country: 'NL', position: 1, races: 8, impressions: 4200, team: 'Red Bull Racing' },
{ id: 'd2', name: 'Lewis Hamilton', country: 'GB', position: 2, races: 8, impressions: 3980, team: 'Mercedes AMG' },
{ id: 'd3', name: 'Charles Leclerc', country: 'MC', position: 3, races: 8, impressions: 3750, team: 'Ferrari' },
{ id: 'd4', name: 'Lando Norris', country: 'GB', position: 4, races: 7, impressions: 3420, team: 'McLaren' },
{ id: 'd5', name: 'Carlos Sainz', country: 'ES', position: 5, races: 8, impressions: 3100, team: 'Ferrari' },
];
const MOCK_RACES = [
{ id: 'r1', name: 'Spa-Francorchamps', date: '2025-12-01', views: 6200, status: 'completed' },
{ id: 'r1', name: 'Spa-Francorchamps', date: '2025-12-20', views: 0, status: 'upcoming' },
{ id: 'r2', name: 'Monza', date: '2025-12-08', views: 5800, status: 'completed' },
{ id: 'r3', name: 'Nürburgring', date: '2025-12-15', views: 0, status: 'upcoming' },
{ id: 'r4', name: 'Suzuka', date: '2025-12-22', views: 0, status: 'upcoming' },
{ id: 'r3', name: 'Silverstone', date: '2025-11-24', views: 6200, status: 'completed' },
{ id: 'r4', name: 'Nürburgring', date: '2025-11-10', views: 5400, status: 'completed' },
];
type TabType = 'overview' | 'drivers' | 'races' | 'sponsor';
export default function SponsorLeagueDetailPage() {
const params = useParams();
const [activeTab, setActiveTab] = useState<'overview' | 'drivers' | 'races' | 'assets'>('overview');
const searchParams = useSearchParams();
const shouldReduceMotion = useReducedMotion();
const showSponsorAction = searchParams.get('action') === 'sponsor';
const [activeTab, setActiveTab] = useState<TabType>(showSponsorAction ? 'sponsor' : 'overview');
const [selectedTier, setSelectedTier] = useState<'main' | 'secondary'>('main');
const league = MOCK_LEAGUE;
const tierConfig = {
premium: { color: 'text-yellow-400', bgColor: 'bg-yellow-500/10', border: 'border-yellow-500/30' },
standard: { color: 'text-primary-blue', bgColor: 'bg-primary-blue/10', border: 'border-primary-blue/30' },
starter: { color: 'text-gray-400', bgColor: 'bg-gray-500/10', border: 'border-gray-500/30' },
};
const config = tierConfig[league.tier];
return (
<div className="max-w-7xl mx-auto py-8 px-4">
{/* Breadcrumb */}
<div className="flex items-center gap-2 text-sm text-gray-400 mb-6">
<Link href="/sponsor/dashboard" className="hover:text-white">Dashboard</Link>
<Link href="/sponsor/dashboard" className="hover:text-white transition-colors">Dashboard</Link>
<ChevronRight className="w-4 h-4" />
<Link href="/sponsor/leagues" className="hover:text-white">Leagues</Link>
<Link href="/sponsor/leagues" className="hover:text-white transition-colors">Leagues</Link>
<ChevronRight className="w-4 h-4" />
<span className="text-white">{MOCK_LEAGUE.name}</span>
<span className="text-white">{league.name}</span>
</div>
{/* Header */}
<div className="flex items-start justify-between mb-8">
<div>
<div className="flex flex-col lg:flex-row lg:items-start justify-between gap-6 mb-8">
<div className="flex-1">
<div className="flex items-center gap-3 mb-2">
<h1 className="text-2xl font-bold text-white">{MOCK_LEAGUE.name}</h1>
<span className="px-2 py-1 rounded text-xs font-medium bg-primary-blue/20 text-primary-blue border border-primary-blue/30">
Main Sponsor
<span className={`px-3 py-1 rounded-full text-sm font-medium capitalize ${config.bgColor} ${config.color} border ${config.border}`}>
{league.tier}
</span>
<span className="px-3 py-1 rounded-full text-sm font-medium bg-performance-green/10 text-performance-green">
Active Season
</span>
<div className="flex items-center gap-1 px-2 py-1 rounded bg-iron-gray/50">
<Star className="w-4 h-4 text-yellow-400 fill-yellow-400" />
<span className="text-sm font-medium text-white">{league.rating}</span>
</div>
</div>
<p className="text-gray-400">{MOCK_LEAGUE.season} {MOCK_LEAGUE.completedRaces}/{MOCK_LEAGUE.races} races completed</p>
<h1 className="text-3xl font-bold text-white mb-2">{league.name}</h1>
<p className="text-gray-400 mb-4">{league.game} {league.season} {league.completedRaces}/{league.races} races completed</p>
<p className="text-gray-400 max-w-2xl">{league.description}</p>
</div>
<div className="flex items-center gap-2">
<Button variant="secondary">
<ExternalLink className="w-4 h-4 mr-2" />
View League Page
</Button>
<Button variant="primary">
<Download className="w-4 h-4 mr-2" />
Download Report
</Button>
<div className="flex flex-col sm:flex-row gap-3">
<Link href={`/leagues/${league.id}`}>
<Button variant="secondary">
<ExternalLink className="w-4 h-4 mr-2" />
View League
</Button>
</Link>
{(league.sponsorSlots.main.available || league.sponsorSlots.secondary.available > 0) && (
<Button variant="primary" onClick={() => setActiveTab('sponsor')}>
<Megaphone className="w-4 h-4 mr-2" />
Become a Sponsor
</Button>
)}
</div>
</div>
{/* Quick Stats */}
<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-8">
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-primary-blue/10">
<Eye className="w-5 h-5 text-primary-blue" />
<div className="grid grid-cols-2 md:grid-cols-5 gap-4 mb-8">
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
>
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-primary-blue/10">
<Eye className="w-5 h-5 text-primary-blue" />
</div>
<div>
<div className="text-xl font-bold text-white">{league.totalImpressions.toLocaleString()}</div>
<div className="text-xs text-gray-400">Total Views</div>
</div>
</div>
<div>
<div className="text-xl font-bold text-white">{MOCK_LEAGUE.impressions.toLocaleString()}</div>
<div className="text-sm text-gray-400">Total Impressions</div>
</Card>
</motion.div>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.1 }}
>
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-performance-green/10">
<TrendingUp className="w-5 h-5 text-performance-green" />
</div>
<div>
<div className="text-xl font-bold text-white">{league.avgViewsPerRace.toLocaleString()}</div>
<div className="text-xs text-gray-400">Avg/Race</div>
</div>
</div>
</div>
</Card>
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-performance-green/10">
<TrendingUp className="w-5 h-5 text-performance-green" />
</Card>
</motion.div>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.2 }}
>
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-purple-500/10">
<Users className="w-5 h-5 text-purple-400" />
</div>
<div>
<div className="text-xl font-bold text-white">{league.drivers}</div>
<div className="text-xs text-gray-400">Drivers</div>
</div>
</div>
<div>
<div className="text-xl font-bold text-white">{MOCK_LEAGUE.avgViewsPerRace.toLocaleString()}</div>
<div className="text-sm text-gray-400">Avg Views/Race</div>
</Card>
</motion.div>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 }}
>
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-warning-amber/10">
<BarChart3 className="w-5 h-5 text-warning-amber" />
</div>
<div>
<div className="text-xl font-bold text-white">{league.engagement}%</div>
<div className="text-xs text-gray-400">Engagement</div>
</div>
</div>
</div>
</Card>
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-purple-500/10">
<Users className="w-5 h-5 text-purple-400" />
</Card>
</motion.div>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.4 }}
>
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-racing-red/10">
<Calendar className="w-5 h-5 text-racing-red" />
</div>
<div>
<div className="text-xl font-bold text-white">{league.races - league.completedRaces}</div>
<div className="text-xs text-gray-400">Races Left</div>
</div>
</div>
<div>
<div className="text-xl font-bold text-white">{MOCK_LEAGUE.drivers}</div>
<div className="text-sm text-gray-400">Active Drivers</div>
</div>
</div>
</Card>
<Card className="p-4">
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-warning-amber/10">
<Calendar className="w-5 h-5 text-warning-amber" />
</div>
<div>
<div className="text-xl font-bold text-white">{MOCK_LEAGUE.races - MOCK_LEAGUE.completedRaces}</div>
<div className="text-sm text-gray-400">Races Remaining</div>
</div>
</div>
</Card>
</Card>
</motion.div>
</div>
{/* Tabs */}
<div className="flex gap-1 mb-6 border-b border-charcoal-outline">
{(['overview', 'drivers', 'races', 'assets'] as const).map((tab) => (
<div className="flex gap-1 mb-6 border-b border-charcoal-outline overflow-x-auto">
{(['overview', 'drivers', 'races', 'sponsor'] as const).map((tab) => (
<button
key={tab}
onClick={() => setActiveTab(tab)}
className={`px-4 py-2 text-sm font-medium capitalize transition-colors border-b-2 -mb-px ${
className={`px-4 py-3 text-sm font-medium capitalize transition-colors border-b-2 -mb-px whitespace-nowrap ${
activeTab === tab
? 'text-primary-blue border-primary-blue'
: 'text-gray-400 border-transparent hover:text-white'
}`}
>
{tab}
{tab === 'sponsor' ? '🎯 Become a Sponsor' : tab}
</button>
))}
</div>
@@ -162,73 +263,122 @@ export default function SponsorLeagueDetailPage() {
{/* Tab Content */}
{activeTab === 'overview' && (
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4">Sponsorship Details</h3>
<Card className="p-5">
<h3 className="text-lg font-semibold text-white mb-4 flex items-center gap-2">
<Trophy className="w-5 h-5 text-primary-blue" />
League Information
</h3>
<div className="space-y-3">
<div className="flex justify-between">
<span className="text-gray-400">Tier</span>
<span className="text-white">Main Sponsor</span>
<div className="flex justify-between py-2 border-b border-charcoal-outline/50">
<span className="text-gray-400">Platform</span>
<span className="text-white font-medium">{league.game}</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Logo Placement</span>
<span className="text-white">{MOCK_LEAGUE.logoPlacement}</span>
<div className="flex justify-between py-2 border-b border-charcoal-outline/50">
<span className="text-gray-400">Season</span>
<span className="text-white font-medium">{league.season}</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Season Duration</span>
<span className="text-white">Oct 2025 - Feb 2026</span>
<div className="flex justify-between py-2 border-b border-charcoal-outline/50">
<span className="text-gray-400">Duration</span>
<span className="text-white font-medium">Oct 2025 - Feb 2026</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Investment</span>
<span className="text-white">$800/season</span>
<div className="flex justify-between py-2 border-b border-charcoal-outline/50">
<span className="text-gray-400">Drivers</span>
<span className="text-white font-medium">{league.drivers}</span>
</div>
<div className="flex justify-between py-2">
<span className="text-gray-400">Races</span>
<span className="text-white font-medium">{league.races}</span>
</div>
</div>
</Card>
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4">Performance Metrics</h3>
<Card className="p-5">
<h3 className="text-lg font-semibold text-white mb-4 flex items-center gap-2">
<TrendingUp className="w-5 h-5 text-performance-green" />
Sponsorship Value
</h3>
<div className="space-y-3">
<div className="flex justify-between">
<span className="text-gray-400">Cost per 1K Impressions</span>
<span className="text-performance-green">$17.70</span>
<div className="flex justify-between py-2 border-b border-charcoal-outline/50">
<span className="text-gray-400">Total Season Views</span>
<span className="text-white font-medium">{league.totalImpressions.toLocaleString()}</span>
</div>
<div className="flex justify-between">
<div className="flex justify-between py-2 border-b border-charcoal-outline/50">
<span className="text-gray-400">Projected Total</span>
<span className="text-white font-medium">{Math.round(league.avgViewsPerRace * league.races).toLocaleString()}</span>
</div>
<div className="flex justify-between py-2 border-b border-charcoal-outline/50">
<span className="text-gray-400">Main Sponsor CPM</span>
<span className="text-performance-green font-medium">
${((league.sponsorSlots.main.price / (league.avgViewsPerRace * league.races)) * 1000).toFixed(2)}
</span>
</div>
<div className="flex justify-between py-2 border-b border-charcoal-outline/50">
<span className="text-gray-400">Engagement Rate</span>
<span className="text-white">4.2%</span>
<span className="text-white font-medium">{league.engagement}%</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Brand Recall Score</span>
<span className="text-white">78/100</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">ROI Estimate</span>
<span className="text-performance-green">+24%</span>
<div className="flex justify-between py-2">
<span className="text-gray-400">League Rating</span>
<div className="flex items-center gap-1">
<Star className="w-4 h-4 text-yellow-400 fill-yellow-400" />
<span className="text-white font-medium">{league.rating}/5.0</span>
</div>
</div>
</div>
</Card>
{/* Next Race */}
{league.nextRace && (
<Card className="p-5 lg:col-span-2">
<h3 className="text-lg font-semibold text-white mb-4 flex items-center gap-2">
<Flag className="w-5 h-5 text-warning-amber" />
Next Race
</h3>
<div className="flex items-center justify-between p-4 rounded-lg bg-warning-amber/10 border border-warning-amber/30">
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-lg bg-warning-amber/20 flex items-center justify-center">
<Flag className="w-6 h-6 text-warning-amber" />
</div>
<div>
<p className="font-semibold text-white text-lg">{league.nextRace.name}</p>
<p className="text-sm text-gray-400">{league.nextRace.date}</p>
</div>
</div>
<Button variant="secondary">
View Schedule
</Button>
</div>
</Card>
)}
</div>
)}
{activeTab === 'drivers' && (
<Card>
<div className="p-4 border-b border-charcoal-outline">
<h3 className="text-lg font-semibold text-white">Drivers Carrying Your Brand</h3>
<p className="text-sm text-gray-400">Top performing drivers with your sponsorship</p>
<h3 className="text-lg font-semibold text-white">Championship Standings</h3>
<p className="text-sm text-gray-400">Top drivers carrying sponsor branding</p>
</div>
<div className="divide-y divide-charcoal-outline">
<div className="divide-y divide-charcoal-outline/50">
{MOCK_DRIVERS.map((driver) => (
<div key={driver.id} className="flex items-center justify-between p-4 hover:bg-iron-gray/30 transition-colors">
<div className="flex items-center gap-4">
<div className="w-8 h-8 rounded-full bg-iron-gray flex items-center justify-center text-sm font-bold text-white">
<div className="w-10 h-10 rounded-full bg-iron-gray flex items-center justify-center text-lg font-bold text-white">
{driver.position}
</div>
<div>
<div className="font-medium text-white">{driver.name}</div>
<div className="text-sm text-gray-400">{driver.country} {driver.races} races</div>
<div className="text-sm text-gray-500">{driver.team} {driver.country}</div>
</div>
</div>
<div className="text-right">
<div className="font-medium text-white">{driver.impressions.toLocaleString()}</div>
<div className="text-xs text-gray-500">impressions</div>
<div className="flex items-center gap-6">
<div className="text-right">
<div className="font-medium text-white">{driver.races}</div>
<div className="text-xs text-gray-500">races</div>
</div>
<div className="text-right">
<div className="font-semibold text-white">{driver.impressions.toLocaleString()}</div>
<div className="text-xs text-gray-500">views</div>
</div>
</div>
</div>
))}
@@ -239,9 +389,10 @@ export default function SponsorLeagueDetailPage() {
{activeTab === 'races' && (
<Card>
<div className="p-4 border-b border-charcoal-outline">
<h3 className="text-lg font-semibold text-white">Race Schedule & Performance</h3>
<h3 className="text-lg font-semibold text-white">Race Calendar</h3>
<p className="text-sm text-gray-400">Season schedule with view statistics</p>
</div>
<div className="divide-y divide-charcoal-outline">
<div className="divide-y divide-charcoal-outline/50">
{MOCK_RACES.map((race) => (
<div key={race.id} className="flex items-center justify-between p-4 hover:bg-iron-gray/30 transition-colors">
<div className="flex items-center gap-4">
@@ -250,17 +401,19 @@ export default function SponsorLeagueDetailPage() {
}`} />
<div>
<div className="font-medium text-white">{race.name}</div>
<div className="text-sm text-gray-400">{race.date}</div>
<div className="text-sm text-gray-500">{race.date}</div>
</div>
</div>
<div className="flex items-center gap-4">
{race.status === 'completed' ? (
<div className="text-right">
<div className="font-medium text-white">{race.views.toLocaleString()}</div>
<div className="font-semibold text-white">{race.views.toLocaleString()}</div>
<div className="text-xs text-gray-500">views</div>
</div>
) : (
<span className="text-sm text-warning-amber">Upcoming</span>
<span className="px-3 py-1 rounded-full text-xs font-medium bg-warning-amber/20 text-warning-amber">
Upcoming
</span>
)}
</div>
</div>
@@ -269,38 +422,153 @@ export default function SponsorLeagueDetailPage() {
</Card>
)}
{activeTab === 'assets' && (
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4">Your Logo Assets</h3>
<div className="space-y-4">
<div className="aspect-video bg-iron-gray rounded-lg flex items-center justify-center border border-charcoal-outline">
<ImageIcon className="w-12 h-12 text-gray-500" aria-label="Logo placeholder" />
{activeTab === 'sponsor' && (
<div className="space-y-6">
{/* Tier Selection */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{/* Main Sponsor */}
<Card
className={`p-5 cursor-pointer transition-all ${
selectedTier === 'main'
? 'border-primary-blue ring-2 ring-primary-blue/20'
: 'hover:border-charcoal-outline/80'
} ${!league.sponsorSlots.main.available ? 'opacity-60' : ''}`}
onClick={() => league.sponsorSlots.main.available && setSelectedTier('main')}
>
<div className="flex items-start justify-between mb-4">
<div>
<div className="flex items-center gap-2 mb-1">
<Trophy className="w-5 h-5 text-yellow-400" />
<h3 className="text-lg font-semibold text-white">Main Sponsor</h3>
</div>
<p className="text-sm text-gray-400">Primary branding position</p>
</div>
{league.sponsorSlots.main.available ? (
<span className="px-2 py-1 rounded text-xs font-medium bg-performance-green/20 text-performance-green">
Available
</span>
) : (
<span className="px-2 py-1 rounded text-xs font-medium bg-gray-500/20 text-gray-400">
Filled
</span>
)}
</div>
<div className="flex gap-2">
<Button variant="secondary" className="flex-1">
<Download className="w-4 h-4 mr-2" />
Download Logo Pack
</Button>
<Button variant="secondary">
Update Logo
</Button>
<div className="text-3xl font-bold text-white mb-4">
${league.sponsorSlots.main.price}
<span className="text-sm font-normal text-gray-500">/season</span>
</div>
<ul className="space-y-2 mb-4">
{league.sponsorSlots.main.benefits.map((benefit, i) => (
<li key={i} className="flex items-center gap-2 text-sm text-gray-300">
<CheckCircle2 className="w-4 h-4 text-performance-green flex-shrink-0" />
{benefit}
</li>
))}
</ul>
{selectedTier === 'main' && league.sponsorSlots.main.available && (
<div className="w-4 h-4 rounded-full bg-primary-blue absolute top-4 right-4 flex items-center justify-center">
<CheckCircle2 className="w-3 h-3 text-white" />
</div>
)}
</Card>
{/* Secondary Sponsor */}
<Card
className={`p-5 cursor-pointer transition-all ${
selectedTier === 'secondary'
? 'border-primary-blue ring-2 ring-primary-blue/20'
: 'hover:border-charcoal-outline/80'
} ${league.sponsorSlots.secondary.available === 0 ? 'opacity-60' : ''}`}
onClick={() => league.sponsorSlots.secondary.available > 0 && setSelectedTier('secondary')}
>
<div className="flex items-start justify-between mb-4">
<div>
<div className="flex items-center gap-2 mb-1">
<Star className="w-5 h-5 text-purple-400" />
<h3 className="text-lg font-semibold text-white">Secondary Sponsor</h3>
</div>
<p className="text-sm text-gray-400">Supporting branding position</p>
</div>
{league.sponsorSlots.secondary.available > 0 ? (
<span className="px-2 py-1 rounded text-xs font-medium bg-performance-green/20 text-performance-green">
{league.sponsorSlots.secondary.available}/{league.sponsorSlots.secondary.total} Available
</span>
) : (
<span className="px-2 py-1 rounded text-xs font-medium bg-gray-500/20 text-gray-400">
Full
</span>
)}
</div>
<div className="text-3xl font-bold text-white mb-4">
${league.sponsorSlots.secondary.price}
<span className="text-sm font-normal text-gray-500">/season</span>
</div>
<ul className="space-y-2 mb-4">
{league.sponsorSlots.secondary.benefits.map((benefit, i) => (
<li key={i} className="flex items-center gap-2 text-sm text-gray-300">
<CheckCircle2 className="w-4 h-4 text-performance-green flex-shrink-0" />
{benefit}
</li>
))}
</ul>
{selectedTier === 'secondary' && league.sponsorSlots.secondary.available > 0 && (
<div className="w-4 h-4 rounded-full bg-primary-blue absolute top-4 right-4 flex items-center justify-center">
<CheckCircle2 className="w-3 h-3 text-white" />
</div>
)}
</Card>
</div>
{/* Checkout Summary */}
<Card className="p-5">
<h3 className="text-lg font-semibold text-white mb-4 flex items-center gap-2">
<CreditCard className="w-5 h-5 text-primary-blue" />
Sponsorship Summary
</h3>
<div className="space-y-3 mb-6">
<div className="flex justify-between py-2">
<span className="text-gray-400">Selected Tier</span>
<span className="text-white font-medium capitalize">{selectedTier} Sponsor</span>
</div>
<div className="flex justify-between py-2">
<span className="text-gray-400">Season Price</span>
<span className="text-white font-medium">
${selectedTier === 'main' ? league.sponsorSlots.main.price : league.sponsorSlots.secondary.price}
</span>
</div>
<div className="flex justify-between py-2">
<span className="text-gray-400">Platform Fee ({siteConfig.fees.platformFeePercent}%)</span>
<span className="text-white font-medium">
${((selectedTier === 'main' ? league.sponsorSlots.main.price : league.sponsorSlots.secondary.price) * siteConfig.fees.platformFeePercent / 100).toFixed(2)}
</span>
</div>
<div className="flex justify-between py-2 border-t border-charcoal-outline pt-4">
<span className="text-white font-semibold">Total (excl. VAT)</span>
<span className="text-white font-bold text-xl">
${((selectedTier === 'main' ? league.sponsorSlots.main.price : league.sponsorSlots.secondary.price) * (1 + siteConfig.fees.platformFeePercent / 100)).toFixed(2)}
</span>
</div>
</div>
</Card>
<Card className="p-4">
<h3 className="text-lg font-semibold text-white mb-4">Livery Preview</h3>
<div className="space-y-4">
<div className="aspect-video bg-iron-gray rounded-lg flex items-center justify-center border border-charcoal-outline">
<Trophy className="w-12 h-12 text-gray-500" />
</div>
<p className="text-sm text-gray-400">
Your logo appears on the primary hood position for all 32 drivers in this league.
</p>
<Button variant="secondary" className="w-full">
<Download className="w-4 h-4 mr-2" />
Download Sample Livery
<p className="text-xs text-gray-500 mb-4">
{siteConfig.vat.notice}
</p>
<div className="flex gap-3">
<Button variant="primary" className="flex-1">
<Megaphone className="w-4 h-4 mr-2" />
Request Sponsorship
</Button>
<Button variant="secondary">
<FileText className="w-4 h-4 mr-2" />
Download Info Pack
</Button>
</div>
</Card>

View File

@@ -1,16 +1,26 @@
'use client';
import { useState } from 'react';
import { motion, useReducedMotion } from 'framer-motion';
import Link from 'next/link';
import Card from '@/components/ui/Card';
import Button from '@/components/ui/Button';
import { siteConfig } from '@/lib/siteConfig';
import {
Trophy,
Users,
Eye,
Search,
Filter,
Star,
ChevronRight
ChevronRight,
Filter,
Car,
Flag,
TrendingUp,
CheckCircle2,
Clock,
Megaphone,
ArrowUpDown
} from 'lucide-react';
interface AvailableLeague {
@@ -23,6 +33,9 @@ interface AvailableLeague {
secondarySlots: { available: number; total: number; price: number };
rating: number;
tier: 'premium' | 'standard' | 'starter';
nextRace?: string;
seasonStatus: 'active' | 'upcoming' | 'completed';
description: string;
}
const MOCK_AVAILABLE_LEAGUES: AvailableLeague[] = [
@@ -36,6 +49,9 @@ const MOCK_AVAILABLE_LEAGUES: AvailableLeague[] = [
secondarySlots: { available: 1, total: 2, price: 400 },
rating: 4.8,
tier: 'premium',
nextRace: 'Dec 20 - Spa',
seasonStatus: 'active',
description: 'Premier GT3 racing with top-tier drivers. Weekly broadcasts and active community.',
},
{
id: 'league-2',
@@ -47,6 +63,9 @@ const MOCK_AVAILABLE_LEAGUES: AvailableLeague[] = [
secondarySlots: { available: 2, total: 2, price: 500 },
rating: 4.9,
tier: 'premium',
nextRace: 'Jan 5 - Nürburgring 24h',
seasonStatus: 'active',
description: 'Multi-class endurance racing. High engagement from dedicated endurance fans.',
},
{
id: 'league-3',
@@ -58,6 +77,9 @@ const MOCK_AVAILABLE_LEAGUES: AvailableLeague[] = [
secondarySlots: { available: 2, total: 2, price: 300 },
rating: 4.5,
tier: 'standard',
nextRace: 'Dec 22 - Monza',
seasonStatus: 'active',
description: 'Open-wheel racing excellence. Competitive field with consistent racing.',
},
{
id: 'league-4',
@@ -69,6 +91,9 @@ const MOCK_AVAILABLE_LEAGUES: AvailableLeague[] = [
secondarySlots: { available: 2, total: 2, price: 200 },
rating: 4.2,
tier: 'starter',
nextRace: 'Jan 10 - Brands Hatch',
seasonStatus: 'upcoming',
description: 'Touring car action with close racing. Great for building brand awareness.',
},
{
id: 'league-5',
@@ -80,138 +105,299 @@ const MOCK_AVAILABLE_LEAGUES: AvailableLeague[] = [
secondarySlots: { available: 1, total: 2, price: 350 },
rating: 4.6,
tier: 'standard',
nextRace: 'Dec 28 - Sebring',
seasonStatus: 'active',
description: 'Prototype racing at its finest. Growing community with passionate fans.',
},
{
id: 'league-6',
name: 'Rally Championship',
game: 'EA WRC',
drivers: 28,
avgViewsPerRace: 4500,
mainSponsorSlot: { available: true, price: 650 },
secondarySlots: { available: 2, total: 2, price: 250 },
rating: 4.4,
tier: 'standard',
nextRace: 'Jan 15 - Monte Carlo',
seasonStatus: 'upcoming',
description: 'Thrilling rally stages. Unique sponsorship exposure in rallying content.',
},
];
function LeagueCard({ league }: { league: AvailableLeague }) {
const tierColors = {
premium: 'bg-gradient-to-r from-yellow-500/20 to-amber-500/20 border-yellow-500/30',
standard: 'bg-gradient-to-r from-blue-500/20 to-cyan-500/20 border-blue-500/30',
starter: 'bg-gradient-to-r from-gray-500/20 to-slate-500/20 border-gray-500/30',
type SortOption = 'rating' | 'drivers' | 'price' | 'views';
type TierFilter = 'all' | 'premium' | 'standard' | 'starter';
type AvailabilityFilter = 'all' | 'main' | 'secondary';
function LeagueCard({ league, index }: { league: AvailableLeague; index: number }) {
const shouldReduceMotion = useReducedMotion();
const tierConfig = {
premium: {
bg: 'bg-gradient-to-br from-yellow-500/10 to-amber-500/5',
border: 'border-yellow-500/30',
badge: 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30',
icon: '⭐'
},
standard: {
bg: 'bg-gradient-to-br from-primary-blue/10 to-cyan-500/5',
border: 'border-primary-blue/30',
badge: 'bg-primary-blue/20 text-primary-blue border-primary-blue/30',
icon: '🏆'
},
starter: {
bg: 'bg-gradient-to-br from-gray-500/10 to-slate-500/5',
border: 'border-gray-500/30',
badge: 'bg-gray-500/20 text-gray-400 border-gray-500/30',
icon: '🚀'
},
};
const tierBadgeColors = {
premium: 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30',
standard: 'bg-blue-500/20 text-blue-400 border-blue-500/30',
starter: 'bg-gray-500/20 text-gray-400 border-gray-500/30',
const statusConfig = {
active: { color: 'text-performance-green', bg: 'bg-performance-green/10', label: 'Active Season' },
upcoming: { color: 'text-warning-amber', bg: 'bg-warning-amber/10', label: 'Starting Soon' },
completed: { color: 'text-gray-400', bg: 'bg-gray-400/10', label: 'Season Ended' },
};
const config = tierConfig[league.tier];
const status = statusConfig[league.seasonStatus];
const cpm = (league.mainSponsorSlot.price / league.avgViewsPerRace * 1000).toFixed(0);
return (
<Card className={`overflow-hidden border ${tierColors[league.tier]}`}>
<div className="p-4">
<div className="flex items-start justify-between mb-3">
<div>
<div className="flex items-center gap-2 mb-1">
<h3 className="font-semibold text-white">{league.name}</h3>
<span className={`px-2 py-0.5 rounded text-xs font-medium capitalize border ${tierBadgeColors[league.tier]}`}>
{league.tier}
</span>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: index * 0.05 }}
>
<Card className={`overflow-hidden border ${config.border} ${config.bg} hover:border-primary-blue/50 transition-all duration-300 h-full`}>
<div className="p-5">
{/* Header */}
<div className="flex items-start justify-between mb-3">
<div className="flex-1">
<div className="flex items-center gap-2 mb-1">
<span className={`px-2 py-0.5 rounded text-xs font-medium capitalize border ${config.badge}`}>
{config.icon} {league.tier}
</span>
<span className={`px-2 py-0.5 rounded text-xs font-medium ${status.bg} ${status.color}`}>
{status.label}
</span>
</div>
<h3 className="font-semibold text-white text-lg">{league.name}</h3>
<p className="text-sm text-gray-500">{league.game}</p>
</div>
<div className="flex items-center gap-1 bg-iron-gray/50 px-2 py-1 rounded">
<Star className="w-4 h-4 text-yellow-400 fill-yellow-400" />
<span className="text-sm font-medium text-white">{league.rating}</span>
</div>
<p className="text-sm text-gray-400">{league.game}</p>
</div>
<div className="flex items-center gap-1">
<Star className="w-4 h-4 text-yellow-400 fill-yellow-400" />
<span className="text-sm text-white">{league.rating}</span>
</div>
</div>
<div className="grid grid-cols-3 gap-3 mb-4">
<div className="text-center p-2 bg-iron-gray/50 rounded">
<div className="text-lg font-bold text-white">{league.drivers}</div>
<div className="text-xs text-gray-500">Drivers</div>
</div>
<div className="text-center p-2 bg-iron-gray/50 rounded">
<div className="text-lg font-bold text-white">{(league.avgViewsPerRace / 1000).toFixed(1)}k</div>
<div className="text-xs text-gray-500">Avg Views</div>
</div>
<div className="text-center p-2 bg-iron-gray/50 rounded">
<div className="text-lg font-bold text-white">${(league.mainSponsorSlot.price / league.avgViewsPerRace * 1000).toFixed(0)}</div>
<div className="text-xs text-gray-500">CPM</div>
</div>
</div>
{/* Description */}
<p className="text-sm text-gray-400 mb-4 line-clamp-2">{league.description}</p>
<div className="space-y-2 mb-4">
<div className="flex items-center justify-between p-2 bg-iron-gray/30 rounded">
<div className="flex items-center gap-2">
<div className={`w-2 h-2 rounded-full ${league.mainSponsorSlot.available ? 'bg-performance-green' : 'bg-racing-red'}`} />
<span className="text-sm text-gray-300">Main Sponsor</span>
{/* Stats Grid */}
<div className="grid grid-cols-3 gap-2 mb-4">
<div className="text-center p-2 bg-iron-gray/50 rounded-lg">
<div className="text-lg font-bold text-white">{league.drivers}</div>
<div className="text-xs text-gray-500">Drivers</div>
</div>
<div className="text-sm">
{league.mainSponsorSlot.available ? (
<span className="text-white font-medium">${league.mainSponsorSlot.price}/season</span>
) : (
<span className="text-gray-500">Taken</span>
)}
<div className="text-center p-2 bg-iron-gray/50 rounded-lg">
<div className="text-lg font-bold text-white">{(league.avgViewsPerRace / 1000).toFixed(1)}k</div>
<div className="text-xs text-gray-500">Avg Views</div>
</div>
<div className="text-center p-2 bg-iron-gray/50 rounded-lg">
<div className="text-lg font-bold text-performance-green">${cpm}</div>
<div className="text-xs text-gray-500">CPM</div>
</div>
</div>
<div className="flex items-center justify-between p-2 bg-iron-gray/30 rounded">
<div className="flex items-center gap-2">
<div className={`w-2 h-2 rounded-full ${league.secondarySlots.available > 0 ? 'bg-performance-green' : 'bg-racing-red'}`} />
<span className="text-sm text-gray-300">Secondary Slots</span>
</div>
<div className="text-sm">
{league.secondarySlots.available > 0 ? (
<span className="text-white font-medium">{league.secondarySlots.available}/{league.secondarySlots.total} @ ${league.secondarySlots.price}</span>
) : (
<span className="text-gray-500">Full</span>
)}
</div>
</div>
</div>
<div className="flex gap-2">
<Button variant="secondary" className="flex-1">
View Details
</Button>
{(league.mainSponsorSlot.available || league.secondarySlots.available > 0) && (
<Button variant="primary" className="flex-1">
Sponsor
</Button>
{/* Next Race */}
{league.nextRace && (
<div className="flex items-center gap-2 mb-4 text-sm">
<Clock className="w-4 h-4 text-gray-500" />
<span className="text-gray-400">Next:</span>
<span className="text-white">{league.nextRace}</span>
</div>
)}
{/* Sponsorship Slots */}
<div className="space-y-2 mb-4">
<div className="flex items-center justify-between p-2.5 bg-iron-gray/30 rounded-lg">
<div className="flex items-center gap-2">
<div className={`w-2.5 h-2.5 rounded-full ${league.mainSponsorSlot.available ? 'bg-performance-green' : 'bg-racing-red'}`} />
<span className="text-sm text-gray-300">Main Sponsor</span>
</div>
<div className="text-sm">
{league.mainSponsorSlot.available ? (
<span className="text-white font-semibold">${league.mainSponsorSlot.price}/season</span>
) : (
<span className="text-gray-500 flex items-center gap-1">
<CheckCircle2 className="w-3 h-3" /> Filled
</span>
)}
</div>
</div>
<div className="flex items-center justify-between p-2.5 bg-iron-gray/30 rounded-lg">
<div className="flex items-center gap-2">
<div className={`w-2.5 h-2.5 rounded-full ${league.secondarySlots.available > 0 ? 'bg-performance-green' : 'bg-racing-red'}`} />
<span className="text-sm text-gray-300">Secondary Slots</span>
</div>
<div className="text-sm">
{league.secondarySlots.available > 0 ? (
<span className="text-white font-semibold">
{league.secondarySlots.available}/{league.secondarySlots.total} @ ${league.secondarySlots.price}
</span>
) : (
<span className="text-gray-500 flex items-center gap-1">
<CheckCircle2 className="w-3 h-3" /> Full
</span>
)}
</div>
</div>
</div>
{/* Actions */}
<div className="flex gap-2">
<Link href={`/sponsor/leagues/${league.id}`} className="flex-1">
<Button variant="secondary" className="w-full text-sm">
View Details
</Button>
</Link>
{(league.mainSponsorSlot.available || league.secondarySlots.available > 0) && (
<Link href={`/sponsor/leagues/${league.id}?action=sponsor`} className="flex-1">
<Button variant="primary" className="w-full text-sm">
Sponsor
</Button>
</Link>
)}
</div>
</div>
</div>
</Card>
</Card>
</motion.div>
);
}
export default function SponsorLeaguesPage() {
const shouldReduceMotion = useReducedMotion();
const [searchQuery, setSearchQuery] = useState('');
const [tierFilter, setTierFilter] = useState<'all' | 'premium' | 'standard' | 'starter'>('all');
const [availabilityFilter, setAvailabilityFilter] = useState<'all' | 'main' | 'secondary'>('all');
const [tierFilter, setTierFilter] = useState<TierFilter>('all');
const [availabilityFilter, setAvailabilityFilter] = useState<AvailabilityFilter>('all');
const [sortBy, setSortBy] = useState<SortOption>('rating');
const filteredLeagues = MOCK_AVAILABLE_LEAGUES.filter(league => {
if (searchQuery && !league.name.toLowerCase().includes(searchQuery.toLowerCase())) {
return false;
}
if (tierFilter !== 'all' && league.tier !== tierFilter) {
return false;
}
if (availabilityFilter === 'main' && !league.mainSponsorSlot.available) {
return false;
}
if (availabilityFilter === 'secondary' && league.secondarySlots.available === 0) {
return false;
}
return true;
});
// Filter and sort leagues
const filteredLeagues = MOCK_AVAILABLE_LEAGUES
.filter(league => {
if (searchQuery && !league.name.toLowerCase().includes(searchQuery.toLowerCase())) {
return false;
}
if (tierFilter !== 'all' && league.tier !== tierFilter) {
return false;
}
if (availabilityFilter === 'main' && !league.mainSponsorSlot.available) {
return false;
}
if (availabilityFilter === 'secondary' && league.secondarySlots.available === 0) {
return false;
}
return true;
})
.sort((a, b) => {
switch (sortBy) {
case 'rating': return b.rating - a.rating;
case 'drivers': return b.drivers - a.drivers;
case 'price': return a.mainSponsorSlot.price - b.mainSponsorSlot.price;
case 'views': return b.avgViewsPerRace - a.avgViewsPerRace;
default: return 0;
}
});
// Calculate summary stats
const stats = {
total: MOCK_AVAILABLE_LEAGUES.length,
mainAvailable: MOCK_AVAILABLE_LEAGUES.filter(l => l.mainSponsorSlot.available).length,
secondaryAvailable: MOCK_AVAILABLE_LEAGUES.reduce((sum, l) => sum + l.secondarySlots.available, 0),
totalDrivers: MOCK_AVAILABLE_LEAGUES.reduce((sum, l) => sum + l.drivers, 0),
avgCpm: Math.round(
MOCK_AVAILABLE_LEAGUES.reduce((sum, l) => sum + (l.mainSponsorSlot.price / l.avgViewsPerRace * 1000), 0) /
MOCK_AVAILABLE_LEAGUES.length
),
};
return (
<div className="max-w-7xl mx-auto py-8 px-4">
{/* Breadcrumb */}
<div className="flex items-center gap-2 text-sm text-gray-400 mb-6">
<a href="/sponsor/dashboard" className="hover:text-white">Dashboard</a>
<Link href="/sponsor/dashboard" className="hover:text-white transition-colors">Dashboard</Link>
<ChevronRight className="w-4 h-4" />
<span className="text-white">Browse Leagues</span>
</div>
{/* Header */}
<div className="mb-8">
<h1 className="text-2xl font-bold text-white mb-2">Find Leagues to Sponsor</h1>
<p className="text-gray-400">Discover racing leagues looking for sponsors and grow your brand</p>
<h1 className="text-2xl font-bold text-white mb-2 flex items-center gap-3">
<Trophy className="w-7 h-7 text-primary-blue" />
League Sponsorship Marketplace
</h1>
<p className="text-gray-400">
Discover racing leagues looking for sponsors. All prices shown exclude VAT.
</p>
</div>
{/* Stats Overview */}
<div className="grid grid-cols-2 md:grid-cols-5 gap-4 mb-8">
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
>
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-white">{stats.total}</div>
<div className="text-sm text-gray-400">Leagues</div>
</Card>
</motion.div>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.1 }}
>
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-performance-green">{stats.mainAvailable}</div>
<div className="text-sm text-gray-400">Main Slots</div>
</Card>
</motion.div>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.2 }}
>
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-primary-blue">{stats.secondaryAvailable}</div>
<div className="text-sm text-gray-400">Secondary Slots</div>
</Card>
</motion.div>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 }}
>
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-white">{stats.totalDrivers}</div>
<div className="text-sm text-gray-400">Total Drivers</div>
</Card>
</motion.div>
<motion.div
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.4 }}
>
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-warning-amber">${stats.avgCpm}</div>
<div className="text-sm text-gray-400">Avg CPM</div>
</Card>
</motion.div>
</div>
{/* Filters */}
<div className="flex flex-col md:flex-row gap-4 mb-6">
<div className="flex flex-col lg:flex-row gap-4 mb-6">
{/* Search */}
<div className="relative flex-1">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500" />
<input
@@ -219,79 +405,100 @@ export default function SponsorLeaguesPage() {
placeholder="Search leagues..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="w-full pl-10 pr-4 py-2 rounded-lg border border-charcoal-outline bg-iron-gray text-white placeholder-gray-500 focus:border-primary-blue focus:outline-none"
className="w-full pl-10 pr-4 py-2.5 rounded-lg border border-charcoal-outline bg-iron-gray text-white placeholder-gray-500 focus:border-primary-blue focus:outline-none"
/>
</div>
<div className="flex gap-2">
<select
value={tierFilter}
onChange={(e) => setTierFilter(e.target.value as typeof tierFilter)}
className="px-3 py-2 rounded-lg border border-charcoal-outline bg-iron-gray text-white focus:border-primary-blue focus:outline-none"
>
<option value="all">All Tiers</option>
<option value="premium">Premium</option>
<option value="standard">Standard</option>
<option value="starter">Starter</option>
</select>
<select
value={availabilityFilter}
onChange={(e) => setAvailabilityFilter(e.target.value as typeof availabilityFilter)}
className="px-3 py-2 rounded-lg border border-charcoal-outline bg-iron-gray text-white focus:border-primary-blue focus:outline-none"
>
<option value="all">All Slots</option>
<option value="main">Main Available</option>
<option value="secondary">Secondary Available</option>
</select>
</div>
{/* Tier Filter */}
<select
value={tierFilter}
onChange={(e) => setTierFilter(e.target.value as TierFilter)}
className="px-4 py-2.5 rounded-lg border border-charcoal-outline bg-iron-gray text-white focus:border-primary-blue focus:outline-none"
>
<option value="all">All Tiers</option>
<option value="premium"> Premium</option>
<option value="standard">🏆 Standard</option>
<option value="starter">🚀 Starter</option>
</select>
{/* Availability Filter */}
<select
value={availabilityFilter}
onChange={(e) => setAvailabilityFilter(e.target.value as AvailabilityFilter)}
className="px-4 py-2.5 rounded-lg border border-charcoal-outline bg-iron-gray text-white focus:border-primary-blue focus:outline-none"
>
<option value="all">All Slots</option>
<option value="main">Main Available</option>
<option value="secondary">Secondary Available</option>
</select>
{/* Sort */}
<select
value={sortBy}
onChange={(e) => setSortBy(e.target.value as SortOption)}
className="px-4 py-2.5 rounded-lg border border-charcoal-outline bg-iron-gray text-white focus:border-primary-blue focus:outline-none"
>
<option value="rating">Sort by Rating</option>
<option value="drivers">Sort by Drivers</option>
<option value="views">Sort by Views</option>
<option value="price">Sort by Price</option>
</select>
</div>
{/* Stats Banner */}
<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-8">
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-white">{MOCK_AVAILABLE_LEAGUES.length}</div>
<div className="text-sm text-gray-400">Available Leagues</div>
</Card>
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-performance-green">
{MOCK_AVAILABLE_LEAGUES.filter(l => l.mainSponsorSlot.available).length}
</div>
<div className="text-sm text-gray-400">Main Slots Open</div>
</Card>
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-primary-blue">
{MOCK_AVAILABLE_LEAGUES.reduce((sum, l) => sum + l.secondarySlots.available, 0)}
</div>
<div className="text-sm text-gray-400">Secondary Slots Open</div>
</Card>
<Card className="p-4 text-center">
<div className="text-2xl font-bold text-white">
{MOCK_AVAILABLE_LEAGUES.reduce((sum, l) => sum + l.drivers, 0)}
</div>
<div className="text-sm text-gray-400">Total Drivers</div>
</Card>
{/* Results Count */}
<div className="flex items-center justify-between mb-6">
<p className="text-sm text-gray-400">
Showing {filteredLeagues.length} of {MOCK_AVAILABLE_LEAGUES.length} leagues
</p>
<div className="flex items-center gap-2">
<Link href="/teams">
<Button variant="secondary" className="text-sm">
<Users className="w-4 h-4 mr-2" />
Browse Teams
</Button>
</Link>
<Link href="/drivers">
<Button variant="secondary" className="text-sm">
<Car className="w-4 h-4 mr-2" />
Browse Drivers
</Button>
</Link>
</div>
</div>
{/* League Grid */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{filteredLeagues.map((league) => (
<LeagueCard key={league.id} league={league} />
))}
</div>
{filteredLeagues.length === 0 && (
<div className="text-center py-12">
{filteredLeagues.length > 0 ? (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{filteredLeagues.map((league, index) => (
<LeagueCard key={league.id} league={league} index={index} />
))}
</div>
) : (
<Card className="text-center py-16">
<Trophy className="w-12 h-12 text-gray-500 mx-auto mb-4" />
<h3 className="text-lg font-medium text-white mb-2">No leagues found</h3>
<p className="text-gray-400">Try adjusting your filters to see more results</p>
</div>
<p className="text-gray-400 mb-6">Try adjusting your filters to see more results</p>
<Button variant="secondary" onClick={() => {
setSearchQuery('');
setTierFilter('all');
setAvailabilityFilter('all');
}}>
Clear Filters
</Button>
</Card>
)}
{/* Alpha Notice */}
<div className="mt-8 rounded-lg bg-warning-amber/10 border border-warning-amber/30 p-4">
<p className="text-xs text-gray-400">
<strong className="text-warning-amber">Alpha Note:</strong> League sponsorship marketplace is demonstration-only.
Actual sponsorship purchases will be available when the payment system is fully implemented.
</p>
{/* Platform Fee Notice */}
<div className="mt-8 rounded-lg bg-iron-gray/50 border border-charcoal-outline p-4">
<div className="flex items-start gap-3">
<Megaphone className="w-5 h-5 text-primary-blue flex-shrink-0 mt-0.5" />
<div>
<p className="text-sm text-gray-300 font-medium mb-1">Platform Fee</p>
<p className="text-xs text-gray-500">
A {siteConfig.fees.platformFeePercent}% platform fee applies to all sponsorship payments. {siteConfig.fees.description}
</p>
</div>
</div>
</div>
</div>
);

View File

@@ -2,28 +2,63 @@
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 {
Settings,
Building2,
Mail,
import Toggle from '@/components/ui/Toggle';
import SectionHeader from '@/components/ui/SectionHeader';
import FormField from '@/components/ui/FormField';
import PageHeader from '@/components/ui/PageHeader';
import {
Settings,
Building2,
Mail,
Globe,
Upload,
Save,
Bell,
Shield,
Eye,
Trash2
Trash2,
CheckCircle,
User,
Phone,
MapPin,
FileText,
Link as LinkIcon,
Image as ImageIcon,
Lock,
Key,
Smartphone,
AlertCircle
} from 'lucide-react';
// ============================================================================
// Types
// ============================================================================
interface SponsorProfile {
name: string;
email: string;
companyName: string;
contactName: string;
contactEmail: string;
contactPhone: string;
website: string;
description: string;
logoUrl: string | null;
industry: string;
address: {
street: string;
city: string;
country: string;
postalCode: string;
};
taxId: string;
socialLinks: {
twitter: string;
linkedin: string;
instagram: string;
};
}
interface NotificationSettings {
@@ -31,15 +66,42 @@ interface NotificationSettings {
emailWeeklyReport: boolean;
emailRaceAlerts: boolean;
emailPaymentAlerts: boolean;
emailNewOpportunities: boolean;
emailContractExpiry: boolean;
}
// Mock data
interface PrivacySettings {
publicProfile: boolean;
showStats: boolean;
showActiveSponsorships: boolean;
allowDirectContact: boolean;
}
// ============================================================================
// Mock Data
// ============================================================================
const MOCK_PROFILE: SponsorProfile = {
name: 'Acme Racing Co.',
email: 'sponsor@acme-racing.com',
companyName: 'Acme Racing Co.',
contactName: 'John Smith',
contactEmail: 'sponsor@acme-racing.com',
contactPhone: '+1 (555) 123-4567',
website: 'https://acme-racing.com',
description: 'Premium sim racing equipment and accessories for competitive drivers.',
description: 'Premium sim racing equipment and accessories for competitive drivers. We specialize in high-performance steering wheels, pedals, and cockpit systems used by professionals worldwide.',
logoUrl: null,
industry: 'Racing Equipment',
address: {
street: '123 Racing Boulevard',
city: 'Indianapolis',
country: 'United States',
postalCode: '46222',
},
taxId: 'US12-3456789',
socialLinks: {
twitter: '@acmeracing',
linkedin: 'acme-racing-co',
instagram: '@acmeracing',
},
};
const MOCK_NOTIFICATIONS: NotificationSettings = {
@@ -47,35 +109,63 @@ const MOCK_NOTIFICATIONS: NotificationSettings = {
emailWeeklyReport: true,
emailRaceAlerts: false,
emailPaymentAlerts: true,
emailNewOpportunities: true,
emailContractExpiry: true,
};
function Toggle({ checked, onChange, label }: { checked: boolean; onChange: (checked: boolean) => void; label: string }) {
const MOCK_PRIVACY: PrivacySettings = {
publicProfile: true,
showStats: false,
showActiveSponsorships: true,
allowDirectContact: true,
};
const INDUSTRY_OPTIONS = [
'Racing Equipment',
'Automotive',
'Technology',
'Gaming & Esports',
'Energy Drinks',
'Apparel',
'Financial Services',
'Other',
];
// ============================================================================
// Components
// ============================================================================
function SavedIndicator({ visible }: { visible: boolean }) {
const shouldReduceMotion = useReducedMotion();
return (
<label className="flex items-center justify-between cursor-pointer">
<span className="text-gray-300">{label}</span>
<button
type="button"
onClick={() => onChange(!checked)}
className={`relative w-11 h-6 rounded-full transition-colors ${checked ? 'bg-primary-blue' : 'bg-iron-gray'}`}
>
<span
className={`absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform ${checked ? 'translate-x-5' : ''}`}
/>
</button>
</label>
<motion.div
initial={{ opacity: 0, x: 20 }}
animate={{ opacity: visible ? 1 : 0, x: visible ? 0 : 20 }}
transition={{ duration: shouldReduceMotion ? 0 : 0.2 }}
className="flex items-center gap-2 text-performance-green"
>
<CheckCircle className="w-4 h-4" />
<span className="text-sm font-medium">Changes saved</span>
</motion.div>
);
}
// ============================================================================
// Main Component
// ============================================================================
export default function SponsorSettingsPage() {
const router = useRouter();
const shouldReduceMotion = useReducedMotion();
const [profile, setProfile] = useState(MOCK_PROFILE);
const [notifications, setNotifications] = useState(MOCK_NOTIFICATIONS);
const [privacy, setPrivacy] = useState(MOCK_PRIVACY);
const [saving, setSaving] = useState(false);
const [saved, setSaved] = useState(false);
const handleSaveProfile = async () => {
setSaving(true);
// Simulate API call
await new Promise(resolve => setTimeout(resolve, 800));
setSaving(false);
setSaved(true);
@@ -83,251 +173,498 @@ export default function SponsorSettingsPage() {
};
const handleDeleteAccount = () => {
if (confirm('Are you sure you want to delete your sponsor account? This action cannot be undone.')) {
// Clear demo cookies and redirect
if (confirm('Are you sure you want to delete your sponsor account? This action cannot be undone. All sponsorship data will be permanently removed.')) {
document.cookie = 'gridpilot_demo_mode=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
document.cookie = 'gridpilot_sponsor_id=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
router.push('/');
}
};
const containerVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: shouldReduceMotion ? 0 : 0.1,
},
},
};
const itemVariants = {
hidden: { opacity: 0, y: 20 },
visible: { opacity: 1, y: 0 },
};
return (
<div className="max-w-3xl mx-auto py-8 px-4">
<motion.div
className="max-w-4xl mx-auto py-8 px-4"
variants={containerVariants}
initial="hidden"
animate="visible"
>
{/* Header */}
<div className="mb-8">
<h1 className="text-2xl font-bold text-white flex items-center gap-3">
<Settings className="w-7 h-7 text-gray-400" />
Sponsor Settings
</h1>
<p className="text-gray-400 mt-1">Manage your sponsor profile and preferences</p>
</div>
<motion.div variants={itemVariants}>
<PageHeader
icon={Settings}
title="Sponsor Settings"
description="Manage your company profile, notifications, and security preferences"
action={<SavedIndicator visible={saved} />}
/>
</motion.div>
{/* Company Profile */}
<Card className="mb-6">
<div className="p-4 border-b border-charcoal-outline">
<h2 className="text-lg font-semibold text-white flex items-center gap-2">
<Building2 className="w-5 h-5 text-primary-blue" />
Company Profile
</h2>
</div>
<div className="p-4 space-y-4">
<div>
<label className="block text-sm font-medium text-gray-300 mb-2">Company Name</label>
<Input
type="text"
value={profile.name}
onChange={(e) => setProfile({ ...profile, name: e.target.value })}
placeholder="Your company name"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-300 mb-2">
<div className="flex items-center gap-2">
<Mail className="w-4 h-4 text-gray-500" />
Contact Email
</div>
</label>
<Input
type="email"
value={profile.email}
onChange={(e) => setProfile({ ...profile, email: e.target.value })}
placeholder="sponsor@company.com"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-300 mb-2">
<div className="flex items-center gap-2">
<Globe className="w-4 h-4 text-gray-500" />
Website
</div>
</label>
<Input
type="url"
value={profile.website}
onChange={(e) => setProfile({ ...profile, website: e.target.value })}
placeholder="https://company.com"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-300 mb-2">Company Description</label>
<textarea
value={profile.description}
onChange={(e) => setProfile({ ...profile, description: e.target.value })}
placeholder="Tell leagues about your company..."
rows={3}
className="w-full px-3 py-2 bg-iron-gray border border-charcoal-outline rounded-lg text-white placeholder-gray-500 focus:outline-none focus:border-primary-blue resize-none"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-300 mb-2">
<div className="flex items-center gap-2">
<Upload className="w-4 h-4 text-gray-500" />
Company Logo
</div>
</label>
<div className="flex items-center gap-4">
<div className="w-20 h-20 rounded-lg bg-iron-gray border border-charcoal-outline flex items-center justify-center">
<Building2 className="w-8 h-8 text-gray-500" />
</div>
<div>
<input
type="file"
accept="image/png,image/jpeg,image/svg+xml"
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"
<motion.div variants={itemVariants}>
<Card className="mb-6 overflow-hidden">
<SectionHeader
icon={Building2}
title="Company Profile"
description="Your public-facing company information"
/>
<div className="p-6 space-y-6">
{/* Company Basic Info */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<FormField label="Company Name" icon={Building2} required>
<Input
type="text"
value={profile.companyName}
onChange={(e) => setProfile({ ...profile, companyName: e.target.value })}
placeholder="Your company name"
/>
<p className="text-xs text-gray-500 mt-1">PNG, JPEG, or SVG. Max 2MB.</p>
</FormField>
<FormField label="Industry">
<select
value={profile.industry}
onChange={(e) => setProfile({ ...profile, industry: e.target.value })}
className="w-full px-3 py-2 bg-iron-gray border border-charcoal-outline rounded-lg text-white focus:outline-none focus:border-primary-blue"
>
{INDUSTRY_OPTIONS.map(industry => (
<option key={industry} value={industry}>{industry}</option>
))}
</select>
</FormField>
</div>
{/* Contact Information */}
<div className="pt-4 border-t border-charcoal-outline/50">
<h3 className="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">
Contact Information
</h3>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<FormField label="Contact Name" icon={User} required>
<Input
type="text"
value={profile.contactName}
onChange={(e) => setProfile({ ...profile, contactName: e.target.value })}
placeholder="Full name"
/>
</FormField>
<FormField label="Contact Email" icon={Mail} required>
<Input
type="email"
value={profile.contactEmail}
onChange={(e) => setProfile({ ...profile, contactEmail: e.target.value })}
placeholder="sponsor@company.com"
/>
</FormField>
<FormField label="Phone Number" icon={Phone}>
<Input
type="tel"
value={profile.contactPhone}
onChange={(e) => setProfile({ ...profile, contactPhone: e.target.value })}
placeholder="+1 (555) 123-4567"
/>
</FormField>
<FormField label="Website" icon={Globe}>
<Input
type="url"
value={profile.website}
onChange={(e) => setProfile({ ...profile, website: e.target.value })}
placeholder="https://company.com"
/>
</FormField>
</div>
</div>
</div>
<div className="pt-4 border-t border-charcoal-outline flex items-center justify-between">
<Button
variant="primary"
onClick={handleSaveProfile}
disabled={saving}
>
{saving ? (
'Saving...'
) : saved ? (
<>
<Save className="w-4 h-4 mr-2" />
Saved!
</>
) : (
<>
<Save className="w-4 h-4 mr-2" />
Save Changes
</>
)}
</Button>
{/* Address */}
<div className="pt-4 border-t border-charcoal-outline/50">
<h3 className="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">
Business Address
</h3>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="md:col-span-2">
<FormField label="Street Address" icon={MapPin}>
<Input
type="text"
value={profile.address.street}
onChange={(e) => setProfile({
...profile,
address: { ...profile.address, street: e.target.value }
})}
placeholder="123 Main Street"
/>
</FormField>
</div>
<FormField label="City">
<Input
type="text"
value={profile.address.city}
onChange={(e) => setProfile({
...profile,
address: { ...profile.address, city: e.target.value }
})}
placeholder="City"
/>
</FormField>
<FormField label="Postal Code">
<Input
type="text"
value={profile.address.postalCode}
onChange={(e) => setProfile({
...profile,
address: { ...profile.address, postalCode: e.target.value }
})}
placeholder="12345"
/>
</FormField>
<FormField label="Country">
<Input
type="text"
value={profile.address.country}
onChange={(e) => setProfile({
...profile,
address: { ...profile.address, country: e.target.value }
})}
placeholder="Country"
/>
</FormField>
<FormField label="Tax ID / VAT Number" icon={FileText}>
<Input
type="text"
value={profile.taxId}
onChange={(e) => setProfile({ ...profile, taxId: e.target.value })}
placeholder="XX12-3456789"
/>
</FormField>
</div>
</div>
{/* Description */}
<div className="pt-4 border-t border-charcoal-outline/50">
<FormField label="Company Description">
<textarea
value={profile.description}
onChange={(e) => setProfile({ ...profile, description: e.target.value })}
placeholder="Tell potential sponsorship partners about your company, products, and what you're looking for in sponsorship opportunities..."
rows={4}
className="w-full px-4 py-3 bg-iron-gray border border-charcoal-outline rounded-lg text-white placeholder-gray-500 focus:outline-none focus:border-primary-blue resize-none"
/>
<p className="text-xs text-gray-500 mt-1">
This description appears on your public sponsor profile.
</p>
</FormField>
</div>
{/* Social Links */}
<div className="pt-4 border-t border-charcoal-outline/50">
<h3 className="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">
Social Media
</h3>
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
<FormField label="Twitter / X" icon={LinkIcon}>
<Input
type="text"
value={profile.socialLinks.twitter}
onChange={(e) => setProfile({
...profile,
socialLinks: { ...profile.socialLinks, twitter: e.target.value }
})}
placeholder="@username"
/>
</FormField>
<FormField label="LinkedIn" icon={LinkIcon}>
<Input
type="text"
value={profile.socialLinks.linkedin}
onChange={(e) => setProfile({
...profile,
socialLinks: { ...profile.socialLinks, linkedin: e.target.value }
})}
placeholder="company-name"
/>
</FormField>
<FormField label="Instagram" icon={LinkIcon}>
<Input
type="text"
value={profile.socialLinks.instagram}
onChange={(e) => setProfile({
...profile,
socialLinks: { ...profile.socialLinks, instagram: e.target.value }
})}
placeholder="@username"
/>
</FormField>
</div>
</div>
{/* Logo Upload */}
<div className="pt-4 border-t border-charcoal-outline/50">
<FormField label="Company Logo" icon={ImageIcon}>
<div className="flex items-start gap-6">
<div className="w-24 h-24 rounded-xl bg-gradient-to-br from-iron-gray to-deep-graphite border-2 border-dashed border-charcoal-outline flex items-center justify-center overflow-hidden">
{profile.logoUrl ? (
<img src={profile.logoUrl} alt="Company logo" className="w-full h-full object-cover" />
) : (
<Building2 className="w-10 h-10 text-gray-600" />
)}
</div>
<div className="flex-1">
<div className="flex items-center gap-3">
<label className="cursor-pointer">
<input
type="file"
accept="image/png,image/jpeg,image/svg+xml"
className="hidden"
/>
<div className="px-4 py-2 rounded-lg bg-iron-gray border border-charcoal-outline text-gray-300 hover:bg-charcoal-outline transition-colors flex items-center gap-2">
<Upload className="w-4 h-4" />
Upload Logo
</div>
</label>
{profile.logoUrl && (
<Button variant="secondary" className="text-sm text-gray-400">
Remove
</Button>
)}
</div>
<p className="text-xs text-gray-500 mt-2">
PNG, JPEG, or SVG. Max 2MB. Recommended size: 400x400px.
</p>
</div>
</div>
</FormField>
</div>
{/* Save Button */}
<div className="pt-6 border-t border-charcoal-outline flex items-center justify-end gap-4">
<Button
variant="primary"
onClick={handleSaveProfile}
disabled={saving}
className="min-w-[160px]"
>
{saving ? (
<span className="flex items-center gap-2">
<span className="w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin" />
Saving...
</span>
) : (
<span className="flex items-center gap-2">
<Save className="w-4 h-4" />
Save Profile
</span>
)}
</Button>
</div>
</div>
</div>
</Card>
</Card>
</motion.div>
{/* Notification Preferences */}
<Card className="mb-6">
<div className="p-4 border-b border-charcoal-outline">
<h2 className="text-lg font-semibold text-white flex items-center gap-2">
<Bell className="w-5 h-5 text-warning-amber" />
Notifications
</h2>
</div>
<div className="p-4 space-y-4">
<Toggle
checked={notifications.emailNewSponsorships}
onChange={(checked) => setNotifications({ ...notifications, emailNewSponsorships: checked })}
label="Email when a sponsorship is approved"
<motion.div variants={itemVariants}>
<Card className="mb-6 overflow-hidden">
<SectionHeader
icon={Bell}
title="Email Notifications"
description="Control which emails you receive from GridPilot"
color="text-warning-amber"
/>
<Toggle
checked={notifications.emailWeeklyReport}
onChange={(checked) => setNotifications({ ...notifications, emailWeeklyReport: checked })}
label="Weekly analytics report"
/>
<Toggle
checked={notifications.emailRaceAlerts}
onChange={(checked) => setNotifications({ ...notifications, emailRaceAlerts: checked })}
label="Race day alerts for sponsored leagues"
/>
<Toggle
checked={notifications.emailPaymentAlerts}
onChange={(checked) => setNotifications({ ...notifications, emailPaymentAlerts: checked })}
label="Payment and invoice notifications"
/>
</div>
</Card>
<div className="p-6">
<div className="space-y-1">
<Toggle
checked={notifications.emailNewSponsorships}
onChange={(checked) => setNotifications({ ...notifications, emailNewSponsorships: checked })}
label="Sponsorship Approvals"
description="Receive confirmation when your sponsorship requests are approved"
/>
<Toggle
checked={notifications.emailWeeklyReport}
onChange={(checked) => setNotifications({ ...notifications, emailWeeklyReport: checked })}
label="Weekly Analytics Report"
description="Get a weekly summary of your sponsorship performance"
/>
<Toggle
checked={notifications.emailRaceAlerts}
onChange={(checked) => setNotifications({ ...notifications, emailRaceAlerts: checked })}
label="Race Day Alerts"
description="Be notified when sponsored leagues have upcoming races"
/>
<Toggle
checked={notifications.emailPaymentAlerts}
onChange={(checked) => setNotifications({ ...notifications, emailPaymentAlerts: checked })}
label="Payment & Invoice Notifications"
description="Receive invoices and payment confirmations"
/>
<Toggle
checked={notifications.emailNewOpportunities}
onChange={(checked) => setNotifications({ ...notifications, emailNewOpportunities: checked })}
label="New Sponsorship Opportunities"
description="Get notified about new leagues and drivers seeking sponsors"
/>
<Toggle
checked={notifications.emailContractExpiry}
onChange={(checked) => setNotifications({ ...notifications, emailContractExpiry: checked })}
label="Contract Expiry Reminders"
description="Receive reminders before your sponsorship contracts expire"
/>
</div>
</div>
</Card>
</motion.div>
{/* Privacy & Visibility */}
<Card className="mb-6">
<div className="p-4 border-b border-charcoal-outline">
<h2 className="text-lg font-semibold text-white flex items-center gap-2">
<Eye className="w-5 h-5 text-performance-green" />
Privacy & Visibility
</h2>
</div>
<div className="p-4 space-y-4">
<div className="flex items-center justify-between">
<div>
<p className="text-gray-300">Public Profile</p>
<p className="text-sm text-gray-500">Allow leagues to see your sponsor profile</p>
<motion.div variants={itemVariants}>
<Card className="mb-6 overflow-hidden">
<SectionHeader
icon={Eye}
title="Privacy & Visibility"
description="Control how your profile appears to others"
color="text-performance-green"
/>
<div className="p-6">
<div className="space-y-1">
<Toggle
checked={privacy.publicProfile}
onChange={(checked) => setPrivacy({ ...privacy, publicProfile: checked })}
label="Public Profile"
description="Allow leagues, teams, and drivers to view your sponsor profile"
/>
<Toggle
checked={privacy.showStats}
onChange={(checked) => setPrivacy({ ...privacy, showStats: checked })}
label="Show Sponsorship Statistics"
description="Display your total sponsorships and investment amounts"
/>
<Toggle
checked={privacy.showActiveSponsorships}
onChange={(checked) => setPrivacy({ ...privacy, showActiveSponsorships: checked })}
label="Show Active Sponsorships"
description="Let others see which leagues and teams you currently sponsor"
/>
<Toggle
checked={privacy.allowDirectContact}
onChange={(checked) => setPrivacy({ ...privacy, allowDirectContact: checked })}
label="Allow Direct Contact"
description="Enable leagues and teams to send you sponsorship proposals"
/>
</div>
<Toggle checked={true} onChange={() => {}} label="" />
</div>
<div className="flex items-center justify-between">
<div>
<p className="text-gray-300">Show Sponsorship Stats</p>
<p className="text-sm text-gray-500">Display your total sponsorships and investment on profile</p>
</div>
<Toggle checked={false} onChange={() => {}} label="" />
</div>
</div>
</Card>
</Card>
</motion.div>
{/* Security */}
<Card className="mb-6">
<div className="p-4 border-b border-charcoal-outline">
<h2 className="text-lg font-semibold text-white flex items-center gap-2">
<Shield className="w-5 h-5 text-primary-blue" />
Security
</h2>
</div>
<div className="p-4 space-y-4">
<div className="flex items-center justify-between">
<div>
<p className="text-gray-300">Change Password</p>
<p className="text-sm text-gray-500">Update your account password</p>
<motion.div variants={itemVariants}>
<Card className="mb-6 overflow-hidden">
<SectionHeader
icon={Shield}
title="Account Security"
description="Protect your sponsor account"
color="text-primary-blue"
/>
<div className="p-6 space-y-4">
<div className="flex items-center justify-between py-3 border-b border-charcoal-outline/50">
<div className="flex items-center gap-4">
<div className="p-2 rounded-lg bg-iron-gray">
<Key className="w-5 h-5 text-gray-400" />
</div>
<div>
<p className="text-gray-200 font-medium">Password</p>
<p className="text-sm text-gray-500">Last changed 3 months ago</p>
</div>
</div>
<Button variant="secondary">
Change Password
</Button>
</div>
<Button variant="secondary" className="text-sm">
Change
</Button>
</div>
<div className="flex items-center justify-between">
<div>
<p className="text-gray-300">Two-Factor Authentication</p>
<p className="text-sm text-gray-500">Add an extra layer of security</p>
<div className="flex items-center justify-between py-3 border-b border-charcoal-outline/50">
<div className="flex items-center gap-4">
<div className="p-2 rounded-lg bg-iron-gray">
<Smartphone className="w-5 h-5 text-gray-400" />
</div>
<div>
<p className="text-gray-200 font-medium">Two-Factor Authentication</p>
<p className="text-sm text-gray-500">Add an extra layer of security to your account</p>
</div>
</div>
<Button variant="secondary">
Enable 2FA
</Button>
</div>
<div className="flex items-center justify-between py-3">
<div className="flex items-center gap-4">
<div className="p-2 rounded-lg bg-iron-gray">
<Lock className="w-5 h-5 text-gray-400" />
</div>
<div>
<p className="text-gray-200 font-medium">Active Sessions</p>
<p className="text-sm text-gray-500">Manage devices where you're logged in</p>
</div>
</div>
<Button variant="secondary">
View Sessions
</Button>
</div>
<Button variant="secondary" className="text-sm">
Enable
</Button>
</div>
</div>
</Card>
</Card>
</motion.div>
{/* Danger Zone */}
<Card className="border-racing-red/30">
<div className="p-4 border-b border-racing-red/30">
<h2 className="text-lg font-semibold text-racing-red flex items-center gap-2">
<Trash2 className="w-5 h-5" />
Danger Zone
</h2>
</div>
<div className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-gray-300">Delete Sponsor Account</p>
<p className="text-sm text-gray-500">Permanently delete your account and all sponsorship data</p>
</div>
<Button
variant="secondary"
onClick={handleDeleteAccount}
className="text-sm text-racing-red border-racing-red/30 hover:bg-racing-red/10"
>
Delete Account
</Button>
<motion.div variants={itemVariants}>
<Card className="border-racing-red/30 overflow-hidden">
<div className="p-5 border-b border-racing-red/30 bg-gradient-to-r from-racing-red/10 to-transparent">
<h2 className="text-lg font-semibold text-racing-red flex items-center gap-3">
<div className="p-2 rounded-lg bg-racing-red/10">
<AlertCircle className="w-5 h-5 text-racing-red" />
</div>
Danger Zone
</h2>
</div>
</div>
</Card>
{/* Alpha Notice */}
<div className="mt-6 rounded-lg bg-warning-amber/10 border border-warning-amber/30 p-4">
<p className="text-xs text-gray-400">
<strong className="text-warning-amber">Alpha Note:</strong> Settings are demonstration-only and won't persist.
Full account management will be available when the system is fully implemented.
</p>
</div>
</div>
<div className="p-6">
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="p-2 rounded-lg bg-racing-red/10">
<Trash2 className="w-5 h-5 text-racing-red" />
</div>
<div>
<p className="text-gray-200 font-medium">Delete Sponsor Account</p>
<p className="text-sm text-gray-500">
Permanently delete your account and all associated sponsorship data.
This action cannot be undone.
</p>
</div>
</div>
<Button
variant="secondary"
onClick={handleDeleteAccount}
className="text-racing-red border-racing-red/30 hover:bg-racing-red/10"
>
Delete Account
</Button>
</div>
</div>
</Card>
</motion.div>
</motion.div>
);
}

File diff suppressed because it is too large Load Diff