feat: add initial balance support to accounts, enhancing account management and balance calculations across components

This commit is contained in:
Julien Froidefond
2025-11-30 12:13:02 +01:00
parent c26ba9ddc6
commit 184a073bb1
13 changed files with 117 additions and 30 deletions

View File

@@ -3,13 +3,17 @@
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { TrendingUp, TrendingDown, Wallet, CreditCard } from "lucide-react";
import type { BankingData } from "@/lib/types";
import { getAccountBalance } from "@/lib/account-utils";
interface OverviewCardsProps {
data: BankingData;
}
export function OverviewCards({ data }: OverviewCardsProps) {
const totalBalance = data.accounts.reduce((sum, acc) => sum + acc.balance, 0);
const totalBalance = data.accounts.reduce(
(sum, acc) => sum + getAccountBalance(acc),
0,
);
const thisMonth = new Date();
thisMonth.setDate(1);