From c7051aeb68a08296c3cca9afdf89853dcd7b1640 Mon Sep 17 00:00:00 2001 From: LTbinglingfeng Date: Fri, 12 Jun 2026 17:38:47 +0800 Subject: [PATCH] feat(quota): enhance quota reset functionality with UI updates and styling improvements --- src/components/quota/QuotaCard.tsx | 34 ++++++++++--------- src/components/quota/QuotaSection.tsx | 4 ++- src/components/quota/quotaConfigs.ts | 16 ++------- .../components/AuthFileQuotaSection.tsx | 12 ++++--- src/pages/AuthFilesPage.module.scss | 14 ++++---- src/pages/QuotaPage.module.scss | 8 ++--- 6 files changed, 41 insertions(+), 47 deletions(-) diff --git a/src/components/quota/QuotaCard.tsx b/src/components/quota/QuotaCard.tsx index c04d4e3..6c1f3f2 100644 --- a/src/components/quota/QuotaCard.tsx +++ b/src/components/quota/QuotaCard.tsx @@ -56,7 +56,6 @@ export function QuotaProgressBar({ export interface QuotaRenderHelpers { styles: typeof styles; QuotaProgressBar: (props: QuotaProgressBarProps) => ReactElement; - resetQuotaAction?: ReactNode; } interface QuotaCardProps { @@ -149,27 +148,30 @@ export function QuotaCard({ })} ) : quota ? ( - renderQuotaItems(quota, t, { styles, QuotaProgressBar, resetQuotaAction }) + renderQuotaItems(quota, t, { styles, QuotaProgressBar }) ) : (
{t(idleMessageKey)}
)} - {onRefresh && quotaStatus !== 'idle' && ( + {(resetQuotaAction || (onRefresh && quotaStatus !== 'idle')) && (
- + {resetQuotaAction} + {onRefresh && quotaStatus !== 'idle' && ( + + )}
)} diff --git a/src/components/quota/QuotaSection.tsx b/src/components/quota/QuotaSection.tsx index 4fc983f..7d3bc4d 100644 --- a/src/components/quota/QuotaSection.tsx +++ b/src/components/quota/QuotaSection.tsx @@ -360,7 +360,9 @@ export function QuotaSection({ const isResettingQuota = resettingQuotaName === item.name; const canUseQuotaAction = !disabled && !item.disabled && itemQuota?.status !== 'loading'; - const resetQuotaAction = config.resetQuota ? ( + const showResetQuotaAction = + itemQuota !== undefined && Boolean(config.canResetQuota?.(itemQuota)); + const resetQuotaAction = config.resetQuota && showResetQuotaAction ? (