import { NezhaAPISafe } from "../app/[locale]/types/nezha-api"; import ServerUsageBar from "@/components/ServerUsageBar"; import { Card } from "@/components/ui/card"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { cn, formatNezhaInfo } from "@/lib/utils"; import ServerCardPopover from "./ServerCardPopover"; import getUnicodeFlagIcon from "country-flag-icons/unicode"; import { env } from "next-runtime-env"; export default function ServerCard({ serverInfo, }: { serverInfo: NezhaAPISafe; }) { const { name, country_code, online, cpu, up, down, mem, stg, ...props } = formatNezhaInfo(serverInfo); const showFlag = env("NEXT_PUBLIC_ShowFlag") === "true"; return online ? (
{showFlag ? ( country_code ? ( {getUnicodeFlagIcon(country_code)} ) : ( 🏁 ) ) : null}

{name}

CPU

{cpu.toFixed(2)}%

Mem

{mem.toFixed(2)}%

STG

{stg.toFixed(2)}%

Upload

{up.toFixed(2)} Mb/s

Download

{down.toFixed(2)} Mb/s
) : (
{showFlag ? ( country_code ? ( {getUnicodeFlagIcon(country_code)} ) : ( 🏁 ) ) : null}

{name}

Offline

); }