Repository navigation
refactor(prompts): use shared compact number formatter - #370
Conversation
9d0bca4 to
99ff2c0
Compare
gkhngyk
left a comment
There was a problem hiding this comment.
Really nice — the shared formatCompactNumber (k → M → B with the trailing .0 trimmed) is used everywhere including the chart axis, and swapping the duplicated formatVolume in similar-topics for it gives one source of truth. This fixes both 1529k (the cards) and 1000k (the chart axis). I ran typecheck in a worktree — passes. 🎉
One thing before merge: Prettier's failing on two files — web/src/lib/format.ts is missing its trailing newline, and similar-topics/page.tsx has a couple of stray blank lines where formatVolume was removed. Just run yarn format from web/ and commit. Then it's good to go!
gkhngyk
left a comment
There was a problem hiding this comment.
Thanks for the format fix — all four files are Prettier-clean now (format.ts and similar-topics were the two that were failing). The logic is unchanged from the last pass (typecheck passed in a worktree), and formatCompactNumber is used consistently everywhere including the chart axis, replacing the duplicated formatVolume. Fixes both 1529k (cards) and 1000k (chart axis). LGTM! 🎉
Summary
This PR extracts a shared
formatCompactNumber()helper and uses it across the Prompts dashboard.Changes
formatCompactNumber()inweb/src/lib/format.tssimilar-topics/page.tsxResult
1529k→1.5M10195k→10.2M1000k(chart axis) →1MNo changes to the underlying calculations; presentation only.