import { ExternalLink, Play, RefreshCw, Server, Square, Terminal } from "lucide-react"
import { Link } from "react-router-dom"
import type { ComponentSummary, HealthStatus } from "@/types"
import { useServiceAction } from "@/services/api/hooks"
import { runnerLabel } from "@/lib/labels"
import { HealthBadge } from "./HealthBadge"
import { RoleBadge } from "./RoleBadge"
interface ComponentCardProps {
component: ComponentSummary
health?: HealthStatus
}
export function ComponentCard({ component, health }: ComponentCardProps) {
const hasHttp = component.port != null
const { mutate, isPending } = useServiceAction()
const doAction = (action: string) => {
mutate({ name: component.id, action })
}
const isDown = health?.status === "down"
return (
{component.id}
{health ? (
) : hasHttp ? (
) : null}
{component.description && (
{component.description}
)}
{component.port && (
:{component.port}
)}
{component.runner && (
{runnerLabel(component.runner)}
)}
{component.proxy_path && (
{component.proxy_path}
)}
{component.port && (
Docs
)}
{component.managed && (
{isDown && (
)}
{!isDown && (
)}
)}
)
}