Skip to content

ux(prompts): volume abbreviations should roll over to M/B — cards show "1529k", chart axis shows "1000k" #348

Closed

Description

@gkhngyk

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} and sub={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 as web/src/lib/format.ts) that rolls k → 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 inline formatVolume in similar-topics/page.tsx with 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

  1. On a brand whose totals exceed 1,000,000, /dashboard/prompts?tab=insights shows ~1.5M (not ~1529k) and from ~10.2M Google searches (not 10195k).
  2. The Prompt Volumes chart X-axis shows 1M (not 1000k) past a million.
  3. Values under a million still read as k (e.g. ~950k), and small values render plainly (e.g. 250).
  4. 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

  1. added
    enhancement
    good first issue
    help wanted
    on Jul 6, 2026
  2. changed the title [-]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"[/+] on Jul 6, 2026
  3. Sam-syntax35 commented on Jul 6, 2026

    @Sam-syntax35
    Contributor

    hi ! @gkhngyk i can work on this.This is a small frontend UX refactoring issue.
    plz assign this to me

  4. gkhngyk commented on Jul 7, 2026

    @gkhngyk
    ContributorAuthor

    Thanks @Sam-syntax35 — assigned to you! 🎉 The clean approach is a single shared formatCompactNumber(value) helper (e.g. web/src/lib/format.ts) that rolls k → 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 inline formatVolume in similar-topics/page.tsx so there's one source of truth. That fixes both 1529k (cards) and 1000k (chart axis). Ping here if anything's unclear.

  5. gkhngyk commented on Jul 9, 2026

    @gkhngyk
    ContributorAuthor

    Closing as already resolved. 🎉

    This landed in #370, which extracted a shared formatCompactNumber(value) into web/src/lib/format.ts with proper k → M → B rollover (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:

    • Prompts Insights KPI cards (Total / average Est. AI Volume + the "from … Google searches" subtext) and VolumePill / volume-cluster rows — web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx
    • Prompt Volumes chart axis tick — _charts.tsx (so the axis shows 1M, not 1000k)
    • similar-topics/page.tsx — the old inline formatVolume was replaced with the shared helper, so there's a single source of truth

    No (value / 1000).toFixed(...) + 'k' remnants remain on main.

    @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 🙌

  6. Sam-syntax35 commented on Jul 9, 2026

    @Sam-syntax35
    Contributor

    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?????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions