"use client";
import { useState, type ReactNode } from "react";
import type { BankAccount, BankTransaction, Resource } from "@/payload-types";
import { LandmarkIcon, PlusIcon } from "lucide-react";
import { Tabs, TabsContent, TabsList, TabsTrigger } 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, type CurrencyConfig } from "@/lib/banking/format";
import { CurrencyAmount } from "@/components/frontend/banking/CurrencyAmount";
import { usePageCommands } from "@/components/command-palette/CommandPaletteContext";
interface BankingOverviewProps {
accounts: BankAccount[];
recentTransactions: BankTransaction[];
currentUser: { id: number; username: string; displayName?: string } | null;
currencyResource: Resource | null;
currencyConfig: CurrencyConfig;
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
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(currencyConfig))}