feat: planDataMod support

This commit is contained in:
hamster1963
2024-12-17 11:01:03 +08:00
parent ccaff37022
commit 48414a9543
3 changed files with 215 additions and 39 deletions

View File

@@ -66,16 +66,56 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf
>
{name}
</p>
{parsedData &&
{parsedData?.billingDataMod &&
(daysLeft >= 0 ? (
<p className={cn("text-[10px] text-muted-foreground")}>
: {isNeverExpire ? "永久" : daysLeft + "天"}
</p>
<>
<p className={cn("text-[10px] text-muted-foreground")}>
: {isNeverExpire ? "永久" : daysLeft + "天"}
</p>
{parsedData.billingDataMod.amount !== "0" ? (
<p className={cn("text-[10px] text-muted-foreground")}>
: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle}
</p>
) : (
<p className={cn("text-[10px] text-green-600")}></p>
)}
</>
) : (
<p className={cn("text-[10px] text-muted-foreground text-red-600")}>
: {daysLeft * -1}
</p>
<>
<p className={cn("text-[10px] text-muted-foreground text-red-600")}>
: {daysLeft * -1}
</p>
{parsedData.billingDataMod.amount !== "0" ? (
<p className={cn("text-[10px] text-muted-foreground ")}>
: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle}
</p>
) : (
<p className={cn("text-[10px] text-green-600 ")}></p>
)}
</>
))}
{parsedData?.planDataMod && (
<section className="flex gap-1 items-center flex-wrap mt-0.5">
{parsedData.planDataMod.bandwidth !== "" && (
<p
className={cn(
"text-[9px] bg-purple-600 dark:bg-purple-800 text-purple-200 dark:text-purple-300 w-fit rounded-[5px] px-[3px] py-[1.5px]",
)}
>
{parsedData.planDataMod.bandwidth}
</p>
)}
{parsedData.planDataMod.trafficVol !== "" && (
<p
className={cn(
"text-[9px] bg-green-600 text-green-200 dark:bg-green-800 dark:text-green-300 w-fit rounded-[5px] px-[3px] py-[1.5px]",
)}
>
{parsedData.planDataMod.trafficVol}
</p>
)}
</section>
)}
</div>
</section>
<div className="flex flex-col gap-2">
@@ -152,10 +192,60 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf
>
{showFlag ? <ServerFlag country_code={country_code} /> : null}
</div>
<div className="relative">
<div className="relative flex flex-col">
<p className={cn("break-all font-bold tracking-tight", showFlag ? "text-xs" : "text-sm")}>
{name}
</p>
{parsedData?.billingDataMod &&
(daysLeft >= 0 ? (
<>
<p className={cn("text-[10px] text-muted-foreground")}>
: {isNeverExpire ? "永久" : daysLeft + "天"}
</p>
{parsedData.billingDataMod.amount !== "0" ? (
<p className={cn("text-[10px] text-muted-foreground")}>
: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle}
</p>
) : (
<p className={cn("text-[10px] text-green-600")}></p>
)}
</>
) : (
<>
<p className={cn("text-[10px] text-muted-foreground text-red-600")}>
: {daysLeft * -1}
</p>
{parsedData.billingDataMod.amount !== "0" ? (
<p className={cn("text-[10px] text-muted-foreground ")}>
: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle}
</p>
) : (
<p className={cn("text-[10px] text-green-600 ")}></p>
)}
</>
))}
{parsedData?.planDataMod && (
<section className="flex gap-1 items-center flex-wrap mt-0.5">
{parsedData.planDataMod.bandwidth !== "" && (
<p
className={cn(
"text-[9px] bg-purple-600 dark:bg-purple-800 text-purple-200 dark:text-purple-300 w-fit rounded-[5px] px-[3px] py-[1.5px]",
)}
>
{parsedData.planDataMod.bandwidth}
</p>
)}
{parsedData.planDataMod.trafficVol !== "" && (
<p
className={cn(
"text-[9px] bg-green-600 text-green-200 dark:bg-green-800 dark:text-green-300 w-fit rounded-[5px] px-[3px] py-[1.5px]",
)}
>
{parsedData.planDataMod.trafficVol}
</p>
)}
</section>
)}
</div>
</section>
</Card>