import { ExternalLink, Power, RefreshCw, Server, Terminal } from "lucide-react" import { Link } from "react-router-dom" import type { ServiceSummary, HealthStatus } from "@/types" import { useServiceAction, useSetEnabled } from "@/services/api/hooks" import { launcherLabel, subdomainUrl } from "@/lib/labels" import { HealthBadge } from "./HealthBadge" import { StackBadge } from "./StackBadge" import { KindBadge } from "./KindBadge" interface ServiceCardProps { service: ServiceSummary health?: HealthStatus } export function ServiceCard({ service, health }: ServiceCardProps) { const hasHttp = service.port != null const restart = useServiceAction() const setEnabled = useSetEnabled() const busy = restart.isPending || setEnabled.isPending return (
{service.id} {health ? ( ) : hasHttp ? ( ) : null}
{/* A static (caddy-served) "service" is distinguished from a systemd one. */} {service.kind === "static" && }
{service.description && (

{service.description}

)}
{service.port && ( :{service.port} )} {service.launcher && ( {launcherLabel(service.launcher)} )} {service.subdomain && ( {service.subdomain} )} {service.port && ( Docs )}
{service.managed && (
{service.enabled && ( )}
)}
) }