feat: show carried_over balance from previous months
All checks were successful
CI / ci (push) Successful in 59s

This commit is contained in:
Cosmo
2026-03-01 05:22:58 +00:00
parent bacacb757d
commit bda7265fcb

View File

@@ -37,7 +37,7 @@ export default function FinanceDashboard({ month, year }) {
) )
} }
if (!summary || (summary.total_income === 0 && summary.total_expense === 0)) { if (!summary || (summary.total_income === 0 && summary.total_expense === 0 && (summary.carried_over || 0) === 0)) {
return ( return (
<div className="card p-12 text-center"> <div className="card p-12 text-center">
<span className="text-5xl block mb-4">📊</span> <span className="text-5xl block mb-4">📊</span>
@@ -64,7 +64,12 @@ export default function FinanceDashboard({ month, year }) {
return ( return (
<div className="space-y-6"> <div className="space-y-6">
<div className="card p-6 bg-gradient-to-br from-primary-950 to-primary-800 text-white"> <div className="card p-6 bg-gradient-to-br from-primary-950 to-primary-800 text-white">
<p className="text-sm opacity-70">Баланс за месяц</p> {summary.carried_over !== 0 && (
<p className="text-xs opacity-60 mb-1">
Остаток с прошлого месяца: <span className={summary.carried_over > 0 ? "text-green-300" : "text-red-300"}>{fmt(summary.carried_over)}</span>
</p>
)}
<p className="text-sm opacity-70">Баланс</p>
<p className="text-3xl font-bold mt-1">{fmt(summary.balance)}</p> <p className="text-3xl font-bold mt-1">{fmt(summary.balance)}</p>
<div className="flex gap-6 mt-4"> <div className="flex gap-6 mt-4">
<div> <div>