Repository navigation
Description
Problem
On the Prompts page → Insights tab, large volumes are abbreviated to k even past a million, which reads badly in two places:
1. The KPI stat cards:
Total Est. AI Volume
~1529k
from 10195k Google searches
~1529k is 1,529,000 — it should read ~1.5M, and 10195k should read ~10.2M.
2. The Prompt Volumes chart axis: the X-axis shows 1000k (right after 750k) instead of 1M.
The formatter divides by 1,000 and always appends k, so it never rolls over to M (or B).
Root cause (from the code)
Several spots hard-code (value / 1000).toFixed(n) + 'k' with no million rollover. In web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx:
- The Total Est. AI Volume stat card:
value={~${(totalAiVol / 1000).toFixed(0)}k}andsub={from ${(totalGoogleVol / 1000).toFixed(0)}k Google searches}. - The average stat card:
~${(totalAiVol / volumes.length / 1000).toFixed(1)}k. VolumePill:value >= 1000 ?~${(value / 1000).toFixed(1)}k: …(so a 1.5M pill renders "~1529.0k").- The volume-cluster row value:
item.volume >= 1000 ?${(item.volume / 1000).toFixed(1)}k: ….
And the Prompt Volumes chart (PlatformVolumeChart) axis tick in _charts.tsx: tickFormatter={(v) => (v >= 1000 ? ${(v / 1000).toFixed(0)}k:${v})} — this is the 1000k on the axis.
A correct formatter already exists inline in prompts/similar-topics/page.tsx:
if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`;
if (value >= 1000) return `${(value / 1000).toFixed(1)}k`;Proposed change
- Extract a single shared compact-number helper (e.g.
formatCompactNumber(value)in a shared util such asweb/src/lib/format.ts) that rollsk → M → B(drop a trailing.0, e.g.1.5M,10.2M,950k,250). - Use it for the Total / average Est. AI Volume cards and the "from … Google searches" subtext,
VolumePill, the volume-cluster value, and the Prompt Volumes chart axis tick — and replace the inlineformatVolumeinsimilar-topics/page.tsxwith the shared helper so there's one source of truth.
Result: ~1.5M / from ~10.2M Google searches on the cards and 1M on the chart axis, instead of ~1529k / 10195k / 1000k.
How to test
- On a brand whose totals exceed 1,000,000,
/dashboard/prompts?tab=insightsshows~1.5M(not~1529k) andfrom ~10.2M Google searches(not10195k). - The Prompt Volumes chart X-axis shows
1M(not1000k) past a million. - Values under a million still read as
k(e.g.~950k), and small values render plainly (e.g.250). VolumePill, the volume clusters, the KPI cards, and the chart axis all use the same abbreviations.
Notes
- Presentation-only; no change to the underlying numbers or the Est. AI Volume calculation.
- Good first issue.
Activity
[-]ux(prompts): volume abbreviations should roll over to M/B, not show "1529k"[/-][+]ux(prompts): volume abbreviations should roll over to M/B — cards show "1529k", chart axis shows "1000k"[/+]Sam-syntax35 commentedon Jul 6, 2026
hi ! @gkhngyk i can work on this.This is a small frontend UX refactoring issue.
plz assign this to me
gkhngyk commentedon Jul 7, 2026
Thanks @Sam-syntax35 — assigned to you! 🎉 The clean approach is a single shared
formatCompactNumber(value)helper (e.g.web/src/lib/format.ts) that rollsk → M → B(drop a trailing.0), then use it for the Total/avg Est. AI Volume cards + the "from … Google searches" subtext,VolumePill, the volume-cluster value, and the Prompt Volumes chart axis tick in_charts.tsx— replacing the inlineformatVolumeinsimilar-topics/page.tsxso there's one source of truth. That fixes both1529k(cards) and1000k(chart axis). Ping here if anything's unclear.gkhngyk commentedon Jul 9, 2026
Closing as already resolved. 🎉
This landed in #370, which extracted a shared
formatCompactNumber(value)intoweb/src/lib/format.tswith properk → M → Brollover (and drops a trailing.0, e.g.1.5M,10.2M,950k,250). It's now wired through all the spots this issue called out:VolumePill/ volume-cluster rows —web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx_charts.tsx(so the axis shows1M, not1000k)similar-topics/page.tsx— the old inlineformatVolumewas replaced with the shared helper, so there's a single source of truthNo
(value / 1000).toFixed(...) + 'k'remnants remain onmain.@Sam-syntax35 — sorry for the overlap, this was already merged before you could pick it up; nothing to do here. Thanks for grabbing it, and appreciate your other work (e.g. #375)! Please feel free to claim any other open
good first issue🙌Sam-syntax35 commentedon Jul 9, 2026
Happy to help.all issues are already solved those which are present and open.......
is their any community for this like discord or on telegram for new updates and contribution?????