Open History to see the last commit
1import { T, useGT } from "gt-react-native";
2import { SymbolView } from "../../components/ui/AppSymbol";
3import { Platform, Pressable, View } from "react-native";
4
5import { AppText as Text } from "../../components/ui/AppText";
6import { NewThreadButton } from "../../components/NewThreadButton";
7import { FloatingActionButton } from "../../components/ui/FloatingActionButton";
8import { EmptyState } from "../../components/ui/EmptyState";
9import { ScreenContent } from "../../components/ui/ScreenContent";
10import { workspaceUsesColumns, type WorkspaceTab } from "./workspace/workspace-tabs-state";
11
12export function WorkspaceEmptyDetail(props: {
13 readonly tab?: WorkspaceTab | "settings";
14 readonly onStartNewTask?: () => void;
15 readonly onAddConnection?: () => void;
16}) {
17 const gt = useGT();
18 const pullRequests = props.tab === "pullRequests";
19 const issues = props.tab === "issues";
20 const settings = props.tab === "settings";
21 if (props.tab !== undefined && props.tab !== "settings" && !workspaceUsesColumns(props.tab))
22 return <View className="flex-1 bg-screen" />;
23 return (
24 <ScreenContent surface="screen">
25 <View
26 className={
27 Platform.OS === "android"
28 ? "flex-1 items-center justify-center px-10"
29 : "flex-1 items-center justify-center bg-screen px-10"
30 }
31 >
32 {props.onAddConnection ? (
33 <View className="w-full max-w-[430px]">
34 <EmptyState
35 title={gt("No environments connected")}
36 detail={gt("Add an environment to load projects and start coding sessions.")}
37 variant="plain"
38 action={
39 <FloatingActionButton
40 label={gt("Add environment")}
41 icon="plus"
42 variant="extended"
43 tone="primary"
44 onPress={props.onAddConnection}
45 />
46 }
47 />
48 </View>
49 ) : (
50 <View className="max-w-[360px] items-center gap-3">
51 <SymbolView
52 name="sidebar.left"
53 size={34}
54 tintColorClassName="accent-icon-subtle"
55 type="hierarchical"
56 />
57 <Text className="text-center text-xl font-t3-bold">
58 {settings
59 ? gt("Select a setting")
60 : pullRequests
61 ? gt("Select a pull request")
62 : issues
63 ? gt("Select an issue")
64 : gt("Select a thread")}
65 </Text>
66 <Text className="text-center text-base text-foreground-muted">
67 {settings
68 ? gt("Choose a page from the sidebar.")
69 : pullRequests
70 ? gt("Choose a pull request from the sidebar to review it.")
71 : issues
72 ? gt("Choose an issue from the sidebar to read it.")
73 : Platform.OS === "android"
74 ? gt("Choose a thread from the sidebar or start a new thread.")
75 : gt("Choose a thread from the sidebar or start a new task.")}
76 </Text>
77 {props.onStartNewTask && !pullRequests && !issues && !settings ? (
78 Platform.OS === "android" ? (
79 <NewThreadButton extended className="mt-2" onPress={props.onStartNewTask} />
80 ) : (
81 <Pressable
82 accessibilityRole="button"
83 className="mt-2 flex-row items-center gap-2 rounded-full bg-primary px-5 py-3 active:opacity-70"
84 onPress={props.onStartNewTask}
85 >
86 <Text className="text-base font-t3-bold text-primary-foreground">
87 <T>New thread</T>
88 </Text>
89 </Pressable>
90 )
91 ) : null}
92 </View>
93 )}
94 </View>
95 </ScreenContent>
96 );
97}