fix: Recent Transactions widget ignored the selected dashboard month

RecentTransactionsCard queried transactions without year/month filters,
so it always showed the latest 6 transactions globally instead of the
ones for the month picked in the MonthSelector. DashboardPage now
passes its year/month state down to the card, which forwards it to
useTransactions.
This commit is contained in:
ZProger
2026-08-16 21:51:32 +03:00
parent a8c6728860
commit c905cea84e
3 changed files with 9 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "aurum-frontend", "name": "aurum-frontend",
"private": true, "private": true,
"version": "0.15.2", "version": "0.15.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -5,9 +5,14 @@ import { formatCurrency, formatTransactionDate } from "@/lib/format";
import { useTranslation } from "@/lib/i18n"; import { useTranslation } from "@/lib/i18n";
import { useTransactions } from "@/hooks/useTransactions"; import { useTransactions } from "@/hooks/useTransactions";
export function RecentTransactionsCard() { interface RecentTransactionsCardProps {
year: number;
month: number;
}
export function RecentTransactionsCard({ year, month }: RecentTransactionsCardProps) {
const { t } = useTranslation(); const { t } = useTranslation();
const { data, isLoading } = useTransactions({ page: 1, page_size: 6 }); const { data, isLoading } = useTransactions({ year, month, page: 1, page_size: 6 });
return ( return (
<Card> <Card>

View File

@@ -69,7 +69,7 @@ export function DashboardPage() {
<div className="grid grid-cols-1 gap-4 lg:grid-cols-[1.4fr_1fr]"> <div className="grid grid-cols-1 gap-4 lg:grid-cols-[1.4fr_1fr]">
<SpendingByCategoryCard items={data?.spending_by_category ?? []} /> <SpendingByCategoryCard items={data?.spending_by_category ?? []} />
<RecentTransactionsCard /> <RecentTransactionsCard year={year} month={month} />
</div> </div>
</div> </div>
); );