fix(codebuddy-cn): show bonus packs as one-time, not monthly-replenishing

CodeBuddy CN bonus packs ("Bonus Pack N") are one-shot credits whose
CycleEndTime equals DeductionEndTime — they expire for good and never
replenish. The dashboard rendered their resetAt as "Reset in Xd",
implying a monthly refill.

Tag bonus packs recurring:false (refill packs recurring:true) in the
usage handler, forward the flag through parseQuotaData, and word the
quota table / progress bar as "Expires in" / "Expires at" for
one-shot packs.
This commit is contained in:
whale9820
2026-06-29 15:22:47 +07:00
committed by decolua
parent eff81b1242
commit 95bfc64f06
7 changed files with 73 additions and 6 deletions
@@ -69,12 +69,17 @@ export default function QuotaProgressBar({
used = 0,
total = 0,
unlimited = false,
resetTime = null
resetTime = null,
recurring = true,
}) {
const colors = getColorClasses(percentage);
const countdown = formatResetTime(resetTime);
const resetDisplay = formatResetTimeDisplay(resetTime);
// recurring defaults true. One-shot packs (e.g. CodeBuddy CN bonus packs)
// set recurring:false: resetTime is a hard expiry, so word it as "expires".
const resetWord = recurring ? "Reset" : "Expires";
// percentage is already remaining percentage (from ProviderLimitCard)
const remaining = percentage;
@@ -111,7 +116,7 @@ export default function QuotaProgressBar({
{countdown !== "-" && (
<div className="flex items-center gap-1">
<span>•</span>
<span className="font-medium">Reset in {countdown}</span>
<span className="font-medium">{resetWord} in {countdown}</span>
</div>
)}
</div>
@@ -119,7 +124,7 @@ export default function QuotaProgressBar({
{/* Reset time display */}
{resetDisplay && (
<div className="text-xs text-text-muted/70">
Reset at {resetDisplay}
{resetWord} at {resetDisplay}
</div>
)}
</div>