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

WorkspaceEmptyDetail.tsx

76 lines2.8 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 return (
17 <View
18 className={
19 Platform.OS === "android"
20 ? "flex-1 items-center justify-center px-10"
21 : "flex-1 items-center justify-center bg-screen px-10"
22 }
23 >
24 {props.onAddConnection ? (
25 <View className="w-full max-w-[430px]">
26 <EmptyState
27 title="No environments connected"
28 detail="Add an environment to load projects and start coding sessions."
29 variant="plain"
30 action={
31 <FloatingActionButton
32 label="Add environment"
33 icon="plus"
34 variant="extended"
35 tone="primary"
36 onPress={props.onAddConnection}
37 />
38 }
39 />
40 </View>
41 ) : (
42 <View className="max-w-[360px] items-center gap-3">
43 <SymbolView
44 name="sidebar.left"
45 size={34}
46 tintColorClassName="accent-icon-subtle"
47 type="hierarchical"
48 />
49 <Text className="text-center text-xl font-t3-bold">
50 {pullRequests ? "Select a pull request" : "Select a thread"}
51 </Text>
52 <Text className="text-center text-base text-foreground-muted">
53 {pullRequests
54 ? "Choose a pull request from the sidebar to review it."
55 : Platform.OS === "android"
56 ? "Choose a thread from the sidebar or start a new thread."
57 : "Choose a thread from the sidebar or start a new task."}
58 </Text>
59 {props.onStartNewTask && !pullRequests ? (
60 Platform.OS === "android" ? (
61 <NewThreadButton extended className="mt-2" onPress={props.onStartNewTask} />
62 ) : (
63 <Pressable
64 accessibilityRole="button"
65 className="mt-2 flex-row items-center gap-2 rounded-full bg-primary px-5 py-3 active:opacity-70"
66 onPress={props.onStartNewTask}
67 >
68 <Text className="text-base font-t3-bold text-primary-foreground">New thread</Text>
69 </Pressable>
70 )
71 ) : null}
72 </View>
73 )}
74 </View>
75 );