fix(desktop): improve usage summary readability - #4484
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
The CSS half is clean — .settingsMetricCard is styled only in usage.css:210 and MetricCard is used only on this page, so dropping justify-content: center can't reach anything else.
Two things on the number formatting.
The locale is hardcoded. new Intl.NumberFormat('en-US', …) is a module constant, so a user on the Chinese UI sees 12.6M rather than the grouping their locale uses. The repo already has the shape for this — session-inspector-panel.tsx:522:
const formatter = new Intl.NumberFormat(uiLocaleToIntlLocale(locale));Reaching for uiLocaleToIntlLocale(useUiLocale()) here keeps one authority for what locale numbers render in, and it's the file right next door that already knows the answer.
The exact number becomes unreachable. 12,647,391 renders as 12.6M, and MetricCard takes {title, value, detail} with no tooltip, so there's nowhere left in the UI to read the precise total. On a page whose neighbouring card is cost, that's worth deciding rather than defaulting: either a title attribute carrying the full number, or a note that the details tab is where exact figures live.
Neither is a large change and the layout fix is worth having.
liuxiaocs7
left a comment
There was a problem hiding this comment.
Looks good overall. The implementation matches the stated scope: metric values are top-aligned, and large token totals and cache breakdowns use readable compact notation. The documented examples render correctly, and CI is green.
Non-blocking follow-up: please consider adding focused regression coverage for compact-formatting boundaries (for example, 999, 1K, and 12.6M) and the rendered Usage summary output, in line with the renderer contract-testing guidance.
Signed-off-by: Jiawei Zhao <Phoenix500526@163.com> Generated-by: OpenAI Codex
Signed-off-by: Jiawei Zhao <Phoenix500526@163.com> Generated-by: OpenAI Codex
Reuse one locale-independent formatter so usage and context readouts keep the same K/M/B/T rounding boundaries. Signed-off-by: Jiawei Zhao <Phoenix500526@163.com> Generated-by: OpenAI Codex
966b97b to
90708ee
Compare
Compact summaries stay readable while token breakdowns remain available on hover and keyboard focus. Signed-off-by: Jiawei Zhao <Phoenix500526@163.com> Generated-by: OpenAI Codex
90708ee to
6a7db40
Compare
|
Hi @Astro-Han thank you for your review comments.
I think we're on the same page that choosing locale-invariant K/M over FYI: #3983 (review)
|
Hi, @liuxiaocs7 Thanks for the comment. I extracted a shared formatter for this and add some test cases to cover it. |

Summary
KandMsuffixesVerification
npm run lintnpm run format:checknpm --workspace @maka/ui run buildnpm --workspace @maka/desktop run typechecknpm --workspace @maka/desktop run build:renderer12.6Mand371.8KBefore
After
AI use
Select exactly one:
Tool(s) and scope: OpenAI Codex diagnosed the layout and number-formatting issues, implemented the scoped renderer changes, and ran verification.
Checklist
Does this PR entail a change in behavior?