import * as React from "react"; import { Dialog, DialogTitle, DialogContent, IconButton, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography, Paper, Box, } from "@mui/material"; import CloseIcon from "@mui/icons-material/Close"; interface Transaction { date: string; method: string; amount: number | string; status: string; } interface TransactionHistoryModalProps { open: boolean; onClose: () => void; deposits?: Transaction[]; withdrawals?: Transaction[]; } /** * TransactionHistoryModal * * Props: * - open: boolean * - onClose: () => void * - deposits: Array<{ date: string; method: string; amount: number | string; status: string }> * - withdrawals: Array<{ date: string; method: string; amount: number | string; status: string }> */ export function HistoryModal({ open, onClose, deposits = [], withdrawals = [], }: TransactionHistoryModalProps) { const fmt = (n: number | string): string => typeof n === "number" ? n.toLocaleString(undefined, { style: "currency", currency: "EUR" }) : n; return ( History Last 5 Deposits Date/Time Deposit Method Amount Status {deposits.length === 0 ? ( No deposits yet ) : ( deposits.slice(0, 5).map((row, idx) => ( {row.date} {row.method} {fmt(row.amount)} {row.status} )) )}
Last 5 Withdrawals Date/Time Withdrawal Method Amount Status {withdrawals.length === 0 ? ( No withdrawals yet ) : ( withdrawals.slice(0, 5).map((row, idx) => ( {row.date} {row.method} {fmt(row.amount)} {row.status} )) )}
); } export default function TransactionHistoryModalDemo() { const [open, setOpen] = React.useState(false); const deposits: Transaction[] = [ { date: "2025-08-01 10:10", method: "CC", amount: 120, status: "approved" }, { date: "2025-07-28 14:35", method: "Bank Transfer", amount: 250, status: "approved", }, { date: "2025-07-20 09:05", method: "PayPal", amount: 75, status: "pending", }, { date: "2025-07-11 17:12", method: "CC", amount: 300, status: "rejected" }, { date: "2025-07-01 12:42", method: "CC", amount: 180, status: "approved" }, ]; const withdrawals: Transaction[] = [ { date: "2025-08-02 11:20", method: "Crypto", amount: 95, status: "processing", }, { date: "2025-07-29 16:45", method: "Bank Transfer", amount: 220, status: "approved", }, { date: "2025-07-21 15:10", method: "eWallet", amount: 60, status: "pending", }, { date: "2025-07-12 13:33", method: "Crypto", amount: 120, status: "approved", }, { date: "2025-07-03 08:50", method: "Bank Transfer", amount: 150, status: "rejected", }, ]; return (
setOpen(false)} deposits={deposits} withdrawals={withdrawals} />
); }