fix: ensure billing information displays correctly based on available dates

This commit is contained in:
hamster1963
2026-01-02 23:20:52 +08:00
parent ad4455e61d
commit cc0f5c0a2e
+12 -7
View File
@@ -23,6 +23,9 @@ export default function BillingInfo({
cycleLabel: "", cycleLabel: "",
remainingPercentage: 0, remainingPercentage: 0,
}; };
const hasBillingDates =
Boolean(parsedData.billingDataMod.startDate) ||
Boolean(parsedData.billingDataMod.endDate);
if (parsedData?.billingDataMod?.endDate) { if (parsedData?.billingDataMod?.endDate) {
if (parsedData.billingDataMod.endDate.startsWith("0000-00-00")) { if (parsedData.billingDataMod.endDate.startsWith("0000-00-00")) {
@@ -61,13 +64,15 @@ export default function BillingInfo({
{t("billingInfo.usage-baseed")} {t("billingInfo.usage-baseed")}
</p> </p>
) : null} ) : null}
<div className={cn("text-[10px] text-muted-foreground")}> {hasBillingDates && (
{t("billingInfo.remaining")}:{" "} <div className={cn("text-[10px] text-muted-foreground")}>
{isNeverExpire {t("billingInfo.remaining")}:{" "}
? t("billingInfo.indefinite") {isNeverExpire
: `${daysLeftObject.days} ${t("billingInfo.days")}`} ? t("billingInfo.indefinite")
</div> : `${daysLeftObject.days} ${t("billingInfo.days")}`}
{!isNeverExpire && ( </div>
)}
{hasBillingDates && !isNeverExpire && (
<RemainPercentBar <RemainPercentBar
className="mt-0.5" className="mt-0.5"
value={daysLeftObject.remainingPercentage * 100} value={daysLeftObject.remainingPercentage * 100}