mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
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:
@@ -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",
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user