feat: add initial balance support to accounts, enhancing account management and balance calculations across components
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user