fix(ui): let the dashboard trend's green bar be named the series it draws - #301
Merged
Merged
Conversation
…raws The dashboard card "Consumption & earnings, last 14 days" binds its green bar to the backend `income` series -- the direction whitelist `earn + topup + gift` (`TX_INCOME_TYPES`, src/routes/wallet.rs) -- but labelled that bar `dash.trend.earn` = "共享收益" / "Sharing earnings". On the same screen the `dash.earnings` stat card uses that same name for a different fact: true `earn` only (`month_earn`, SQL `type = 'earn'`). So one screen carries two facts under one name: a user with a top-up sees the green bar at 5000 while the card beside it reads 0. The transactions page already calls this series "收入" / "Income" (`tx.trend.metric.income`), and its own subtitle for the total says "共享分成**等**收益" -- it states that the total is a superset of earnings. Birth order agrees this is drift, not a tradeoff: "收入" dates from #133, and #155 gave the same series a narrower name 22 PRs later, in a commit whose comment claimed the same scope as the transactions page. Fix is a name, not the data: key `dash.trend.earn` -> `dash.trend.income`, values "收入" / "Income". The bar still draws `income`; no series, query or number changed. All three carriers of that series in this card (legend in `index.html`, tooltip in `renderDashTrend`, transactions-page legend) now share one key, whose pack values are identical to the transactions page's. Gate `state_gate::the_dashboard_trend_names_its_series_the_way_the_transactions_trend_names_it` pins four derived rules: the bar reads `income` (not `.earn`), the three carriers are one key, that key's values equal the transactions page's, and the earn-only card keeps its own name and its own `month_earn` supply. The gate is lexical by design -- it proves the declaration, not the pixel; the jsdom probe side is out of scope here.
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
On the dashboard card "近 14 天消耗与收益" / "Consumption & earnings, last 14 days", the green bar is bound to the backend
incomeseries — the direction whitelistearn + topup + gift(TX_INCOME_TYPES,src/routes/wallet.rs) — but it is labelleddash.trend.earn= 「共享收益」/ "Sharing earnings".On the same screen, the
dash.earningsstat card uses that same name for a different fact: trueearnonly (month_earn, SQLtype = 'earn'). So one screen carries two facts under one name. A user who has topped up sees the green bar at 5000 while the card beside it reads 0.The transactions page already calls this series 「收入」/ "Income" (
tx.trend.metric.income), and its own subtitle for the total says 「共享分成等收益」 — it states the total is a superset of earnings.Birth order confirms this is drift, not a tradeoff: 「收入」 dates from #133; #155 gave the same series a narrower name 22 PRs later, in a commit whose comment claimed the same scope as the transactions page.
The fix is the name, not the data. Key
dash.trend.earn→dash.trend.income, values 「收入」/ "Income". The bar still drawsincome; no series, query or number changed. All three carriers of this series in the card (legend inindex.html, tooltip inrenderDashTrend, transactions-page legend) now share one key, whose pack values are identical on both sides.The consumption label is deliberately left alone — it already agrees.
Related Issue
None: no open issue matches this, and it is a small self-contained fix.
Changes
ui/js/i18n.js— key renamed in both packs (ZH 「共享收益」→「收入」, EN "Sharing earnings"→"Income"); key count unchanged.ui/index.html— legenddata-i18n+ its static fallback, and thei18n.js/app.jscache-bust token bumped.ui/js/app.js— tooltipT(...)key; comment corrected to state what the bar actually draws.ui/README.md— contract line: one series, one word (with an honest scope note).src/state_gate.rs— new gatethe_dashboard_trend_names_its_series_the_way_the_transactions_trend_names_it: four derived rules + roster positive control + four mutation teeth + scanner self-test.Tests
cargo testall pass — 396 passed / 0 failed (baseline 392; the gate adds 4).cargo fmt --checkpasses (rc 0).cargo clippy --all-targets -- -D warningspasses (rc 0).A/B teeth proof — the gate was measured against the reverted fix in the same clone (
git apply -Rof the UI diff, then restored):Exactly the two naming rules fail, while
r1(the bar readsincome) andr4(the earn-only card still suppliesmonth_earn) stay true — which is what a naming defect should look like: the data was never wrong, only its name.Checklist
fix/)