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