Repository navigation
fix(shopping): take the charts' series names from the translations, and test the trend legend's dash - #1670
Merged
Conversation
…nd test the trend legend's dash Follow-ups from ansvisor#1597. - "Card rate", "Your cards" and "All cards" were literals in shopping_charts.tsx, shown in the legend and the tooltips. They're now shopping.seriesCardRate / seriesOwnCards / seriesAllCards in en.json, passed in as props from the page's translations like its other labels. - A test draws the trend chart at a fixed width (Recharts renders it in jsdom then) and expects two legend icons, exactly one dashed "4 3", with the names it was given. Without the All cards line's legendType the test fails. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked:
- Own change. One commit (29664c4) on 3f6a4d4. It merges cleanly on main (b591947) and with #1671, #1674 and #1675 (#1671 also edits
en.json, in another section). - The names.
seriesCardRate,seriesOwnCardsandseriesAllCardssit in theshoppingnamespace the page'streads. The two chart views are only used through the page's dynamic imports, and both now take the names as required props, so a caller can't forget them. The bar'sname, and the area's and line's, are what the legend and the tooltips show. - Tests.
shopping_charts.test.tsxpasses at the head (2).- With the
legendType="plainline"on the All cards line taken out, the legend test fails, as the description says.
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-ups from #1597: the Shopping charts' series names come from the translations, and a test pins the trend legend's dash.
shopping_charts.tsx, shown in the legend and the tooltips. They're nowshopping.seriesCardRate,seriesOwnCardsandseriesAllCardsinen.json, passed in as props from the page's translations, like its other labels.legendType, the test fails.Where people see it: the Shopping page's two charts. No visible change. Checked in the browser (local, 1024 px): the legend reads "All cards" (dashed) and "Your cards".
Related issue
Follow-ups from #1597's review.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd web && npx vitest run "src/app/[locale]/(dashboard)/dashboard/shopping/shopping_charts.test.tsx"Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks were run once, in one tree with this batch's ten follow-up branches merged:
npm test: 246 files, 3,343 tests passed;vitest: 4,348 of 4,349 tests passed. The editor'spage.test.tsxtimed out under load; it passed alone (271/271).A pre-push review was run on all ten branches.
🤖 Generated with Claude Code