'use client';
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import Card from '@/components/ui/Card';
import Button from '@/components/ui/Button';
import {
CreditCard,
DollarSign,
Calendar,
Download,
Plus,
Check,
AlertTriangle,
FileText,
ArrowRight
} from 'lucide-react';
interface PaymentMethod {
id: string;
type: 'card' | 'bank';
last4: string;
brand?: string;
isDefault: boolean;
expiryMonth?: number;
expiryYear?: number;
}
interface Invoice {
id: string;
date: Date;
amount: number;
status: 'paid' | 'pending' | 'failed';
description: string;
}
// Mock data
const MOCK_PAYMENT_METHODS: PaymentMethod[] = [
{
id: 'pm-1',
type: 'card',
last4: '4242',
brand: 'Visa',
isDefault: true,
expiryMonth: 12,
expiryYear: 2027,
},
{
id: 'pm-2',
type: 'card',
last4: '5555',
brand: 'Mastercard',
isDefault: false,
expiryMonth: 6,
expiryYear: 2026,
},
];
const MOCK_INVOICES: Invoice[] = [
{
id: 'inv-1',
date: new Date('2025-11-01'),
amount: 1200,
status: 'paid',
description: 'GT3 Pro Championship - Main Sponsor (Q4 2025)',
},
{
id: 'inv-2',
date: new Date('2025-10-01'),
amount: 400,
status: 'paid',
description: 'Formula Sim Series - Secondary Sponsor (Q4 2025)',
},
{
id: 'inv-3',
date: new Date('2025-12-01'),
amount: 350,
status: 'pending',
description: 'Touring Car Cup - Secondary Sponsor (Q1 2026)',
},
];
function PaymentMethodCard({ method, onSetDefault }: { method: PaymentMethod; onSetDefault: () => void }) {
return (
{method.brand} •••• {method.last4}
{method.isDefault && (
Default
)}
{method.expiryMonth && method.expiryYear && (
Expires {method.expiryMonth}/{method.expiryYear}
)}
{!method.isDefault && (
Set Default
)}
Remove
);
}
function InvoiceRow({ invoice }: { invoice: Invoice }) {
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' },
};
const status = statusConfig[invoice.status];
const StatusIcon = status.icon;
return (
{invoice.description}
{invoice.date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}
${invoice.amount.toLocaleString()}
{invoice.status.charAt(0).toUpperCase() + invoice.status.slice(1)}
PDF
);
}
export default function SponsorBillingPage() {
const router = useRouter();
const [paymentMethods, setPaymentMethods] = useState(MOCK_PAYMENT_METHODS);
const handleSetDefault = (methodId: string) => {
setPaymentMethods(methods =>
methods.map(m => ({ ...m, isDefault: m.id === methodId }))
);
};
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);
return (
{/* Header */}
Billing & Payments
Manage payment methods and view invoices
{/* Summary Cards */}
Total Spent
${totalSpent.toLocaleString()}
${pendingAmount.toLocaleString()}
Next Payment
Dec 15, 2025
{/* Payment Methods */}
Payment Methods
Add Payment Method
{paymentMethods.map((method) => (
handleSetDefault(method.id)}
/>
))}
{/* Billing History */}
Billing History
Export All
{MOCK_INVOICES.map((invoice) => (
))}
{/* Platform Fee Notice */}
Platform Fee
A 10% platform fee is applied to all sponsorship payments. This fee helps maintain the platform,
provide analytics, and ensure quality sponsorship placements.
{/* Alpha Notice */}
Alpha Note: Payment processing is demonstration-only.
Real billing will be available when the payment system is fully implemented.
);
}