feat: new Cartes dashboard report — KPI cards, sparklines, top movers (#97) #99
No reviewers
Labels
No labels
source:analyste
source:defenseur
source:human
source:medic
status:approved
status:blocked
status:in-progress
status:needs-fix
status:ready
status:review
status:triage
type:bug
type:feature
type:infra
type:refactor
type:schema
type:security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: maximus/Simpl-Resultat#99
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-97-cartes-page"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
New
/reports/cartessub-report — a dashboard-style snapshot of the reference month. Composes four KPI cards, an overlay chart, top movers, budget adherence, and a seasonality card into a single screen.Widgets
ComposedChartwith grouped bars for income/expenses and an overlaid line for the net balance. Recharts + Tailwind tokens, dark-mode ready./reports/category?cat=<id>.N/M categories on target, a breakdown sentence, and the 3 worst overruns with signed-percentage and a progress bar.Service
All widgets are hydrated from a single
getCartesSnapshot(referenceYear, referenceMonth)call that runs four queries in parallel (Promise.all):getCompareMonthOverMonthfor top moversgetBudgetVsActualDatafor budget adherenceMissing months are filled with zeros in the sparklines so the chart stays continuous, but the MoM/YoY deltas remain
nullwhen the comparison month has no data — the UI can distinguish "no data" from "zero spend".Hook & page
useCartes()is a standard reducer-based hook with{ year, month, snapshot, isLoading, error }and asetReferencePeriod(year, month)setter. It stays in sync withuseReportsPeriodso the URL PeriodSelector and the in-page dropdown can both move the reference month.ReportsCartesPagelays out the sections responsively (sm:grid-cols-2 xl:grid-cols-4for KPI cards,lg:grid-cols-2for movers / budget / seasonality).i18n
All copy in FR + EN under
reports.cartes.*plus a new hub entryreports.hub.cartes/cartesDescription.⚠️ Note on
CompareReferenceMonthPicker.tsxThis file is a temporary duplicate — the canonical copy lives on the
issue-96-compare-refactorbranch (PR #98). Both copies are byte-identical. Once either PR merges first, the other will see the file already present with the same content and no conflict. I kept the local copy so this branch builds cleanly onmainwithout depending on #98. Feel free to drop it during review of the second-to-merge PR if you prefer.Test plan
npm run build— green (tsc + vite), 2541 modulesnpm test— 78/78 vitest cases passing (16 new: 13 inreportService.cartes.test.ts+ 3 inuseCartes.test.ts)shiftMonth+defaultCartesReferencePeriod) covered across year boundariesDependencies
Can be merged before or after #98 (
refactor: compare report) — the only shared touchpoints aresrc/services/reportService.tsandsrc/i18n/locales/*.json, with no semantic conflicts. See the note above aboutCompareReferenceMonthPicker.tsx.Closes #97
31765e6d17to4c58b8bab8