Skip to content

fix(shopping): take the charts' series names from the translations, and test the trend legend's dash - #1670

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/shopping-chart-series-names
Oct 28, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/shopping-chart-series-names

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Follow-ups from #1597: the Shopping charts' series names come from the translations, and a test pins the trend legend's dash.

  • "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 and 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). It expects two legend icons, exactly one of them dashed "4 3", with the names it was given. Without the All cards line's 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 feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

cd web && npx vitest run "src/app/[locale]/(dashboard)/dashboard/shopping/shopping_charts.test.tsx"

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Full checks were run once, in one tree with this batch's ten follow-up branches merged:

  • server format, lint and npm test: 246 files, 3,343 tests passed;
  • web format, lint (0 errors; 7 warnings already on main), typecheck and build: all pass;
  • web vitest: 4,348 of 4,349 tests passed. The editor's page.test.tsx timed out under load; it passed alone (271/271).

A pre-push review was run on all ten branches.

🤖 Generated with Claude Code

…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 gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, seriesOwnCards and seriesAllCards sit in the shopping namespace the page's t reads. 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's name, and the area's and line's, are what the legend and the tooltips show.
  • Tests.
    • shopping_charts.test.tsx passes at the head (2).
    • With the legendType="plainline" on the All cards line taken out, the legend test fails, as the description says.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants