mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
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:
@@ -153,6 +153,11 @@ export default function QuotaTable({
|
||||
const colors = getColorClasses(quota.remaining);
|
||||
const countdown = formatResetTime(quota.resetAt);
|
||||
const resetDisplay = formatResetTimeDisplay(quota.resetAt);
|
||||
// recurring defaults true: a missing flag means the quota
|
||||
// refreshes at resetAt. Bonus/one-shot packs set recurring:false
|
||||
// and their resetAt is a hard expiry, so word it as "expires".
|
||||
const recurring = quota.recurring !== false;
|
||||
const countdownLabel = recurring ? `in ${countdown}` : `expires in ${countdown}`;
|
||||
|
||||
return (
|
||||
<tr
|
||||
@@ -197,13 +202,13 @@ export default function QuotaTable({
|
||||
className={`${resetPrimary} text-text-primary font-medium truncate`}
|
||||
title={resetDisplay || ""}
|
||||
>
|
||||
{countdown !== "-" ? `in ${countdown}` : resetDisplay}
|
||||
{countdown !== "-" ? countdownLabel : resetDisplay}
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-0.5">
|
||||
{countdown !== "-" && (
|
||||
<div className={`${resetPrimary} text-text-primary font-medium`}>
|
||||
in {countdown}
|
||||
{countdownLabel}
|
||||
</div>
|
||||
)}
|
||||
{resetDisplay && (
|
||||
|
||||
Reference in New Issue
Block a user