fix(quota): drop NeuralWatt key-name valueLabel so allowance windows render percent (#3385)

This commit is contained in:
Pablo Gonzalez
2026-09-07 20:26:33 +03:00
committed by GitHub
parent 21011cfe0a
commit cf02d405c6
4 changed files with 19 additions and 25 deletions
@@ -74,7 +74,6 @@ export const fetchQuota = async () => {
const subscription = payload?.subscription ?? null;
const inOverage = Boolean(subscription?.in_overage);
const allowance = payload?.key?.allowance ?? null;
const keyName = payload?.key?.name ?? null;
const creditsRemaining = toNumber(payload?.balance?.credits_remaining_usd);
const windows = {};
@@ -116,19 +115,17 @@ export const fetchQuota = async () => {
: (spent !== null && effectiveLimit !== null && effectiveLimit > 0
? Math.max(0, Math.min(100, (spent / effectiveLimit) * 100))
: null);
// Window title is the localized period label (daily/weekly/monthly); key
// name is attached via valueLabel for identification (wafer precedent).
// Window title is the localized period label (daily/weekly/monthly); the
// usage value stays a percent so the UI's display-mode toggle applies.
const periodKey = (period === 'daily' || period === 'weekly' || period === 'monthly' || period === 'month')
? (period === 'month' ? 'monthly' : period)
: 'billing_cycle';
const labelName = asNonEmptyString(keyName);
const resetAt = toTimestamp(allowance.reset_at);
const windowSeconds = period ? periodToWindowSeconds(period) : null;
windows[periodKey] = toUsageWindow({
usedPercent,
windowSeconds,
resetAt,
...(labelName ? { valueLabel: labelName } : {})
resetAt
});
} else if (creditsRemaining !== null) {
windows.credits_balance = toUsageWindow({