diff --git a/src/components/transactions/TransactionSummaryBar.tsx b/src/components/transactions/TransactionSummaryBar.tsx index 142b3f9..cf20dec 100644 --- a/src/components/transactions/TransactionSummaryBar.tsx +++ b/src/components/transactions/TransactionSummaryBar.tsx @@ -1,14 +1,16 @@ import { useTranslation } from "react-i18next"; -import { Hash, TrendingUp, TrendingDown } from "lucide-react"; +import { Hash, TrendingUp, TrendingDown, Scale } from "lucide-react"; interface TransactionSummaryBarProps { totalCount: number; + totalAmount: number; incomeTotal: number; expenseTotal: number; } export default function TransactionSummaryBar({ totalCount, + totalAmount, incomeTotal, expenseTotal, }: TransactionSummaryBarProps) { @@ -33,12 +35,21 @@ export default function TransactionSummaryBar({ { icon: TrendingDown, label: t("transactions.summary.expenses"), - value: expenseTotal.toLocaleString(undefined, { + value: Math.abs(expenseTotal).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2, }), color: "text-[var(--negative)]", }, + { + icon: Scale, + label: t("transactions.summary.balance"), + value: totalAmount.toLocaleString(undefined, { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }), + color: totalAmount >= 0 ? "text-[var(--positive)]" : "text-[var(--negative)]", + }, ]; return ( diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 6a32fe3..b0dfcb5 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -142,7 +142,8 @@ "summary": { "count": "Transactions", "income": "Income", - "expenses": "Expenses" + "expenses": "Expenses", + "balance": "Balance" }, "table": { "noCategory": "— No category —" diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index 45ed842..630cf81 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -142,7 +142,8 @@ "summary": { "count": "Transactions", "income": "Revenus", - "expenses": "Dépenses" + "expenses": "Dépenses", + "balance": "Solde" }, "table": { "noCategory": "— Sans catégorie —" diff --git a/src/pages/TransactionsPage.tsx b/src/pages/TransactionsPage.tsx index 9a0150f..b63fab4 100644 --- a/src/pages/TransactionsPage.tsx +++ b/src/pages/TransactionsPage.tsx @@ -23,6 +23,7 @@ export default function TransactionsPage() {