import { NezhaAPISafe } from "@/app/types/nezha-api" import ServerFlag from "@/components/ServerFlag" import ServerUsageBar from "@/components/ServerUsageBar" import { Card } from "@/components/ui/card" import getEnv from "@/lib/env-entry" import { GetFontLogoClass, GetOsName, MageMicrosoftWindows } from "@/lib/logo-class" import { cn, formatBytes, formatNezhaInfo } from "@/lib/utils" import { useTranslations } from "next-intl" import Link from "next/link" import { Separator } from "./ui/separator" export default function ServerCardInline({ serverInfo }: { serverInfo: NezhaAPISafe }) { const t = useTranslations("ServerCard") const { id, name, country_code, online, cpu, up, down, mem, stg, host } = formatNezhaInfo(serverInfo) const showFlag = getEnv("NEXT_PUBLIC_ShowFlag") === "true" const saveSession = () => { sessionStorage.setItem("fromMainPage", "true") } return online ? ( {showFlag ? : null} {name} {host.Platform.includes("Windows") ? ( ) : ( )} {t("System")} {host.Platform.includes("Windows") ? "Windows" : GetOsName(host.Platform)} {t("Uptime")} {(serverInfo?.status.Uptime / 86400).toFixed(0)} {"Days"} {t("CPU")} {cpu.toFixed(2)}% {t("Mem")} {mem.toFixed(2)}% {t("STG")} {stg.toFixed(2)}% {t("Upload")} {up >= 1024 ? `${(up / 1024).toFixed(2)}G/s` : `${up.toFixed(2)}M/s`} {t("Download")} {down >= 1024 ? `${(down / 1024).toFixed(2)}G/s` : `${down.toFixed(2)}M/s`} {t("TotalUpload")} {formatBytes(serverInfo.status.NetOutTransfer)} {t("TotalDownload")} {formatBytes(serverInfo.status.NetInTransfer)} ) : ( {showFlag ? : null} {name} ) }
{name}
{t("System")}
{t("Uptime")}
{t("CPU")}
{t("Mem")}
{t("STG")}
{t("Upload")}
{t("Download")}
{t("TotalUpload")}
{t("TotalDownload")}