'use client'; import { useState } from 'react'; import { CreditCard, Wallet, ArrowUpRight, History, CheckCircle, Clock, Building2, Smartphone, AlertCircle, ChevronDown } from 'lucide-react'; import { investors, transactions } from '@/data/mockData'; import toast from 'react-hot-toast'; export default function InvestorWithdrawPage() { const investor = investors[0]; // mock logged-in investor const availableBalance = investor.totalEarnings - investor.totalWithdrawn - investor.withdrawalPending; const withdrawHistory = transactions.filter(t => t.investorId === investor.id && t.type === 'withdrawal').sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()); const [amount, setAmount] = useState(''); const [method, setMethod] = useState<'bank' | 'mobile'>('bank'); const [selectedAccount, setSelectedAccount] = useState(''); const handleWithdraw = (e: React.FormEvent) => { e.preventDefault(); const withdrawAmount = Number(amount); if (!withdrawAmount || withdrawAmount <= 0) { toast.error('Please enter a valid amount'); return; } if (withdrawAmount > availableBalance) { toast.error('Insufficient available balance'); return; } if (!selectedAccount) { toast.error('Please select an account to receive funds'); return; } toast.success(`Withdrawal request for ৳${withdrawAmount.toLocaleString()} submitted successfully.`); setAmount(''); }; return (

Withdraw Funds

Request withdrawals to your bank or mobile banking accounts

{/* Balance Overview */}
Available Balance

৳{availableBalance.toLocaleString()}

Ready to withdraw

Total Earnings

৳{investor.totalEarnings.toLocaleString()}

Total Withdrawn

৳{investor.totalWithdrawn.toLocaleString()}

Pending Requests

You currently have ৳{investor.withdrawalPending.toLocaleString()} in pending withdrawals. Processing takes 1-3 business days.

{/* Withdrawal Form */}

Create Withdrawal Request

setAmount(e.target.value)} placeholder="0.00" className="w-full pl-8 pr-4 py-3 border border-slate-200 rounded-xl text-lg font-semibold focus:outline-none focus:border-investor focus:ring-1 focus:ring-investor transition-all" />
setMethod('bank')} className={`p-4 rounded-xl border-2 cursor-pointer transition-all ${method === 'bank' ? 'border-investor bg-investor/5' : 'border-slate-100 bg-white hover:border-slate-200'}`} >

Bank Transfer

1-3 business days

setMethod('mobile')} className={`p-4 rounded-xl border-2 cursor-pointer transition-all ${method === 'mobile' ? 'border-investor bg-investor/5' : 'border-slate-100 bg-white hover:border-slate-200'}`} >

Mobile Banking

Instant transfer

{/* Withdrawal History */}

Recent Withdrawals

{withdrawHistory.length > 0 ? withdrawHistory.map((t) => ( )) : ( )}
Date Ref / Desc Method Amount Status
{t.createdAt}

{t.referenceNumber || 'Withdrawal'}

{t.description}

{t.paymentMethod} ৳{t.amount.toLocaleString()} {t.status === 'completed' && } {t.status === 'pending' && } {t.status}
No withdrawal history found.
); }