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 ? (