From 2534578eae69ba7b87db8cc1bec7219814fd640a Mon Sep 17 00:00:00 2001 From: Supra4E8C Date: Sat, 28 Mar 2026 02:05:31 +0800 Subject: [PATCH] fix(quota): use three-color thresholds for quota change indicators --- src/components/quota/quotaConfigs.ts | 32 +++++++++++++++++++++++----- src/pages/AuthFilesPage.module.scss | 2 +- src/pages/QuotaPage.module.scss | 2 +- src/styles/themes.scss | 3 +++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/components/quota/quotaConfigs.ts b/src/components/quota/quotaConfigs.ts index 8a51a08..368c5c1 100644 --- a/src/components/quota/quotaConfigs.ts +++ b/src/components/quota/quotaConfigs.ts @@ -84,6 +84,8 @@ type QuotaUpdater = T | ((prev: T) => T); type QuotaType = 'antigravity' | 'claude' | 'codex' | 'gemini-cli' | 'kimi'; const DEFAULT_ANTIGRAVITY_PROJECT_ID = 'bamboo-precept-lgxtn'; +const QUOTA_PROGRESS_HIGH_THRESHOLD = 70; +const QUOTA_PROGRESS_MEDIUM_THRESHOLD = 30; const geminiCliSupplementaryRequestIds = new Map(); const geminiCliSupplementaryCache = new Map< string, @@ -721,7 +723,11 @@ const renderAntigravityItems = ( h('span', { className: styleMap.quotaReset }, resetLabel) ) ), - h(QuotaProgressBar, { percent, highThreshold: 60, mediumThreshold: 20 }) + h(QuotaProgressBar, { + percent, + highThreshold: QUOTA_PROGRESS_HIGH_THRESHOLD, + mediumThreshold: QUOTA_PROGRESS_MEDIUM_THRESHOLD, + }) ); }); }; @@ -795,7 +801,11 @@ const renderCodexItems = ( h('span', { className: styleMap.quotaReset }, window.resetLabel) ) ), - h(QuotaProgressBar, { percent: remaining, highThreshold: 80, mediumThreshold: 50 }) + h(QuotaProgressBar, { + percent: remaining, + highThreshold: QUOTA_PROGRESS_HIGH_THRESHOLD, + mediumThreshold: QUOTA_PROGRESS_MEDIUM_THRESHOLD, + }) ); }) ); @@ -886,7 +896,11 @@ const renderGeminiCliItems = ( h('span', { className: styleMap.quotaReset }, resetLabel) ) ), - h(QuotaProgressBar, { percent, highThreshold: 60, mediumThreshold: 20 }) + h(QuotaProgressBar, { + percent, + highThreshold: QUOTA_PROGRESS_HIGH_THRESHOLD, + mediumThreshold: QUOTA_PROGRESS_MEDIUM_THRESHOLD, + }) ); }) ); @@ -1078,7 +1092,11 @@ const renderClaudeItems = ( h('span', { className: styleMap.quotaReset }, window.resetLabel) ) ), - h(QuotaProgressBar, { percent: remaining, highThreshold: 80, mediumThreshold: 50 }) + h(QuotaProgressBar, { + percent: remaining, + highThreshold: QUOTA_PROGRESS_HIGH_THRESHOLD, + mediumThreshold: QUOTA_PROGRESS_MEDIUM_THRESHOLD, + }) ); }) ); @@ -1293,7 +1311,11 @@ const renderKimiItems = ( : null ) ), - h(QuotaProgressBar, { percent: remaining, highThreshold: 60, mediumThreshold: 20 }) + h(QuotaProgressBar, { + percent: remaining, + highThreshold: QUOTA_PROGRESS_HIGH_THRESHOLD, + mediumThreshold: QUOTA_PROGRESS_MEDIUM_THRESHOLD, + }) ); }); }; diff --git a/src/pages/AuthFilesPage.module.scss b/src/pages/AuthFilesPage.module.scss index dae4951..a3c28be 100644 --- a/src/pages/AuthFilesPage.module.scss +++ b/src/pages/AuthFilesPage.module.scss @@ -541,7 +541,7 @@ } .quotaBarFillMedium { - background-color: var(--warning-color); + background-color: var(--quota-medium-color, #e0aa14); } .quotaBarFillLow { diff --git a/src/pages/QuotaPage.module.scss b/src/pages/QuotaPage.module.scss index dba0f97..316ee2b 100644 --- a/src/pages/QuotaPage.module.scss +++ b/src/pages/QuotaPage.module.scss @@ -243,7 +243,7 @@ } .quotaBarFillMedium { - background-color: var(--warning-color); + background-color: var(--quota-medium-color, #e0aa14); } .quotaBarFillLow { diff --git a/src/styles/themes.scss b/src/styles/themes.scss index 774c84e..6ccb2ae 100644 --- a/src/styles/themes.scss +++ b/src/styles/themes.scss @@ -32,6 +32,7 @@ --primary-contrast: #ffffff; --success-color: #10b981; + --quota-medium-color: #e0aa14; --warning-color: #c65746; // 错误/警告色 --error-color: #c65746; --danger-color: var(--error-color); @@ -88,6 +89,7 @@ --primary-contrast: #ffffff; --success-color: #10b981; + --quota-medium-color: #e0aa14; --warning-color: #c65746; --error-color: #c65746; --danger-color: var(--error-color); @@ -145,6 +147,7 @@ --primary-contrast: #ffffff; --success-color: #10b981; + --quota-medium-color: #ffd862; --warning-color: #c65746; --error-color: #c65746; --danger-color: var(--error-color);