Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from hamster1963:main #29

Merged
merged 3 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/(main)/ClientComponents/detail/ServerDetailClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
18 changes: 9 additions & 9 deletions app/(main)/ClientComponents/detail/ServerIPInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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">
Expand Down
Binary file modified bun.lockb
Binary file not shown.
61 changes: 34 additions & 27 deletions components/ServerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
)
}
1 change: 1 addition & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"Offline": "Offline",
"Uptime": "Uptime",
"Days": "Days",
"Hours": "Hours",
"Version": "Version",
"Arch": "Arch",
"Mem": "Mem",
Expand Down
1 change: 1 addition & 0 deletions messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"Offline": "オフライン",
"Uptime": "稼働時間",
"Days": "日",
"Hours": "時間",
"Version": "バージョン",
"Arch": "アーキテクチャ",
"Mem": "メモリ",
Expand Down
1 change: 1 addition & 0 deletions messages/zh-t.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"Offline": "離線",
"Uptime": "稼働時間",
"Days": "天",
"Hours": "小時",
"Version": "版本",
"Arch": "架構",
"Mem": "記憶體",
Expand Down
1 change: 1 addition & 0 deletions messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"Offline": "离线",
"Uptime": "运行时间",
"Days": "天",
"Hours": "小时",
"Version": "版本",
"Arch": "架构",
"Mem": "内存",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nezha-dash",
"version": "1.9.0",
"version": "1.9.1",
"private": true,
"scripts": {
"dev": "next dev -p 3040",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Loading