import type { LucideIcon } from 'lucide-react'; import { NavLink } from 'react-router'; import { Building2, FileText, FileSpreadsheet, LayoutDashboard, Package, PieChart, Plug, Receipt, RefreshCw, Users, Wallet, } from 'lucide-react'; import { INVOICES_SECTIONS, invoicesSectionPath, type InvoicesSectionId } from './shared'; import { AccountSwitcher } from './AccountSwitcher'; import { formatMoney } from './format'; import { useSummary } from './useInvoiceShelfData'; // Left panel of /invoices: the company it is pointed at, which account that is, then the sections. // // Sections are real links so cmd-click, back and reload behave. Counts come from the dashboard totals that // useSummary already holds — no section fetches a count of its own just to render a badge. // // The subtitle is the account switcher rather than the amount outstanding, because with several sets of // books on screen "whose books are these" is the question the header has to answer. Outstanding moved into // the totals at the bottom, where it sits with the rest of the money. const ICONS: Record = { dashboard: LayoutDashboard, invoices: FileText, estimates: FileSpreadsheet, recurring: RefreshCw, payments: Wallet, expenses: Receipt, customers: Users, items: Package, reports: PieChart, settings: Plug, }; const ROW = 'group relative flex items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors'; export const InvoicesNav = () => { const { company, currency, dashboard, isLoading } = useSummary(); const counts: Partial> = { invoices: dashboard?.total_invoice_count, estimates: dashboard?.total_estimate_count, customers: dashboard?.total_customer_count, }; return (
{company?.name ?? (isLoading ? 'Loading…' : 'InvoiceShelf')}
{dashboard && (
)}
); }; const NavRowStat = ({ label, value, strong }: { label: string; value: string; strong?: boolean }) => (
{label} {value}
);