From b25b2eacb3bd7c4a82f1b1c12512cff212d28323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouzbeh=E2=80=A0?= <78313022+rqzbeh@users.noreply.github.com> Date: Sun, 23 Aug 2026 07:31:11 +0330 Subject: [PATCH] refactor(dashboard): format custom provider quota keys into title-cased labels (#11188) Validated on the combined batch board + this branch: dashboard-ux-operability green. Unmapped custom quota keys now render as title-cased labels instead of raw snake_case. Conflict with the tip was only stale provider-count docs. Thank you @rqzbeh! --- .../dashboard/usage/components/ProviderLimits/utils.tsx | 2 +- tests/unit/dashboard-ux-operability.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/unit/dashboard-ux-operability.test.ts diff --git a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.tsx b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.tsx index 3af32da285..dc102936d0 100644 --- a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.tsx +++ b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.tsx @@ -98,7 +98,7 @@ export function formatQuotaLabel(name: string) { return `Weekly ${toTitleCaseWords(weeklyModelMatch[1])}`; } - return trimmed; + return toTitleCaseWords(trimmed.replace(/_/g, " ")); } /** diff --git a/tests/unit/dashboard-ux-operability.test.ts b/tests/unit/dashboard-ux-operability.test.ts new file mode 100644 index 0000000000..cd3e3b533a --- /dev/null +++ b/tests/unit/dashboard-ux-operability.test.ts @@ -0,0 +1,9 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { formatQuotaLabel } from "../../src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.tsx"; + +test("formatQuotaLabel formats custom quota keys with proper title-casing", () => { + assert.equal(formatQuotaLabel("session"), "Session"); + assert.equal(formatQuotaLabel("weekly"), "Weekly"); + assert.equal(formatQuotaLabel("custom_quota_limit"), "Custom Quota Limit"); +});