Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

WorkspaceEmptyDetail.tsx

78 lines2.9 KB

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;
12 readonly onStartNewTask?: () => void;
13 readonly onAddConnection?: () => void;
14}) {
15 const pullRequests = props.tab === "pullRequests";
16 if (props.tab && props.tab !== "threads" && props.tab !== "pullRequests")
17 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 {pullRequests ? "Select a pull request" : "Select a thread"}
53 </Text>
54 <Text className="text-center text-base text-foreground-muted">
55 {pullRequests
56 ? "Choose a pull request from the sidebar to review it."
57 : Platform.OS === "android"
58 ? "Choose a thread from the sidebar or start a new thread."
59 : "Choose a thread from the sidebar or start a new task."}
60 </Text>
61 {props.onStartNewTask && !pullRequests ? (
62 Platform.OS === "android" ? (
63 <NewThreadButton extended className="mt-2" onPress={props.onStartNewTask} />
64 ) : (
65 <Pressable
66 accessibilityRole="button"
67 className="mt-2 flex-row items-center gap-2 rounded-full bg-primary px-5 py-3 active:opacity-70"
68 onPress={props.onStartNewTask}
69 >
70 <Text className="text-base font-t3-bold text-primary-foreground">New thread</Text>
71 </Pressable>
72 )
73 ) : null}
74 </View>
75 )}
76 </View>
77 );