Fix date parsing and add time period filters to Analytics dashboard

Co-authored-by: elisiariocouto <818914+elisiariocouto@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-09-13 20:56:57 +00:00
committed by Elisiário Couto
parent b7e4ec4a1b
commit 6bfbed8fb6
5 changed files with 91 additions and 15 deletions

View File

@@ -12,6 +12,7 @@ import apiClient from "../../lib/api";
interface MonthlyTrendsProps {
className?: string;
days?: number;
}
interface MonthlyData {
@@ -31,13 +32,12 @@ interface TooltipProps {
label?: string;
}
export default function MonthlyTrends({ className }: MonthlyTrendsProps) {
// Get transactions for the last 12 months using analytics endpoint
export default function MonthlyTrends({ className, days = 365 }: MonthlyTrendsProps) {
// Get transactions for the specified period using analytics endpoint
const { data: transactions, isLoading } = useQuery({
queryKey: ["transactions", "monthly-trends"],
queryKey: ["transactions", "monthly-trends", days],
queryFn: async () => {
// Get last 365 days of transactions for monthly trends
return await apiClient.getTransactionsForAnalytics(365);
return await apiClient.getTransactionsForAnalytics(days);
},
});