mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
style(overview): network
This commit is contained in:
parent
41ccd7eeca
commit
6c99ed6983
@ -3,12 +3,15 @@
|
|||||||
import { ServerApi } from "@/app/types/nezha-api";
|
import { ServerApi } from "@/app/types/nezha-api";
|
||||||
import { Loader } from "@/components/loading/Loader";
|
import { Loader } from "@/components/loading/Loader";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { Separator } from "@/components/ui/separator";
|
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
import { useFilter } from "@/lib/network-filter-context";
|
import { useFilter } from "@/lib/network-filter-context";
|
||||||
import { useStatus } from "@/lib/status-context";
|
import { useStatus } from "@/lib/status-context";
|
||||||
import { cn, formatBytes, nezhaFetcher } from "@/lib/utils";
|
import { cn, formatBytes, nezhaFetcher } from "@/lib/utils";
|
||||||
import blogMan from "@/public/blog-man.webp";
|
import blogMan from "@/public/blog-man.webp";
|
||||||
|
import {
|
||||||
|
ArrowDownCircleIcon,
|
||||||
|
ArrowUpCircleIcon,
|
||||||
|
} from "@heroicons/react/20/solid";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
@ -49,12 +52,9 @@ export default function ServerOverviewClient() {
|
|||||||
setStatus("all");
|
setStatus("all");
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn("cursor-pointer hover:border-blue-500 transition-all", {
|
||||||
"cursor-pointer hover:border-blue-500 transition-all min-h-[94px]",
|
"pointer-events-none": global,
|
||||||
{
|
})}
|
||||||
"pointer-events-none": global,
|
|
||||||
},
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<CardContent className="flex h-full items-center px-6 py-3">
|
<CardContent className="flex h-full items-center px-6 py-3">
|
||||||
<section className="flex flex-col gap-1">
|
<section className="flex flex-col gap-1">
|
||||||
@ -86,7 +86,7 @@ export default function ServerOverviewClient() {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
"cursor-pointer hover:ring-green-500 ring-1 ring-transparent transition-all min-h-[94px]",
|
"cursor-pointer hover:ring-green-500 ring-1 ring-transparent transition-all",
|
||||||
{
|
{
|
||||||
"ring-green-500 ring-2 border-transparent": status === "online",
|
"ring-green-500 ring-2 border-transparent": status === "online",
|
||||||
},
|
},
|
||||||
@ -126,7 +126,7 @@ export default function ServerOverviewClient() {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
"cursor-pointer hover:ring-red-500 ring-1 ring-transparent transition-all min-h-[94px]",
|
"cursor-pointer hover:ring-red-500 ring-1 ring-transparent transition-all",
|
||||||
{
|
{
|
||||||
"ring-red-500 ring-2 border-transparent": status === "offline",
|
"ring-red-500 ring-2 border-transparent": status === "offline",
|
||||||
},
|
},
|
||||||
@ -166,7 +166,7 @@ export default function ServerOverviewClient() {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
"cursor-pointer hover:ring-purple-500 ring-1 ring-transparent transition-all min-h-[94px]",
|
"cursor-pointer hover:ring-purple-500 ring-1 ring-transparent transition-all",
|
||||||
{
|
{
|
||||||
"ring-purple-500 ring-2 border-transparent": filter === true,
|
"ring-purple-500 ring-2 border-transparent": filter === true,
|
||||||
},
|
},
|
||||||
@ -176,35 +176,37 @@ export default function ServerOverviewClient() {
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<CardContent className="flex h-full items-center relative px-3 py-1 pr-0 sm:px-6 sm:py-3">
|
<CardContent className="flex h-full items-center relative px-3 py-1 pr-0 sm:px-6 sm:py-3">
|
||||||
<section className="flex flex-col gap-1">
|
<section className="flex flex-col gap-1 w-full">
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center w-full justify-between">
|
||||||
<p className="text-sm font-medium md:text-base">
|
<p className="text-sm font-medium md:text-base">
|
||||||
{t("p_3463-3530_Totalbandwidth")}
|
{t("network")}
|
||||||
</p>
|
</p>
|
||||||
<Separator orientation="vertical" className="h-4 w-[1px]" />
|
<section className="flex flex-row z-[999] bg-white/80 dark:bg-black/80 backdrop-blur-sm sm:items-center items-start pr-2 sm:pr-0 gap-1 ml-auto">
|
||||||
<p className="text-sm font-medium md:text-base">{t("speed")}</p>
|
<p className="sm:text-[12px] text-[10px] text-nowrap font-medium">
|
||||||
|
↑{formatBytes(data?.total_out_bandwidth || 0)}
|
||||||
|
</p>
|
||||||
|
<p className="sm:text-[12px] text-[10px] text-nowrap font-medium">
|
||||||
|
↓{formatBytes(data?.total_in_bandwidth || 0)}
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
{data?.result ? (
|
{data?.result ? (
|
||||||
<>
|
<>
|
||||||
<section className="flex flex-row sm:items-center items-start gap-1">
|
<section className="flex flex-row mt-1.5 -mr-1 sm:items-center items-start gap-1">
|
||||||
<p className="sm:text-[12px] text-[10px] text-stone-400 text-nowrap font-medium">
|
<p className="sm:text-[12px] flex items-center text-[10px] text-nowrap font-semibold">
|
||||||
↑{formatBytes(data?.total_out_bandwidth)}
|
<ArrowUpCircleIcon className="size-3 mr-0.5 sm:mb-[1.1px]" />
|
||||||
|
{formatBytes(data?.total_out_speed)}/s
|
||||||
</p>
|
</p>
|
||||||
<p className="sm:text-[12px] text-[10px] text-stone-400 text-nowrap font-medium">
|
<p className="sm:text-[12px] flex items-center text-[10px] text-nowrap font-semibold">
|
||||||
↓{formatBytes(data?.total_in_bandwidth)}
|
<ArrowDownCircleIcon className="size-3 mr-0.5" />
|
||||||
</p>
|
{formatBytes(
|
||||||
</section>
|
data?.total_in_speed,
|
||||||
<section className="flex flex-row -mt-1 -mr-1 sm:items-center items-start gap-1">
|
)}/s
|
||||||
<p className="sm:text-[12px] text-[10px] text-nowrap font-semibold">
|
|
||||||
↑{formatBytes(data?.total_out_speed)}/s
|
|
||||||
</p>
|
|
||||||
<p className="sm:text-[12px] text-[10px] text-nowrap font-semibold">
|
|
||||||
↓{formatBytes(data?.total_in_speed)}/s
|
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-7 items-center">
|
<div className="flex h-6 items-center">
|
||||||
<Loader visible={true} />
|
<Loader visible={true} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"p_2532-2599_Offlineservers": "Offline servers",
|
"p_2532-2599_Offlineservers": "Offline servers",
|
||||||
"p_3463-3530_Totalbandwidth": "Total bandwidth",
|
"p_3463-3530_Totalbandwidth": "Total bandwidth",
|
||||||
"speed": "speed",
|
"speed": "speed",
|
||||||
|
"network": "Network",
|
||||||
"error_message": "Please check your environment variables and review the server console",
|
"error_message": "Please check your environment variables and review the server console",
|
||||||
"no_data_message": "No data"
|
"no_data_message": "No data"
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"p_2532-2599_Offlineservers": "オフラインサーバー",
|
"p_2532-2599_Offlineservers": "オフラインサーバー",
|
||||||
"p_3463-3530_Totalbandwidth": "総流量",
|
"p_3463-3530_Totalbandwidth": "総流量",
|
||||||
"speed": "速度",
|
"speed": "速度",
|
||||||
|
"network": "ネットワーク",
|
||||||
"error_message": "環境変数を確認し、サーバーコンソールを確認してください",
|
"error_message": "環境変数を確認し、サーバーコンソールを確認してください",
|
||||||
"no_data_message": "データなし"
|
"no_data_message": "データなし"
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"p_2532-2599_Offlineservers": "離線伺服器",
|
"p_2532-2599_Offlineservers": "離線伺服器",
|
||||||
"p_3463-3530_Totalbandwidth": "總流量",
|
"p_3463-3530_Totalbandwidth": "總流量",
|
||||||
"speed": "速率",
|
"speed": "速率",
|
||||||
|
"network": "網路",
|
||||||
"error_message": "請檢查您的環境變數並檢查伺服器控制台",
|
"error_message": "請檢查您的環境變數並檢查伺服器控制台",
|
||||||
"no_data_message": "無資料"
|
"no_data_message": "無資料"
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"p_2532-2599_Offlineservers": "离线服务器",
|
"p_2532-2599_Offlineservers": "离线服务器",
|
||||||
"p_3463-3530_Totalbandwidth": "总流量",
|
"p_3463-3530_Totalbandwidth": "总流量",
|
||||||
"speed": "速率",
|
"speed": "速率",
|
||||||
|
"network": "网络",
|
||||||
"error_message": "请检查您的环境变量并检查服务器控制台",
|
"error_message": "请检查您的环境变量并检查服务器控制台",
|
||||||
"no_data_message": "无数据"
|
"no_data_message": "无数据"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user