Skip to content

fix: correct pluralization of call counts in usage UI#286

Open
maxnoller wants to merge 3 commits intomainfrom
fix/pluralize-usage-copy
Open

fix: correct pluralization of call counts in usage UI#286
maxnoller wants to merge 3 commits intomainfrom
fix/pluralize-usage-copy

Conversation

@maxnoller
Copy link
Copy Markdown
Member

Summary

  • Token counts in the dashboard and models pages were rendered with hardcoded calls regardless of count, producing copy like "1 calls this month" or "across 1 calls".
  • Added a shared pluralize(n, word, plural?) utility to console/src/lib/format.ts and replaced all affected strings.
  • Also converted the inline ternary in the Catalog panel subtitle (${models.length} model${...}) to use the new helper for consistency.

Changes

File What changed
console/src/lib/format.ts Added exported pluralize() helper
console/src/lib/format.test.ts Unit tests for pluralize()
console/src/routes/dashboard.tsx Fixed "across X calls" (daily + monthly) and "X calls this month" in top-models list
console/src/routes/models.tsx Fixed "X calls" in catalog monthly usage, "X calls today" in daily activity panel, and catalog subtitle

Test plan

  • Verify pluralize(1, 'call')"1 call" and pluralize(2, 'call')"2 calls" via vitest unit tests
  • Manually check dashboard Usage rollup panel with a gateway that has exactly 1 API call recorded — should read "across 1 call" and "1 call this month"
  • Confirm normal multi-call counts still read "2 calls", "10 calls", etc.

maxnoller and others added 3 commits April 13, 2026 02:31
Fixes grammar bugs where counts like "1 calls this month" were rendered
instead of "1 call this month". Adds a shared pluralize() utility to
console/src/lib/format.ts and applies it to all call-count strings in
dashboard.tsx and models.tsx. Includes unit tests for the new helper.
channels-catalog.ts had its own local pluralize() with identical
signature and implementation. Now imports from lib/format.ts instead.

Also replaced the vacuous custom-plural test case (which passed a default-
equivalent value) with an irregular plural to actually exercise the branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants