'use client'; import { useState, useEffect } from 'react'; import { useParams } from 'next/navigation'; import Card from '@/components/ui/Card'; import Button from '@/components/ui/Button'; import { Wallet, DollarSign, ArrowUpRight, ArrowDownLeft, Clock, AlertTriangle, CheckCircle, XCircle, Download, CreditCard, TrendingUp, Calendar } from 'lucide-react'; interface Transaction { id: string; type: 'sponsorship' | 'membership' | 'withdrawal' | 'prize'; description: string; amount: number; fee: number; netAmount: number; date: Date; status: 'completed' | 'pending' | 'failed'; reference?: string; } interface WalletData { balance: number; currency: string; totalRevenue: number; totalFees: number; totalWithdrawals: number; pendingPayouts: number; transactions: Transaction[]; canWithdraw: boolean; withdrawalBlockReason?: string; } // Mock data for demonstration const MOCK_WALLET: WalletData = { balance: 2450.00, currency: 'USD', totalRevenue: 3200.00, totalFees: 320.00, totalWithdrawals: 430.00, pendingPayouts: 150.00, canWithdraw: false, withdrawalBlockReason: 'Season 2 is still active. Withdrawals are available after season completion.', transactions: [ { id: 'txn-1', type: 'sponsorship', description: 'Main Sponsor - TechCorp', amount: 1200.00, fee: 120.00, netAmount: 1080.00, date: new Date('2025-12-01'), status: 'completed', reference: 'SP-2025-001', }, { id: 'txn-2', type: 'sponsorship', description: 'Secondary Sponsor - RaceFuel', amount: 400.00, fee: 40.00, netAmount: 360.00, date: new Date('2025-12-01'), status: 'completed', reference: 'SP-2025-002', }, { id: 'txn-3', type: 'membership', description: 'Season Fee - 32 drivers', amount: 1600.00, fee: 160.00, netAmount: 1440.00, date: new Date('2025-11-15'), status: 'completed', reference: 'MF-2025-032', }, { id: 'txn-4', type: 'withdrawal', description: 'Bank Transfer - Season 1 Payout', amount: -430.00, fee: 0, netAmount: -430.00, date: new Date('2025-10-30'), status: 'completed', reference: 'WD-2025-001', }, { id: 'txn-5', type: 'prize', description: 'Championship Prize Pool (reserved)', amount: -150.00, fee: 0, netAmount: -150.00, date: new Date('2025-12-05'), status: 'pending', reference: 'PZ-2025-001', }, ], }; function TransactionRow({ transaction }: { transaction: Transaction }) { const isIncoming = transaction.amount > 0; const typeIcons = { sponsorship: DollarSign, membership: CreditCard, withdrawal: ArrowUpRight, prize: TrendingUp, }; const TypeIcon = typeIcons[transaction.type]; const statusConfig = { completed: { color: 'text-performance-green', bg: 'bg-performance-green/10', icon: CheckCircle }, pending: { color: 'text-warning-amber', bg: 'bg-warning-amber/10', icon: Clock }, failed: { color: 'text-racing-red', bg: 'bg-racing-red/10', icon: XCircle }, }; const status = statusConfig[transaction.status]; const StatusIcon = status.icon; return (
Manage your league's finances and payouts
{wallet.withdrawalBlockReason}
{filterType === 'all' ? 'Revenue from sponsorships and fees will appear here.' : `No ${filterType} transactions found.`}
Distributed after season completion to top 3 drivers
Available after Season 2 ends (estimated: Jan 15, 2026)
{wallet.withdrawalBlockReason}
Available: ${wallet.balance.toFixed(2)}
Alpha Note: Wallet management is demonstration-only. Real payment processing and bank integrations will be available when the payment system is fully implemented. The 10% platform fee and season-based withdrawal restrictions are enforced in the actual implementation.