Open History to see the last commit
1import "../../global.css";
2import {
3 DMSans_400Regular,
4 DMSans_500Medium,
5 DMSans_700Bold,
6 useFonts,
7} from "@expo-google-fonts/dm-sans";
8import Stack from "expo-router/stack";
9import { StatusBar, useColorScheme } from "react-native";
10import { GestureHandlerRootView } from "react-native-gesture-handler";
11import { KeyboardProvider } from "react-native-keyboard-controller";
12import { SafeAreaProvider } from "react-native-safe-area-context";
13import { useCSSVariable, useResolveClassNames } from "uniwind";
14
15import { LoadingScreen } from "../components/LoadingScreen";
16
17import {
18 useRemoteEnvironmentBootstrap,
19 useRemoteEnvironmentState,
20} from "../state/use-remote-environment-registry";
21import { RegistryContext } from "@effect/atom-react";
22import { appAtomRegistry } from "../state/atom-registry";
23
24function AppNavigator() {
25 const { isLoadingSavedConnection } = useRemoteEnvironmentState();
26 const colorScheme = useColorScheme();
27 const statusBarBg = useCSSVariable("--color-status-bar");
28 const sheetStyle = useResolveClassNames("bg-sheet");
29
30 const newTaskScreenOptions = {
31 contentStyle: sheetStyle,
32 gestureEnabled: true,
33 headerShown: false,
34 presentation: "formSheet" as const,
35 sheetAllowedDetents: [0.92],
36 sheetGrabberVisible: true,
37 };
38
39 const connectionSheetScreenOptions = {
40 contentStyle: sheetStyle,
41 gestureEnabled: true,
42 headerShown: false,
43 presentation: "formSheet" as const,
44 sheetAllowedDetents: [0.55, 0.7],
45 sheetGrabberVisible: true,
46 };
47
48 if (isLoadingSavedConnection) {
49 return <LoadingScreen message="Loading remote workspace…" />;
50 }
51
52 return (
53 <>
54 <StatusBar
55 barStyle={colorScheme === "dark" ? "light-content" : "dark-content"}
56 backgroundColor={statusBarBg as string}
57 translucent
58 />
59 <Stack screenOptions={{ headerShown: false }}>
60 <Stack.Screen
61 name="index"
62 options={{
63 contentStyle: { backgroundColor: "transparent" },
64 headerShown: true,
65 headerTransparent: true,
66 headerShadowVisible: false,
67 }}
68 />
69 <Stack.Screen name="connections" options={connectionSheetScreenOptions} />
70 <Stack.Screen name="new" options={newTaskScreenOptions} />
71 <Stack.Screen
72 name="threads/[environmentId]/[threadId]"
73 options={{
74 animation: "slide_from_right",
75 contentStyle: { backgroundColor: "transparent" },
76 gestureEnabled: true,
77 headerShown: false,
78 }}
79 />
80 </Stack>
81 </>
82 );
83}
84
85export default function RootLayout() {
86 const [fontsLoaded] = useFonts({
87 DMSans_400Regular,
88 DMSans_500Medium,
89 DMSans_700Bold,
90 });
91 useRemoteEnvironmentBootstrap();
92
93 return (
94 <RegistryContext value={appAtomRegistry}>
95 <GestureHandlerRootView style={{ flex: 1 }}>
96 <KeyboardProvider statusBarTranslucent>
97 <SafeAreaProvider>
98 {fontsLoaded ? <AppNavigator /> : <LoadingScreen message="Loading remote workspace…" />}
99 </SafeAreaProvider>
100 </KeyboardProvider>
101 </GestureHandlerRootView>
102 </RegistryContext>
103 );
104}