- Split connection, catalog, composer, selection, and git state - Move image previews to a shared viewer component - Add ws client/runtime plumbing for remote environment handling
94 lines
2.8 KiB
TypeScript
94 lines
2.8 KiB
TypeScript
import "../../global.css";
|
|
|
|
import {
|
|
DMSans_400Regular,
|
|
DMSans_500Medium,
|
|
DMSans_700Bold,
|
|
useFonts,
|
|
} from "@expo-google-fonts/dm-sans";
|
|
import { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
|
|
import Stack from "expo-router/stack";
|
|
import { StatusBar, useColorScheme } from "react-native";
|
|
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
import { KeyboardProvider } from "react-native-keyboard-controller";
|
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
|
|
import { LoadingScreen } from "../components/LoadingScreen";
|
|
import { makeAppPalette } from "../lib/theme";
|
|
import {
|
|
useRemoteEnvironmentBootstrap,
|
|
useRemoteEnvironmentState,
|
|
} from "../state/use-remote-environment-registry";
|
|
|
|
function AppNavigator() {
|
|
const { isLoadingSavedConnection } = useRemoteEnvironmentState();
|
|
const isDarkMode = useColorScheme() !== "light";
|
|
const palette = makeAppPalette(isDarkMode);
|
|
|
|
const newTaskScreenOptions = {
|
|
contentStyle: { backgroundColor: palette.sheetBackground },
|
|
gestureEnabled: true,
|
|
headerShown: false,
|
|
presentation: "formSheet" as const,
|
|
sheetAllowedDetents: [0.92],
|
|
sheetGrabberVisible: true,
|
|
};
|
|
|
|
const connectionSheetScreenOptions = {
|
|
contentStyle: { backgroundColor: palette.sheetBackground },
|
|
gestureEnabled: true,
|
|
headerShown: false,
|
|
presentation: "formSheet" as const,
|
|
sheetAllowedDetents: [0.55, 0.7],
|
|
sheetGrabberVisible: true,
|
|
};
|
|
|
|
if (isLoadingSavedConnection) {
|
|
return <LoadingScreen message="Loading remote workspace…" />;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<StatusBar
|
|
barStyle={palette.statusBarStyle}
|
|
backgroundColor={palette.statusBarBackground}
|
|
translucent
|
|
/>
|
|
<Stack screenOptions={{ headerShown: false }}>
|
|
<Stack.Screen name="connections" options={connectionSheetScreenOptions} />
|
|
<Stack.Screen name="new" options={newTaskScreenOptions} />
|
|
<Stack.Screen
|
|
name="threads/[environmentId]/[threadId]"
|
|
options={{
|
|
animation: "slide_from_right",
|
|
contentStyle: { backgroundColor: palette.screenBackground },
|
|
gestureEnabled: true,
|
|
headerShown: false,
|
|
}}
|
|
/>
|
|
</Stack>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default function RootLayout() {
|
|
const [fontsLoaded] = useFonts({
|
|
DMSans_400Regular,
|
|
DMSans_500Medium,
|
|
DMSans_700Bold,
|
|
});
|
|
useRemoteEnvironmentBootstrap();
|
|
|
|
return (
|
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
<KeyboardProvider statusBarTranslucent>
|
|
<BottomSheetModalProvider>
|
|
<SafeAreaProvider>
|
|
{fontsLoaded ? <AppNavigator /> : <LoadingScreen message="Loading remote workspace…" />}
|
|
</SafeAreaProvider>
|
|
</BottomSheetModalProvider>
|
|
</KeyboardProvider>
|
|
</GestureHandlerRootView>
|
|
);
|
|
}
|