fix(usage): improve DeepSeek credit balance display
Display DeepSeek prepaid balances as credit with currency instead of a 0/total quota bar, and mark balance items as isCreditBalance.
This commit is contained in:
@@ -151,7 +151,10 @@ export default function QuotaTable({
|
||||
<div className="space-y-px">
|
||||
{currentPageRows.map((quota) => {
|
||||
const isUnlimited = quota.unlimited === true;
|
||||
const colors = getColorClasses(quota.remaining);
|
||||
const isCreditBalance = quota.isCreditBalance === true;
|
||||
const colors = isCreditBalance
|
||||
? { text: "text-blue-600 dark:text-blue-400", bg: "bg-blue-500", bgLight: "bg-blue-500/10", emoji: "💰" }
|
||||
: getColorClasses(quota.remaining);
|
||||
const countdown = formatResetTime(quota.resetAt);
|
||||
const resetDisplay = formatResetTimeDisplay(quota.resetAt);
|
||||
// recurring defaults true: a missing flag means the quota
|
||||
@@ -175,7 +178,7 @@ export default function QuotaTable({
|
||||
|
||||
{/* Progress + used/total */}
|
||||
<div className={`min-w-0 flex-1 ${compact ? "space-y-1" : "space-y-1.5"}`}>
|
||||
{!isUnlimited && (
|
||||
{!isUnlimited && !isCreditBalance && (
|
||||
<div className={`${compact ? "h-1" : "h-1.5"} rounded-full overflow-hidden border ${colors.bgLight} ${
|
||||
quota.remaining === 0 ? "border-black/10 dark:border-white/10" : "border-transparent"
|
||||
}`}>
|
||||
@@ -192,15 +195,19 @@ export default function QuotaTable({
|
||||
title={
|
||||
isUnlimited
|
||||
? `${quota.used.toLocaleString()} used · Unlimited`
|
||||
: isCreditBalance
|
||||
? `Credit balance: ${quota.total.toFixed(2)} ${quota.currency || ""}`
|
||||
: `${quota.used.toLocaleString()} / ${quota.total > 0 ? quota.total.toLocaleString() : "∞"}`
|
||||
}
|
||||
>
|
||||
{isUnlimited
|
||||
? `${quota.used.toLocaleString()} used · Unlimited`
|
||||
: isCreditBalance
|
||||
? `Credit: ${quota.total.toFixed(2)} ${quota.currency || ""}`
|
||||
: `${quota.used.toLocaleString()} / ${quota.total > 0 ? quota.total.toLocaleString() : "∞"}`}
|
||||
</span>
|
||||
<span className={`font-medium ${isUnlimited ? "text-green-600 dark:text-green-400" : colors.text} shrink-0`}>
|
||||
{isUnlimited ? "Unlimited" : `${quota.remaining}%`}
|
||||
<span className={`font-medium ${isUnlimited ? "text-green-600 dark:text-green-400" : isCreditBalance ? "text-blue-600 dark:text-blue-400" : colors.text} shrink-0`}>
|
||||
{isUnlimited ? "Unlimited" : isCreditBalance ? "" : `${quota.remaining}%`}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -609,6 +609,8 @@ export function parseQuotaData(provider, data) {
|
||||
total: quota.total || 0,
|
||||
resetAt: quota.resetAt || null,
|
||||
remainingPercentage: quota.remainingPercentage,
|
||||
isCreditBalance: quota.isCreditBalance ?? true,
|
||||
currency: quota.currency || (name.includes("(") ? name.slice(name.indexOf("(") + 1, name.indexOf(")")) : "USD"),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user