1import type { StatusTone } from "../../components/StatusPill";
2import type { RemoteClientConnectionState } from "../../lib/connection";
3
4export function connectionTone(state: RemoteClientConnectionState): StatusTone {
5 switch (state) {
6 case "connected":
7 return {
8 label: "Connected",
9 pillClassName: "bg-adaptive-emerald-500-a12-a16",
10 textClassName: "text-adaptive-emerald-700-300",
11 };
12 case "reconnecting":
13 return {
14 label: "Reconnecting",
15 pillClassName: "bg-warning",
16 textClassName: "text-warning-foreground",
17 };
18 case "connecting":
19 return {
20 label: "Connecting",
21 pillClassName: "bg-update",
22 textClassName: "text-update-foreground",
23 };
24 case "unsupported":
25 return {
26 label: "Client not supported",
27 pillClassName: "bg-subtle",
28 textClassName: "text-foreground-secondary",
29 };
30 case "error":
31 return {
32 label: "Connection failed",
33 pillClassName: "bg-danger",
34 textClassName: "text-danger-foreground",
35 };
36 case "offline":
37 return {
38 label: "Offline",
39 pillClassName: "bg-danger",
40 textClassName: "text-danger-foreground",
41 };
42 case "available":
43 return {
44 label: "Available",
45 pillClassName: "bg-subtle",
46 textClassName: "text-foreground-secondary",
47 };
48 }
49}