// ui/src/components/HealthBadge.tsx import React from "react"; import { Badge } from "@/components/ui/badge"; import type { HealthStatus } from "@/types/instance"; import { CheckCircle, Loader2, XCircle, Clock } from "lucide-react"; interface HealthBadgeProps { health?: HealthStatus; } const HealthBadge: React.FC = ({ health }) => { if (!health) { return null; } const getIcon = () => { switch (health.state) { case "ready": return ; case "starting": return ; case "restarting": return ; case "shutting_down": return ; case "stopped": return ; case "failed": return ; } }; const getVariant = () => { switch (health.state) { case "ready": return "default"; case "starting": return "outline"; case "restarting": return "outline"; case "shutting_down": return "outline"; case "stopped": return "secondary"; case "failed": return "destructive"; } }; const getText = () => { switch (health.state) { case "ready": return "Ready"; case "starting": return "Starting"; case "restarting": return "Restarting"; case "shutting_down": return "Shutting Down"; case "stopped": return "Stopped"; case "failed": return "Failed"; } }; return ( {getIcon()} {getText()} ); }; export default HealthBadge;