import { Banknote, CreditCard, Wallet } from "lucide-react"; import { Bar, BarChart, CartesianGrid, Cell, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts"; import { Grid, Paper, Stack, Text } from "@mantine/core"; import type { IOverviewBillingTab } from "@/types/overview"; import { OverviewDonutChart } from "../OverviewDonutChart"; import { OverviewKpiStrip } from "../OverviewKpiStrip"; import { OverviewPaymentChart } from "../OverviewPaymentChart"; import { overviewChartColors } from "../overview.styles"; function formatCurrency(amount: number, currency: "ETB" | "USD") { return new Intl.NumberFormat("en-US", { style: "currency", currency, maximumFractionDigits: 0, }).format(amount); } const METHOD_LABELS: Record = { telebirr: "Telebirr", "cbe-birr": "CBE Birr", ebirr: "eBirr", }; interface OverviewBillingTabPanelProps { data: IOverviewBillingTab; } export function OverviewBillingTabPanel({ data }: OverviewBillingTabPanelProps) { const methodChartData = data.paymentsByMethod.map((item) => ({ name: METHOD_LABELS[item.method] ?? item.method, count: item.count, })); return ( ({ name: item.currency, value: item.amount, }))} emptyMessage="No revenue this month" /> ({ name: item.status.replace(/-/g, " "), value: item.count, }))} /> Payments by method {methodChartData.length === 0 ? ( No payment methods recorded ) : ( {methodChartData.map((entry, index) => ( ))} )} ); }