fix(panel): clear color indicators for agent status badges

The agent cards rendered active / stopped / offline all in the same grey:
the state-badge color map had no `active` or `offline` entry (both fell to the
grey fallback) and `stopped` was also grey. Give them distinct, legible colors:
active/running → green, offline → grey, stopped/paused → amber (attention, not
alarming), error → red; move idle to blue so grey unambiguously means offline.
Add active/offline/paused icons (Activity / PowerOff / Square).
This commit is contained in:
Renn F
2026-06-21 00:12:51 +02:00
parent 7662804f1c
commit 8fa6104af1
@@ -1,35 +1,54 @@
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { Clock, RefreshCw, Activity, AlertTriangle, Square } from "lucide-react"; import {
Clock,
RefreshCw,
Activity,
AlertTriangle,
Square,
PowerOff,
} from "lucide-react";
// Agent states as returned by backend orchestrator // Agent states as returned by backend orchestrator
type AgentStateString = type AgentStateString =
| "active"
| "idle" | "idle"
| "starting" | "starting"
| "ready" | "ready"
| "running" | "running"
| "waiting_long" | "waiting_long"
| "paused"
| "error" | "error"
| "offline"
| "stopped" | "stopped"
| "terminated"; | "terminated";
// Clear, distinct indicators:
// active / running → green; offline → grey; stopped / paused → amber
// (needs attention, not alarming); error → red.
const stateColors: Record<string, string> = { const stateColors: Record<string, string> = {
idle: "bg-gray-500", active: "bg-green-500",
starting: "bg-yellow-500",
ready: "bg-blue-500",
running: "bg-green-500", running: "bg-green-500",
ready: "bg-blue-500",
starting: "bg-yellow-500",
idle: "bg-blue-400",
stopped: "bg-amber-500",
paused: "bg-amber-500",
waiting_long: "bg-orange-500", waiting_long: "bg-orange-500",
error: "bg-red-500", offline: "bg-gray-500",
stopped: "bg-gray-400",
terminated: "bg-gray-600", terminated: "bg-gray-600",
error: "bg-red-500",
}; };
const stateIcons: Record<string, React.ReactNode> = { const stateIcons: Record<string, React.ReactNode> = {
active: <Activity className="h-4 w-4" />,
idle: <Clock className="h-4 w-4" />, idle: <Clock className="h-4 w-4" />,
starting: <RefreshCw className="h-4 w-4 animate-spin" />, starting: <RefreshCw className="h-4 w-4 animate-spin" />,
ready: <Activity className="h-4 w-4" />, ready: <Activity className="h-4 w-4" />,
running: <Activity className="h-4 w-4" />, running: <Activity className="h-4 w-4" />,
waiting_long: <AlertTriangle className="h-4 w-4" />, waiting_long: <AlertTriangle className="h-4 w-4" />,
paused: <Square className="h-4 w-4" />,
error: <AlertTriangle className="h-4 w-4" />, error: <AlertTriangle className="h-4 w-4" />,
offline: <PowerOff className="h-4 w-4" />,
stopped: <Square className="h-4 w-4" />, stopped: <Square className="h-4 w-4" />,
terminated: <Square className="h-4 w-4" />, terminated: <Square className="h-4 w-4" />,
}; };