"use client"; import { Accordion, ActionIcon, Anchor, Badge, Group, Indicator, Stack, Text } from "@mantine/core"; import { IconEye, IconEyeOff, IconServer } from "@tabler/icons-react"; import type { CoolifyServer } from "@homarr/integrations/types"; import { useScopedI18n } from "@homarr/translation/client"; import actionTargetClasses from "../common/action-target.module.css"; import { getBadgeColor } from "./coolify-utils"; interface ServersSectionProps { servers: CoolifyServer[]; serverResourceCounts: Map; baseUrl: string; isTiny: boolean; showIp: boolean; onToggleIp: () => void; } export function ServersSection({ servers, serverResourceCounts, baseUrl, isTiny, showIp, onToggleIp, }: ServersSectionProps) { const t = useScopedI18n("widget.coolify"); const tCommon = useScopedI18n("common"); const onlineServers = servers.filter((server) => server.is_reachable !== false).length; return ( }> {tCommon("servers")} {onlineServers} / {servers.length} { event.stopPropagation(); onToggleIp(); }} > {showIp ? : } {servers.length > 0 ? ( {servers.map((server) => ( ))} ) : ( {t("empty.servers")} )} ); } interface ServerRowProps { server: CoolifyServer; counts: { apps: number; services: number }; baseUrl: string; isTiny: boolean; showIp: boolean; } function ServerRow({ server, counts, baseUrl, isTiny, showIp }: ServerRowProps) { const t = useScopedI18n("widget.coolify"); const isBuildServer = server.settings?.is_build_server === true; const isOnline = server.is_reachable !== false; const serverUrl = `${baseUrl}/server/${server.uuid}`; return ( {server.name} {isBuildServer ? ( {t("server.buildServer")} ) : ( ({counts.apps} apps / {counts.services} svcs) )} {showIp ? server.ip : "***.***.***.***"} ); }