✨ **fix: Always display token quota tooltip for unlimited tokens**
Provide a consistent UX by ensuring the status column tooltip is shown for all tokens, including those with unlimited quota. Details: • Removed early‐return that skipped tooltip rendering when `record.unlimited_quota` was true. • Refactored tooltip content: – Unlimited quota: shows only “used quota”. – Limited quota: continues to show used, remaining (with percentage) and total. • Leaves existing tag, switch and progress-bar behaviour unchanged. This prevents missing hover information for unlimited tokens and avoids meaningless “remaining / total” figures (e.g. Infinity), improving clarity for administrators.
This commit is contained in:
@@ -124,20 +124,20 @@ const renderStatus = (text, record, manageToken, t) => {
|
||||
</Tag>
|
||||
);
|
||||
|
||||
if (record.unlimited_quota) {
|
||||
return content;
|
||||
}
|
||||
const tooltipContent = record.unlimited_quota ? (
|
||||
<div className='text-xs'>
|
||||
<div>{t('已用额度')}: {renderQuota(used)}</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className='text-xs'>
|
||||
<div>{t('已用额度')}: {renderQuota(used)}</div>
|
||||
<div>{t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)</div>
|
||||
<div>{t('总额度')}: {renderQuota(total)}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
content={
|
||||
<div className='text-xs'>
|
||||
<div>{t('已用额度')}: {renderQuota(used)}</div>
|
||||
<div>{t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)</div>
|
||||
<div>{t('总额度')}: {renderQuota(total)}</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Tooltip content={tooltipContent}>
|
||||
{content}
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user