"use client";
import type { ReactNode } from "react";
import type { BankAccount, BankTransaction, Resource } from "@/payload-types";
import { LandmarkIcon } from "lucide-react";
import {
Tabs,
TabsList,
TabsTrigger,
TabsContent,
} from "@/components/ui/tabs";
import { AccountCard } from "@/components/frontend/banking/AccountCard";
import { CreateAccountDialog } from "@/components/frontend/banking/CreateAccountDialog";
import { WalletHero } from "@/components/frontend/banking/WalletHero";
import { ActivityFeed } from "@/components/frontend/banking/ActivityFeed";
import { currencyLabel, formatAmount } from "@/lib/banking/format";
interface BankingOverviewProps {
accounts: BankAccount[];
recentTransactions: BankTransaction[];
currentUser: { id: number; username: string; displayName?: string } | null;
currencyResource: Resource | null;
isManager: boolean;
factions: { id: number; name: string }[];
}
function Section({
title,
count,
children,
}: {
title: string;
count: number;
children: ReactNode;
}) {
return (
None.
{title}
{count} account{count !== 1 ? "s" : ""}
UNIT FUNDS {formatAmount(unitFundsTotal, currencyResource)}
)}No accessible accounts.{" "} {!isManager && "Ask logistics personnel to set up the unit treasury."}
) : ( <> {isManager && treasury.length > 0 && (No accounts yet. Create your first account to get started.
)}SYS.BANKING / currency={tickerCurrency(currencyLabel(currencyResource))}