feat(dashboard): metric cards display human-readable numbers#3045
Merged
alx-xo merged 3 commits intoMay 27, 2026
Merged
Conversation
Use Intl.NumberFormat compact notation (1.5K, 2.3M, 1.1B) instead of raw toLocaleString across MetricCard and InsightsAgents. Extracts shared formatCompact util; adds "compact" as MetricCard default format variant while preserving "number" as a toLocaleString escape hatch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
🦋 Changeset detectedLatest commit: 01c120a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…2.3M) instead of raw comma-separated values.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
simplesagar
approved these changes
May 27, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
formatCompactutil insrc/lib/format.tsusingIntl.NumberFormat notation: "compact"— produces1.5K,2.3M,1.1B; handles negatives and drops trailing zeros natively"compact"as newMetricCardformat variant; change default from"number"to"compact"so all metric cards abbreviate by default;"number"preserved astoLocaleString()escape hatchformatTokensfromInsightsAgents.tsxin favour of sharedformatCompact; fix cost MetricCard that was incorrectly usingformat="number"→format="currency"Root cause
Metric cards passed large integers directly to
toLocaleString(), producing unreadable values like1,234,567. There was no shared abbreviation utility —InsightsAgents.tsxhad its ownformatTokensusing a manual K/M chain withtoFixed(1), which produced trailing zeros (1.0K) and missed billions.Test plan
1.5Mnot1,500,000)$1.23), not compact42, not42.0)1Knot1.0K)