mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-05-06 13:58:43 +00:00
fix: ensure billing information displays correctly based on available dates
This commit is contained in:
@@ -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}
|
||||||
|
|||||||
Reference in New Issue
Block a user