fix(quota): decouple quota-page idle hint from auth-file refresh copy

This commit is contained in:
Supra4E8C
2026-02-22 16:30:05 +08:00
parent 1a384c3508
commit e1b34e0ae2
6 changed files with 17 additions and 5 deletions
+5 -2
View File
@@ -61,6 +61,7 @@ interface QuotaCardProps<TState extends QuotaStatusState> {
quota?: TState;
resolvedTheme: ResolvedTheme;
i18nPrefix: string;
cardIdleMessageKey?: string;
cardClassName: string;
defaultType: string;
renderQuotaItems: (quota: TState, t: TFunction, helpers: QuotaRenderHelpers) => ReactNode;
@@ -71,6 +72,7 @@ export function QuotaCard<TState extends QuotaStatusState>({
quota,
resolvedTheme,
i18nPrefix,
cardIdleMessageKey,
cardClassName,
defaultType,
renderQuotaItems
@@ -88,6 +90,7 @@ export function QuotaCard<TState extends QuotaStatusState>({
quota?.errorStatus,
quota?.error || t('common.unknown_error')
);
const idleMessageKey = cardIdleMessageKey ?? `${i18nPrefix}.idle`;
const getTypeLabel = (type: string): string => {
const key = `auth_files.filter_${type}`;
@@ -117,7 +120,7 @@ export function QuotaCard<TState extends QuotaStatusState>({
{quotaStatus === 'loading' ? (
<div className={styles.quotaMessage}>{t(`${i18nPrefix}.loading`)}</div>
) : quotaStatus === 'idle' ? (
<div className={styles.quotaMessage}>{t(`${i18nPrefix}.idle`)}</div>
<div className={styles.quotaMessage}>{t(idleMessageKey)}</div>
) : quotaStatus === 'error' ? (
<div className={styles.quotaError}>
{t(`${i18nPrefix}.load_failed`, {
@@ -127,7 +130,7 @@ export function QuotaCard<TState extends QuotaStatusState>({
) : quota ? (
renderQuotaItems(quota, t, { styles, QuotaProgressBar })
) : (
<div className={styles.quotaMessage}>{t(`${i18nPrefix}.idle`)}</div>
<div className={styles.quotaMessage}>{t(idleMessageKey)}</div>
)}
</div>
</div>
+1
View File
@@ -271,6 +271,7 @@ export function QuotaSection<TState extends QuotaStatusState, TData>({
quota={quota[item.name]}
resolvedTheme={resolvedTheme}
i18nPrefix={config.i18nPrefix}
cardIdleMessageKey={config.cardIdleMessageKey}
cardClassName={config.cardClassName}
defaultType={config.type}
renderQuotaItems={config.renderQuotaItems}
+5
View File
@@ -84,6 +84,7 @@ export interface QuotaStore {
export interface QuotaConfig<TState, TData> {
type: QuotaType;
i18nPrefix: string;
cardIdleMessageKey?: string;
filterFn: (file: AuthFileItem) => boolean;
fetchQuota: (file: AuthFileItem, t: TFunction) => Promise<TData>;
storeSelector: (state: QuotaStore) => Record<string, TState>;
@@ -758,6 +759,7 @@ export const CLAUDE_CONFIG: QuotaConfig<
> = {
type: 'claude',
i18nPrefix: 'claude_quota',
cardIdleMessageKey: 'quota_management.card_idle_hint',
filterFn: (file) => isClaudeFile(file) && !isDisabledAuthFile(file),
fetchQuota: fetchClaudeQuota,
storeSelector: (state) => state.claudeQuota,
@@ -784,6 +786,7 @@ export const CLAUDE_CONFIG: QuotaConfig<
export const ANTIGRAVITY_CONFIG: QuotaConfig<AntigravityQuotaState, AntigravityQuotaGroup[]> = {
type: 'antigravity',
i18nPrefix: 'antigravity_quota',
cardIdleMessageKey: 'quota_management.card_idle_hint',
filterFn: (file) => isAntigravityFile(file) && !isDisabledAuthFile(file),
fetchQuota: fetchAntigravityQuota,
storeSelector: (state) => state.antigravityQuota,
@@ -809,6 +812,7 @@ export const CODEX_CONFIG: QuotaConfig<
> = {
type: 'codex',
i18nPrefix: 'codex_quota',
cardIdleMessageKey: 'quota_management.card_idle_hint',
filterFn: (file) => isCodexFile(file) && !isDisabledAuthFile(file),
fetchQuota: fetchCodexQuota,
storeSelector: (state) => state.codexQuota,
@@ -835,6 +839,7 @@ export const CODEX_CONFIG: QuotaConfig<
export const GEMINI_CLI_CONFIG: QuotaConfig<GeminiCliQuotaState, GeminiCliQuotaBucketState[]> = {
type: 'gemini-cli',
i18nPrefix: 'gemini_cli_quota',
cardIdleMessageKey: 'quota_management.card_idle_hint',
filterFn: (file) =>
isGeminiCliFile(file) && !isRuntimeOnlyAuthFile(file) && !isDisabledAuthFile(file),
fetchQuota: fetchGeminiCliQuota,
+2 -1
View File
@@ -1229,7 +1229,8 @@
"title": "Quota Management",
"description": "Monitor OAuth quota status for Antigravity, Codex, and Gemini CLI credentials.",
"refresh_files": "Refresh auth files",
"refresh_files_and_quota": "Refresh files & quota"
"refresh_files_and_quota": "Refresh files & quota",
"card_idle_hint": "Use the top \"Refresh files & quota\" button to fetch the latest quota data."
},
"system_info": {
"title": "Management Center Info",
+2 -1
View File
@@ -1234,7 +1234,8 @@
"title": "Управление квотами",
"description": "Следите за статусом квот OAuth для учётных данных Antigravity, Codex и Gemini CLI.",
"refresh_files": "Обновить файлы авторизации",
"refresh_files_and_quota": "Обновить файлы и квоты"
"refresh_files_and_quota": "Обновить файлы и квоты",
"card_idle_hint": "Используйте кнопку «Обновить файлы и квоты» сверху, чтобы загрузить актуальные данные по квотам."
},
"system_info": {
"title": "Информация о центре управления",
+2 -1
View File
@@ -1229,7 +1229,8 @@
"title": "配额管理",
"description": "集中查看 OAuth 额度与剩余情况",
"refresh_files": "刷新认证文件",
"refresh_files_and_quota": "刷新认证文件&额度"
"refresh_files_and_quota": "刷新认证文件&额度",
"card_idle_hint": "请使用顶部“刷新认证文件&额度”按钮获取最新额度。"
},
"system_info": {
"title": "管理中心信息",