/** * NodeStatusIndicator - displays the connection status of the currently viewed node. * Shows a green/red/yellow dot and optional text based on node state. */ import type { NodeConfig } from "@fusion/core"; export interface NodeStatusIndicatorProps { /** The node to display, or null for local node */ node: NodeConfig | null; /** Whether to show additional details (node name, type, status text) */ showDetails?: boolean; } /** * Get display configuration for a node status */ function getStatusDisplay(status: NodeConfig["status"]): { label: string; dotClass: string; } { switch (status) { case "online": return { label: "Online", dotClass: "node-status-indicator__dot--online" }; case "offline": return { label: "Offline", dotClass: "node-status-indicator__dot--offline" }; case "connecting": return { label: "Connecting", dotClass: "node-status-indicator__dot--connecting" }; case "error": return { label: "Error", dotClass: "node-status-indicator__dot--error" }; default: return { label: "Unknown", dotClass: "node-status-indicator__dot--offline" }; } } /** * Status indicator component for nodes. * Shows connection status with a colored dot and optional details. */ export function NodeStatusIndicator({ node, showDetails = false }: NodeStatusIndicatorProps) { // Local or null node - show "Local" badge if (!node || node.type === "local") { return (