import { Link } from "react-router-dom"; import type { StatusResponse } from "@/lib/api"; import { useSidebarStatus } from "@/hooks/useSidebarStatus"; import { cn } from "@/lib/utils"; import { useI18n } from "@/i18n"; /** Gateway + session summary for the System sidebar block (no separate strip chrome). */ export function SidebarStatusStrip() { const status = useSidebarStatus(); const { t } = useI18n(); if (status === null) { return (
); } const gw = gatewayLine(status, t); const { activeSessionsLabel, gatewayStatusLabel } = t.app; return (

{gatewayStatusLabel}{" "} {gw.label}

{activeSessionsLabel}{" "} {status.active_sessions}

); } function gatewayLine( status: StatusResponse, t: ReturnType["t"], ): { label: string; tone: string } { const g = t.app.gatewayStrip; const byState: Record = { running: { label: g.running, tone: "text-success" }, starting: { label: g.starting, tone: "text-warning" }, startup_failed: { label: g.failed, tone: "text-destructive" }, stopped: { label: g.stopped, tone: "text-muted-foreground" }, }; if (status.gateway_state && byState[status.gateway_state]) { return byState[status.gateway_state]; } return status.gateway_running ? { label: g.running, tone: "text-success" } : { label: g.off, tone: "text-muted-foreground" }; }