import { Link, useLocation } from "@tanstack/react-router"; import { CreditCard, Home, List, BarChart3, Bell, TrendingUp, X, } from "lucide-react"; import { useQuery } from "@tanstack/react-query"; import { apiClient } from "../lib/api"; import { formatCurrency } from "../lib/utils"; import { cn } from "../lib/utils"; import type { Account } from "../types/api"; const navigation = [ { name: "Overview", icon: Home, to: "/" }, { name: "Transactions", icon: List, to: "/transactions" }, { name: "Analytics", icon: BarChart3, to: "/analytics" }, { name: "Notifications", icon: Bell, to: "/notifications" }, ]; interface SidebarProps { sidebarOpen: boolean; setSidebarOpen: (open: boolean) => void; } export default function Sidebar({ sidebarOpen, setSidebarOpen }: SidebarProps) { const location = useLocation(); const { data: accounts } = useQuery({ queryKey: ["accounts"], queryFn: apiClient.getAccounts, }); const totalBalance = accounts?.reduce((sum, account) => { const primaryBalance = account.balances?.[0]?.amount || 0; return sum + primaryBalance; }, 0) || 0; return (
setSidebarOpen(false)} className="flex items-center space-x-2 hover:opacity-80 transition-opacity" >

Leggen

{/* Account Summary in Sidebar */}
Total Balance

{formatCurrency(totalBalance)}

{accounts?.length || 0} accounts

); }