Add monthly category spending visuals - #532
Conversation
|
Thanks for the inspiration! I've also added charts to the statistics page in my fork. To avoid reinventing the wheel, I opted to use a charting library instead of custom implementations. The current charts are intentionally simple—they give a nice overview without adding much complexity—but I'd love to expand them over time. If you're interested, contributions toward richer statistics and charts would be very welcome! Repo: https://github.com/antonio-ivanovski/spliit-cloud |
…nd location parsing Extracted getLocationFromSearchParams out of expense-form.tsx into src/lib/location.ts, following this codebase's existing convention of keeping pure logic separately testable from the UI (number-input.ts, expense-date-groups.ts, etc.) - it was previously private to a large client component file with no test coverage. Added api.test.ts coverage for spliit-app#420's scheduleDeleteGroup/restoreGroup (including the actual reaper sweep via getGroupExpenses, matching how createRecurringExpenses is exercised) and spliit-app#165's comment CRUD functions - both had zero test coverage despite being real, DB-touching features. Verified all of this for real, not just against the graceful Postgres-unavailable skip path: ran prisma migrate deploy against the actual running spliit-db container (applying all 6 new migrations cleanly on top of existing data), then the full suite against it. That surfaced one more real cross-PR staleness bug: _app.test.ts's stats.get() assertion used .toEqual and didn't know about spliit-app#532's new monthlySpending field, so it failed against real data even though it passed against the gracefully-skipped path. Switched to .toMatchObject, matching the pattern already used one call above for the same reason.
|
@Dustin-ONeil thanks! This is great, I used it in my fork |
|
Hi @Dustin-ONeil, Thanks a lot for your work! The foundations are really good, but I don't think the balance timeline is useful enough as it stands, and that part also has a few bugs:
Another thing, and it applies to the parts we keep as well: the files are really too big. If you're okay with it, for a first version of the analytics let's start with the two first parts — the monthly stacked chart and the category breakdown — and we'll see later whether we need a balance timeline. One last thing: the CI is failing on Prettier, Do you want to make the changes, or should I do them? Thanks again for your PR! |

Summary
Adds lightweight monthly spending visuals to the Stats page:
The charts use existing expense/category data and custom HTML/CSS/SVG rendering. No chart dependency, persisted settings, Prisma fields, or migrations are added.
Details
Testing
pnpm testpnpm run check-typespnpm run lintTransparency note
This is my third request using Codex for this kind of contribution. Happy to iterate to make sure it's up to standards
Reviewer Demo
Screenshots attached here. Any demo group/data should be fake and provided outside the deployed codebase.