Compare commits

...

3 Commits

Author SHA1 Message Date
hamster1963
0c3479bb3b chore: deps 2024-12-24 11:48:57 +08:00
hamster1963
114a6f95eb feat: uptime days unit 2024-12-24 11:48:29 +08:00
hamster1963
682e4ccfe0 feat: offline card link 2024-12-24 11:42:59 +08:00
9 changed files with 55 additions and 42 deletions

View File

@ -104,7 +104,9 @@ export default function ServerDetailClient({ server_id }: { server_id: number })
<p className="text-xs text-muted-foreground">{t("Uptime")}</p>
<div className="text-xs">
{" "}
{(data?.status.Uptime / 86400).toFixed(0)} {t("Days")}{" "}
{data?.status.Uptime / 86400 >= 1
? (data?.status.Uptime / 86400).toFixed(0) + " " + t("Days")
: (data?.status.Uptime / 3600).toFixed(0) + " " + t("Hours")}{" "}
</div>
</section>
</CardContent>

View File

@ -23,7 +23,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
return (
<>
<section className="flex flex-wrap gap-2 mb-4">
{data.asn.autonomous_system_organization && (
{data.asn?.autonomous_system_organization && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
@ -33,7 +33,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
</CardContent>
</Card>
)}
{data.asn.autonomous_system_number && (
{data.asn?.autonomous_system_number && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
@ -43,7 +43,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
</CardContent>
</Card>
)}
{data.city.registered_country?.names.en && (
{data.city?.registered_country?.names.en && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
@ -53,7 +53,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
</CardContent>
</Card>
)}
{data.city.country?.iso_code && (
{data.city?.country?.iso_code && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
@ -63,7 +63,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
</CardContent>
</Card>
)}
{data.city.city?.names.en && (
{data.city?.city?.names.en && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
@ -73,7 +73,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
</CardContent>
</Card>
)}
{data.city.location?.longitude && (
{data.city?.location?.longitude && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
@ -83,7 +83,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
</CardContent>
</Card>
)}
{data.city.location?.latitude && (
{data.city?.location?.latitude && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
@ -93,7 +93,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
</CardContent>
</Card>
)}
{data.city.location?.time_zone && (
{data.city?.location?.time_zone && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
@ -103,7 +103,7 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
</CardContent>
</Card>
)}
{data.city.postal && (
{data.city?.postal && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">

BIN
bun.lockb

Binary file not shown.

View File

@ -130,34 +130,41 @@ export default function ServerCard({ serverInfo }: { serverInfo: NezhaAPISafe })
</Card>
</Link>
) : (
<Card
className={cn(
"flex flex-col items-center justify-start gap-3 p-3 md:px-5",
showNetTransfer ? "lg:min-h-[91px] min-h-[123px]" : "lg:min-h-[61px] min-h-[93px]",
{
"flex-col": fixedTopServerName,
"lg:flex-row": !fixedTopServerName,
},
)}
>
<section
className={cn("grid items-center gap-2", {
"lg:w-40": !fixedTopServerName,
})}
style={{ gridTemplateColumns: "auto auto 1fr" }}
<Link onClick={saveSession} href={`/server/${id}`} prefetch={true}>
<Card
className={cn(
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 cursor-pointer hover:bg-accent/50 transition-colors",
showNetTransfer ? "lg:min-h-[91px] min-h-[123px]" : "lg:min-h-[61px] min-h-[93px]",
{
"flex-col": fixedTopServerName,
"lg:flex-row": !fixedTopServerName,
},
)}
>
<span className="h-2 w-2 shrink-0 rounded-full bg-red-500 self-center"></span>
<div
className={cn("flex items-center justify-center", showFlag ? "min-w-[17px]" : "min-w-0")}
<section
className={cn("grid items-center gap-2", {
"lg:w-40": !fixedTopServerName,
})}
style={{ gridTemplateColumns: "auto auto 1fr" }}
>
{showFlag ? <ServerFlag country_code={country_code} /> : null}
</div>
<div className="relative">
<p className={cn("break-all font-bold tracking-tight", showFlag ? "text-xs" : "text-sm")}>
{name}
</p>
</div>
</section>
</Card>
<span className="h-2 w-2 shrink-0 rounded-full bg-red-500 self-center"></span>
<div
className={cn(
"flex items-center justify-center",
showFlag ? "min-w-[17px]" : "min-w-0",
)}
>
{showFlag ? <ServerFlag country_code={country_code} /> : null}
</div>
<div className="relative">
<p
className={cn("break-all font-bold tracking-tight", showFlag ? "text-xs" : "text-sm")}
>
{name}
</p>
</div>
</section>
</Card>
</Link>
)
}

View File

@ -74,6 +74,7 @@
"Offline": "Offline",
"Uptime": "Uptime",
"Days": "Days",
"Hours": "Hours",
"Version": "Version",
"Arch": "Arch",
"Mem": "Mem",

View File

@ -74,6 +74,7 @@
"Offline": "オフライン",
"Uptime": "稼働時間",
"Days": "日",
"Hours": "時間",
"Version": "バージョン",
"Arch": "アーキテクチャ",
"Mem": "メモリ",

View File

@ -74,6 +74,7 @@
"Offline": "離線",
"Uptime": "稼働時間",
"Days": "天",
"Hours": "小時",
"Version": "版本",
"Arch": "架構",
"Mem": "記憶體",

View File

@ -74,6 +74,7 @@
"Offline": "离线",
"Uptime": "运行时间",
"Days": "天",
"Hours": "小时",
"Version": "版本",
"Arch": "架构",
"Mem": "内存",

View File

@ -1,6 +1,6 @@
{
"name": "nezha-dash",
"version": "1.9.0",
"version": "1.9.1",
"private": true,
"scripts": {
"dev": "next dev -p 3040",
@ -29,7 +29,7 @@
"@turf/turf": "^7.1.0",
"@types/d3-geo": "^3.1.0",
"@types/luxon": "^3.4.2",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.18.2",
"caniuse-lite": "^1.0.30001690",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
@ -54,10 +54,10 @@
"react-wrap-balancer": "^1.1.1",
"recharts": "^2.15.0",
"sharp": "^0.33.5",
"swr": "^2.2.6-beta.5",
"tailwind-merge": "^2.5.5",
"swr": "^2.3.0",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"typescript-eslint": "^8.18.1"
"typescript-eslint": "^8.18.2"
},
"devDependencies": {
"@next/bundle-analyzer": "^15.1.2",