Files
nanobot/webui/src/components/remote/HostConnectionStatus.tsx
T
chengyongru 328e933d36 refactor: isolate runtime contracts and enforce import boundaries (#6166)
* test: enforce Python import ownership boundaries

* test: protect client import boundaries and rehome shared UI contracts

* refactor: remove gateway and client dependency inversions

* fix: detect dynamic imports in conditional expressions

* refactor(tools): keep configuration contracts with their owners

* docs: keep design guidance focused on ownership and checks

* fix: preserve default threaded turn delivery
2026-10-13 13:56:28 +08:00

21 lines
1.1 KiB
TypeScript

import { CircleAlert, Loader2 } from "lucide-react";
import { useTranslation } from "react-i18next";
import { cn } from "@/lib/utils";
import type { HostConnectionState } from "./remote-context";
/** Connectivity is independent of which host the user is currently viewing. */
export function HostConnectionStatus({ state, compact = false }: {
state: HostConnectionState;
compact?: boolean;
}) {
const { t } = useTranslation();
const label = t(`connection.${state}`);
return <span role="status" title={compact ? label : undefined} className="inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground">
{state === "connecting" ? <Loader2 aria-hidden className="h-3.5 w-3.5 animate-spin motion-reduce:animate-none" />
: state === "error" ? <CircleAlert aria-hidden className="h-3.5 w-3.5 text-amber-600 dark:text-amber-400" />
: <span aria-hidden className={cn("h-1.5 w-1.5 rounded-full", state === "open" ? "bg-emerald-500" : "bg-muted-foreground/40")} />}
<span className={compact ? "sr-only" : undefined}>{label}</span>
</span>;
}