From 3df07a9e52708c8a9037d79d0c484be049509444 Mon Sep 17 00:00:00 2001 From: zyycn Date: Sun, 5 Jul 2026 16:36:24 +0800 Subject: [PATCH] style: refine quota usage display Co-authored-by: Codex --- .../components/AccountQuotaSummaryCell.vue | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/accounts/components/AccountQuotaSummaryCell.vue b/frontend/src/views/accounts/components/AccountQuotaSummaryCell.vue index 668cf8a6c..ef56536cc 100644 --- a/frontend/src/views/accounts/components/AccountQuotaSummaryCell.vue +++ b/frontend/src/views/accounts/components/AccountQuotaSummaryCell.vue @@ -50,10 +50,6 @@ function quotaWindowBarClass(window?: any) { return 'bg-(--cp-success)' } -function quotaWindowUsageText(window?: any) { - return `${windowPercentDisplay(window)}/${windowUsageDisplay(window)}` -} - function windowUsageDisplay(window?: any) { const display = window?.tokenUsageDisplay return typeof display === 'string' && display.trim() ? display : '-' @@ -64,6 +60,19 @@ function windowPercentDisplay(window?: any) { return typeof display === 'string' && display.trim() ? display : '-' } +function quotaWindowPercentTextClass(window?: any) { + if (window?.usedPercent === null || window?.usedPercent === undefined) { + return 'text-(--cp-text-muted)' + } + if (window.usedPercent >= 95) { + return 'text-(--cp-danger-text)' + } + if (window.usedPercent >= 80) { + return 'text-(--cp-warning-text)' + } + return 'text-(--cp-success-text)' +} + function quotaWindowOrder(window?: any) { const seconds = window?.windowSeconds if (quotaWindowMatches(seconds, FIVE_HOUR_WINDOW_SECONDS)) return 0 @@ -86,11 +95,19 @@ function quotaWindowMatches(actual: unknown, expected: number) {
- + {{ window.labelDisplay }} - - {{ quotaWindowUsageText(window) }} + + + {{ windowPercentDisplay(window) }} + + + {{ windowUsageDisplay(window) }} +