Skip to content

Fix usage display: CNY sidebar snapshot + 2-decimal spend - #147

Merged
yikkuro merged 1 commit into
mainfrom
sunt-microsoft-fix-usage-cny-display
Jul 30, 2026
Merged

Fix usage display: CNY sidebar snapshot + 2-decimal spend#147
yikkuro merged 1 commit into
mainfrom
sunt-microsoft-fix-usage-cny-display

Conversation

@yikkuro

@yikkuro yikkuro commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes two usage-display issues and brings the collapsible usage snapshot into the left SidePanel.

This PR cherry-picks the collapsible usage snapshot from draft PR #145 (commit 22880f1) and rebases it onto the latest main, then adapts it to the CNY infrastructure already on main (from #136). It supersedes/continues draft PR #145. The main-side conflicts (from #142 "Hide Skills UI") were resolved so the change stays scoped to the SidePanel usage snapshot — no Phone/Usage nav items are re-introduced.

Fixes

  • FIX 1 — SidePanel snapshot shows CNY (¥), not USD: loadUsageSnapshot now captures exchangeRate from usage:get-stats (with a 7.2 fallback mirroring SettingsView.vue). The old formatUsd (Intl currency: USD$) is replaced by formatCny, which multiplies by the rate and renders t("settings.currencySymbol") + 2 decimals (e.g. ¥304.92). The DEV mock passes exchangeRate: null so it falls back to 7.2 and never ships enabled in prod.
  • FIX 2 — SettingsView spend uses 2 decimals: total-spend and per-model-spend lines changed from .toFixed(4) to .toFixed(2). Other already-2-decimal figures (budget, etc.) are untouched.

Validation

  • desktop: npx tsc --noEmit → exit 0
  • renderer: npx vue-tsc --noEmit → exit 0
  • renderer: npm run test → 14 files / 199 tests passed
  • renderer: npx vite build → success; confirmed import.meta.env.DEV compiles out (mock not shipped enabled)
  • ESLint on touched files → 0 errors (only pre-existing warnings)
  • desktop npm test skipped — change is renderer-only (no desktop/src edits)

Brings the collapsible usage snapshot from PR #145 (cherry-picked 22880f1)
onto main and adapts it to the CNY infrastructure now on main:

- SidePanel usage snapshot renders spend in CNY (Y) with 2 decimals,
  mirroring SettingsView.vue (exchangeRate from usage:get-stats, 7.2 fallback).
- SettingsView usage page: total + per-model spend now show 2 decimals
  instead of 4.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1fe75171-fea2-45ef-9401-bf8a4ea0f2ba
@yikkuro
yikkuro marked this pull request as ready for review July 30, 2026 07:14
@yikkuro
yikkuro merged commit a9dfccc into main Jul 30, 2026
1 of 2 checks passed
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