43 lines · 1.2 KB · TypeScript
RawDownload
import type { StatusTone } from "../../components/StatusPill";import type { RemoteClientConnectionState } from "../../lib/connection"; export function connectionTone(state: RemoteClientConnectionState): StatusTone {  switch (state) {    case "connected":      return {        label: "Connected",        pillClassName: "bg-adaptive-emerald-500-a12-a16",        textClassName: "text-adaptive-emerald-700-300",      };    case "reconnecting":      return {        label: "Reconnecting",        pillClassName: "bg-warning",        textClassName: "text-warning-foreground",      };    case "connecting":      return {        label: "Connecting",        pillClassName: "bg-primary/10",        textClassName: "text-foreground-secondary",      };    case "error":      return {        label: "Connection failed",        pillClassName: "bg-danger",        textClassName: "text-danger-foreground",      };    case "offline":      return {        label: "Offline",        pillClassName: "bg-danger",        textClassName: "text-danger-foreground",      };    case "available":      return {        label: "Available",        pillClassName: "bg-subtle",        textClassName: "text-foreground-secondary",      };  }}