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
+6 -1
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}
{hasBillingDates && (
<div className={cn("text-[10px] text-muted-foreground")}> <div className={cn("text-[10px] text-muted-foreground")}>
{t("billingInfo.remaining")}:{" "} {t("billingInfo.remaining")}:{" "}
{isNeverExpire {isNeverExpire
? t("billingInfo.indefinite") ? t("billingInfo.indefinite")
: `${daysLeftObject.days} ${t("billingInfo.days")}`} : `${daysLeftObject.days} ${t("billingInfo.days")}`}
</div> </div>
{!isNeverExpire && ( )}
{hasBillingDates && !isNeverExpire && (
<RemainPercentBar <RemainPercentBar
className="mt-0.5" className="mt-0.5"
value={daysLeftObject.remainingPercentage * 100} value={daysLeftObject.remainingPercentage * 100}