'use client'; import React, { useState } from 'react'; import { Card } from '@/ui/Card'; import { Button } from '@/ui/Button'; import { TransactionRow } from '@/components/leagues/TransactionRow'; import { LeagueWalletViewModel } from '@/lib/view-models/LeagueWalletViewModel'; import { Wallet, DollarSign, ArrowUpRight, Clock, AlertTriangle, Download, TrendingUp } from 'lucide-react'; interface WalletTemplateProps { data: LeagueWalletViewModel; onWithdraw?: (amount: number) => void; onExport?: () => void; mutationLoading?: boolean; } export function WalletTemplate({ data, onWithdraw, onExport, mutationLoading = false }: WalletTemplateProps) { const [withdrawAmount, setWithdrawAmount] = useState(''); const [showWithdrawModal, setShowWithdrawModal] = useState(false); const [filterType, setFilterType] = useState<'all' | 'sponsorship' | 'membership' | 'withdrawal' | 'prize'>('all'); const filteredTransactions = data.getFilteredTransactions(filterType); const handleWithdrawClick = () => { const amount = parseFloat(withdrawAmount); if (!amount || amount <= 0) return; if (onWithdraw) { onWithdraw(amount); setShowWithdrawModal(false); setWithdrawAmount(''); } }; return (
{/* Header */}

League Wallet

Manage your league's finances and payouts

{/* Withdrawal Warning */} {!data.canWithdraw && data.withdrawalBlockReason && (

Withdrawals Temporarily Unavailable

{data.withdrawalBlockReason}

)} {/* Stats Grid */}
{data.formattedBalance}
Available Balance
{data.formattedTotalRevenue}
Total Revenue
{data.formattedTotalFees}
Platform Fees (10%)
{data.formattedPendingPayouts}
Pending Payouts
{/* Transactions */}

Transaction History

{filteredTransactions.length === 0 ? (

No Transactions

{filterType === 'all' ? 'Revenue from sponsorships and fees will appear here.' : `No ${filterType} transactions found.`}

) : (
{filteredTransactions.map((transaction) => ( ))}
)}
{/* Revenue Breakdown */}

Revenue Breakdown

Sponsorships
$1,600.00
Membership Fees
$1,600.00
Total Gross Revenue $3,200.00
Platform Fee (10%) -$320.00
Net Revenue $2,880.00

Payout Schedule

Season 2 Prize Pool Pending

Distributed after season completion to top 3 drivers

Available for Withdrawal {data.formattedBalance}

Available after Season 2 ends (estimated: Jan 15, 2026)

{/* Withdraw Modal */} {showWithdrawModal && onWithdraw && (

Withdraw Funds

{!data.canWithdraw ? (

{data.withdrawalBlockReason}

) : ( <>
$ setWithdrawAmount(e.target.value)} max={data.balance} className="w-full pl-8 pr-4 py-2 rounded-lg border border-charcoal-outline bg-iron-gray text-white focus:border-primary-blue focus:outline-none" placeholder="0.00" />

Available: {data.formattedBalance}

)}
)} {/* Alpha Notice */}

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.

); }