mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 09:31:55 +08:00
feat: planDataMod support
This commit is contained in:
parent
ccaff37022
commit
48414a9543
@ -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>
|
||||
{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>
|
||||
<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>
|
||||
|
@ -80,20 +80,56 @@ export default function ServerCardInline({
|
||||
>
|
||||
{name}
|
||||
</p>
|
||||
{parsedData &&
|
||||
{parsedData?.billingDataMod &&
|
||||
(daysLeft >= 0 ? (
|
||||
<p
|
||||
className={cn("text-[10px] text-muted-foreground", {
|
||||
"text-orange-600": daysLeft <= 7 && !isNeverExpire,
|
||||
})}
|
||||
>
|
||||
<>
|
||||
<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>
|
||||
<Separator orientation="vertical" className="h-8 mx-0 ml-2" />
|
||||
@ -190,7 +226,7 @@ export default function ServerCardInline({
|
||||
>
|
||||
{showFlag ? <ServerFlag country_code={country_code} /> : null}
|
||||
</div>
|
||||
<div className="relative">
|
||||
<div className="relative flex flex-col">
|
||||
<p
|
||||
className={cn(
|
||||
"break-all font-bold w-28 tracking-tight",
|
||||
@ -199,6 +235,56 @@ export default function ServerCardInline({
|
||||
>
|
||||
{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>
|
||||
|
@ -127,19 +127,19 @@ interface BillingData {
|
||||
amount: string
|
||||
}
|
||||
|
||||
// interface PlanData {
|
||||
// bandwidth: string;
|
||||
// trafficVol: string;
|
||||
// trafficType: string;
|
||||
// IPv4: string;
|
||||
// IPv6: string;
|
||||
// networkRoute: string;
|
||||
// extra: string;
|
||||
// }
|
||||
interface PlanData {
|
||||
bandwidth: string
|
||||
trafficVol: string
|
||||
trafficType: string
|
||||
IPv4: string
|
||||
IPv6: string
|
||||
networkRoute: string
|
||||
extra: string
|
||||
}
|
||||
|
||||
interface PublicNoteData {
|
||||
billingDataMod: BillingData
|
||||
// planDataMod: PlanData;
|
||||
planDataMod: PlanData
|
||||
}
|
||||
|
||||
export function parsePublicNote(publicNote: string): PublicNoteData | null {
|
||||
@ -156,15 +156,15 @@ export function parsePublicNote(publicNote: string): PublicNoteData | null {
|
||||
cycle: data.billingDataMod.cycle || "",
|
||||
amount: data.billingDataMod.amount || "",
|
||||
},
|
||||
// planDataMod: {
|
||||
// bandwidth: data.planDataMod.bandwidth || "",
|
||||
// trafficVol: data.planDataMod.trafficVol || "",
|
||||
// trafficType: data.planDataMod.trafficType || "",
|
||||
// IPv4: data.planDataMod.IPv4 || "",
|
||||
// IPv6: data.planDataMod.IPv6 || "",
|
||||
// networkRoute: data.planDataMod.networkRoute || "",
|
||||
// extra: data.planDataMod.extra || "",
|
||||
// },
|
||||
planDataMod: {
|
||||
bandwidth: data.planDataMod.bandwidth || "",
|
||||
trafficVol: data.planDataMod.trafficVol || "",
|
||||
trafficType: data.planDataMod.trafficType || "",
|
||||
IPv4: data.planDataMod.IPv4 || "",
|
||||
IPv6: data.planDataMod.IPv6 || "",
|
||||
networkRoute: data.planDataMod.networkRoute || "",
|
||||
extra: data.planDataMod.extra || "",
|
||||
},
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error parsing public note:", error)
|
||||
|
Loading…
x
Reference in New Issue
Block a user