Open History to see the last commit
1import { SymbolView } from "../../components/AppSymbol";
2import { ActivityIndicator, Pressable } from "react-native";
3
4import { AppText as Text } from "../../components/AppText";
5import { useThemeColor } from "../../lib/useThemeColor";
6import type { WorkspaceState } from "../../state/workspaceModel";
7import { workspaceConnectionStatusLabel } from "./workspace-connection-status";
8
9export function WorkspaceConnectionStatus(props: {
10 readonly state: WorkspaceState;
11 readonly onPress: () => void;
12 readonly variant?: "floating" | "sidebar";
13}) {
14 const iconColor = useThemeColor("--color-icon-muted");
15 const isReconnecting = props.state.connectingEnvironments.length > 0;
16 const variant = props.variant ?? "floating";
17
18 return (
19 <Pressable
20 accessibilityHint="Opens environment settings"
21 accessibilityLabel={workspaceConnectionStatusLabel(props.state)}
22 accessibilityRole="button"
23 onPress={props.onPress}
24 className={
25 variant === "sidebar"
26 ? "mx-3 flex-row items-center gap-2 rounded-xl bg-subtle px-3 py-2.5"
27 : "flex-row items-center gap-2 rounded-full bg-card px-4 py-2.5"
28 }
29 style={
30 variant === "floating"
31 ? {
32 shadowColor: "#000",
33 shadowOffset: { width: 0, height: 10 },
34 shadowOpacity: 0.12,
35 shadowRadius: 24,
36 }
37 : undefined
38 }
39 >
40 {isReconnecting ? (
41 <ActivityIndicator color={iconColor} size="small" />
42 ) : (
43 <SymbolView name="wifi.slash" size={15} tintColor={iconColor} type="monochrome" />
44 )}
45 <Text className="min-w-0 flex-1 text-sm font-t3-bold text-foreground" numberOfLines={1}>
46 {workspaceConnectionStatusLabel(props.state)}
47 </Text>
48 {variant === "sidebar" ? (
49 <SymbolView name="chevron.right" size={11} tintColor={iconColor} type="monochrome" />
50 ) : null}
51 </Pressable>
52 );
53}