import ServerFlag from "@/components/ServerFlag"; import ServerUsageBar from "@/components/ServerUsageBar"; import { cn, formatNezhaInfo } from "@/lib/utils"; import { NezhaAPI } from "@/types/nezha-api"; import { Card } from "./ui/card"; export default function ServerCard({ serverInfo }: { serverInfo: NezhaAPI }) { const { name, country_code, online, cpu, up, down, mem, stg } = formatNezhaInfo(serverInfo); const showFlag = true; return online ? (
{showFlag ? : null}

{name}

{"CPU"}

{cpu.toFixed(2)}%

{"MEM"}

{mem.toFixed(2)}%

{"STG"}

{stg.toFixed(2)}%

{"Upload"}

{up >= 1024 ? `${(up / 1024).toFixed(2)}G/s` : `${up.toFixed(2)}M/s`}

{"Download"}

{down >= 1024 ? `${(down / 1024).toFixed(2)}G/s` : `${down.toFixed(2)}M/s`}
) : (
{showFlag ? : null}

{name}

); }