Replace Expo Router with native stack navigation

This commit is contained in:
Julius Marminge committed 2026-06-30 11:41:13 -07:00
1 parent a423e3c4b1
commit f6df16ab1e
68 files changed
+1648 -726

No files matched your search

-1
View File
@@ -109,7 +109,6 @@ const config: ExpoConfig = {
favicon: "./assets/favicon.png",
},
plugins: [
"expo-router",
"expo-font",
"expo-secure-store",
["@clerk/expo", { theme: "./clerk-theme.json" }],
+5 -1
View File
@@ -1,2 +1,6 @@
import "react-native-gesture-handler";
import "expo-router/entry";
import { registerRootComponent } from "expo";
import App from "./src/App";
registerRootComponent(App);
+3 -1
View File
@@ -50,6 +50,9 @@
"@noble/hashes": "catalog:",
"@pierre/diffs": "catalog:",
"@react-native-menu/menu": "^2.0.0",
"@react-navigation/elements": "2.9.26",
"@react-navigation/native": "7.3.4",
"@react-navigation/native-stack": "7.17.6",
"@shikijs/core": "4.2.0",
"@shikijs/engine-javascript": "4.2.0",
"@shikijs/langs": "4.2.0",
@@ -81,7 +84,6 @@
"expo-network": "~56.0.5",
"expo-notifications": "~56.0.18",
"expo-paste-input": "^0.1.15",
"expo-router": "~56.2.11",
"expo-secure-store": "~56.0.4",
"expo-splash-screen": "~56.0.10",
"expo-symbols": "~56.0.6",
+542
View File
@@ -0,0 +1,542 @@
import {
DMSans_400Regular,
DMSans_500Medium,
DMSans_700Bold,
useFonts,
} from "@expo-google-fonts/dm-sans";
import { NavigationContainer, type NavigationContainerRef } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import * as Linking from "expo-linking";
import { use, useCallback, useMemo, useRef, useState, type ReactNode } from "react";
import { StatusBar, useColorScheme, useWindowDimensions } 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 { useResolveClassNames } from "uniwind";
import { RegistryContext } from "@effect/atom-react";
import { LoadingScreen } from "./components/LoadingScreen";
import { ArchivedThreadsRouteScreen } from "./features/archive/ArchivedThreadsRouteScreen";
import { useAgentNotificationNavigation } from "./features/agent-awareness/notificationNavigation";
import { CloudAuthProvider } from "./features/cloud/CloudAuthProvider";
import {
ClerkSettingsSheetDetentProvider,
useClerkSettingsSheetDetent,
} from "./features/cloud/ClerkSettingsSheetDetent";
import {
AdaptiveWorkspaceLayout,
useAdaptiveWorkspaceLayout,
} from "./features/layout/AdaptiveWorkspaceLayout";
import { deriveStableFormSheetDetent } from "./lib/layout";
import { useThemeColor } from "./lib/useThemeColor";
import { appAtomRegistry } from "./state/atom-registry";
import { ThreadSelectionProvider } from "./state/use-thread-selection";
import { useThreadOutboxDrain } from "./state/use-thread-outbox-drain";
import HomeRouteScreen from "./screens/index";
import SettingsRouteScreen from "./screens/settings/index";
import SettingsEnvironmentsRouteScreen from "./screens/settings/environments";
import SettingsAuthRouteScreen from "./screens/settings/auth";
import SettingsWaitlistRouteScreen from "./screens/settings/waitlist";
import ConnectionsRouteScreen from "./screens/connections/index";
import ConnectionsNewRouteScreen from "./screens/connections/new";
import NewTaskRoute from "./screens/new/index";
import AddProjectRoute from "./screens/new/add-project/index";
import AddProjectRepositoryRoute from "./screens/new/add-project/repository";
import AddProjectDestinationRoute from "./screens/new/add-project/destination";
import AddProjectLocalRoute from "./screens/new/add-project/local";
import NewTaskDraftRoute from "./screens/new/draft";
import RnsGlassDebugRoute from "./screens/debug/rns-glass";
import NotFoundRoute from "./screens/+not-found";
import { ThreadFilesTreeScreen, ThreadFileScreen } from "./features/files/ThreadFilesRouteScreen";
import { ReviewHighlighterProvider } from "./features/review/ReviewHighlighterProvider";
import { ReviewCommentComposerSheet } from "./features/review/ReviewCommentComposerSheet";
import { ReviewSheet } from "./features/review/ReviewSheet";
import { ThreadTerminalRouteScreen } from "./features/terminal/ThreadTerminalRouteScreen";
import { ThreadRouteScreen } from "./features/threads/ThreadRouteScreen";
import { GitBranchesSheet } from "./features/threads/git/GitBranchesSheet";
import { GitCommitSheet } from "./features/threads/git/GitCommitSheet";
import { GitConfirmSheet } from "./features/threads/git/GitConfirmSheet";
import { GitOverviewSheet } from "./features/threads/git/GitOverviewSheet";
import { HardwareKeyboardCommandProvider } from "./features/keyboard/HardwareKeyboardCommandProvider";
import {
AppNavigationContext,
createRouter,
pathAndParamsFromCurrentRoute,
} from "./navigation/router";
import {
getFocusedRoute,
type AppStackParamList,
type RouteParams,
} from "./navigation/route-model";
import "../global.css";
const RootStack = createNativeStackNavigator<AppStackParamList>();
const linking = {
prefixes: [Linking.createURL("/"), "t3code://", "t3code-dev://", "t3code-preview://"],
config: {
screens: {
Home: "",
DebugRnsGlass: "debug/rns-glass",
Settings: "settings",
SettingsEnvironments: "settings/environments",
SettingsEnvironmentNew: "settings/environment-new",
SettingsArchive: "settings/archive",
SettingsAuth: "settings/auth",
SettingsWaitlist: "settings/waitlist",
Connections: "connections",
ConnectionsNew: "connections/new",
NewTask: "new",
AddProject: "new/add-project",
AddProjectRepository: "new/add-project/repository",
AddProjectDestination: "new/add-project/destination",
AddProjectLocal: "new/add-project/local",
NewTaskDraft: "new/draft",
Thread: "threads/:environmentId/:threadId",
ThreadTerminal: "threads/:environmentId/:threadId/terminal",
ThreadReview: "threads/:environmentId/:threadId/review",
ThreadReviewComment: "threads/:environmentId/:threadId/review-comment",
ThreadFiles: "threads/:environmentId/:threadId/files",
ThreadFile: "threads/:environmentId/:threadId/files/:path*",
GitOverview: "threads/:environmentId/:threadId/git",
GitCommit: "threads/:environmentId/:threadId/git/commit",
GitBranches: "threads/:environmentId/:threadId/git/branches",
GitConfirm: "threads/:environmentId/:threadId/git-confirm",
NotFound: "*",
},
},
};
function ThreadSelectionRoute(props: { readonly children: ReactNode }) {
return <ThreadSelectionProvider>{props.children}</ThreadSelectionProvider>;
}
function ThreadRoute() {
return (
<ThreadSelectionRoute>
<ThreadRouteScreen />
</ThreadSelectionRoute>
);
}
function ThreadTerminalRoute() {
return (
<ThreadSelectionRoute>
<ThreadTerminalRouteScreen />
</ThreadSelectionRoute>
);
}
function ThreadFilesRoute() {
return (
<ThreadSelectionRoute>
<ThreadFilesTreeScreen />
</ThreadSelectionRoute>
);
}
function ThreadFileRoute() {
return (
<ThreadSelectionRoute>
<ThreadFileScreen />
</ThreadSelectionRoute>
);
}
function ThreadReviewRoute() {
return (
<ThreadSelectionRoute>
<ReviewHighlighterProvider>
<ReviewSheet />
</ReviewHighlighterProvider>
</ThreadSelectionRoute>
);
}
function ThreadReviewCommentRoute() {
return (
<ThreadSelectionRoute>
<ReviewCommentComposerSheet />
</ThreadSelectionRoute>
);
}
function GitOverviewRoute() {
return (
<ThreadSelectionRoute>
<GitOverviewSheet />
</ThreadSelectionRoute>
);
}
function GitCommitRoute() {
return (
<ThreadSelectionRoute>
<GitCommitSheet />
</ThreadSelectionRoute>
);
}
function GitBranchesRoute() {
return (
<ThreadSelectionRoute>
<GitBranchesSheet />
</ThreadSelectionRoute>
);
}
function GitConfirmRoute() {
return (
<ThreadSelectionRoute>
<GitConfirmSheet />
</ThreadSelectionRoute>
);
}
function AppNavigationProvider(props: { readonly children: ReactNode }) {
const navigationRef = useRef<NavigationContainerRef<AppStackParamList>>(null);
const [pathname, setPathname] = useState("/");
const [params, setParams] = useState<RouteParams>({});
const router = useMemo(() => createRouter(navigationRef), []);
const contextValue = useMemo(
() => ({
navigationRef,
pathname,
params,
router,
}),
[params, pathname, router],
);
const syncState = useCallback(() => {
const route = getFocusedRoute(navigationRef.current?.getRootState());
if (!route) {
setPathname("/");
setParams({});
return;
}
const current = pathAndParamsFromCurrentRoute(route);
setPathname(current.pathname);
setParams(current.params);
}, []);
return (
<AppNavigationContext.Provider value={contextValue}>
<NavigationContainer
linking={linking}
onReady={syncState}
onStateChange={syncState}
ref={navigationRef}
>
{props.children}
</NavigationContainer>
</AppNavigationContext.Provider>
);
}
function AppNavigator() {
const pathname = usePathnameFromContext();
const expandedSettingsRouteIsActive =
pathname === "/settings/archive" || pathname === "/settings/auth";
return (
<ClerkSettingsSheetDetentProvider initiallyExpanded={expandedSettingsRouteIsActive}>
<AppNavigatorContent />
</ClerkSettingsSheetDetentProvider>
);
}
function usePathnameFromContext() {
const context = use(AppNavigationContext);
if (context === null) {
return "/";
}
return context.pathname;
}
function AppNavigatorContent() {
const pathname = usePathnameFromContext();
const isDebugRoute = pathname.startsWith("/debug/");
if (isDebugRoute) {
return <DebugNavigatorHost />;
}
return <WorkspaceNavigatorHost />;
}
function DebugNavigatorHost() {
return (
<>
<StatusBar barStyle="light-content" backgroundColor="transparent" translucent />
<RootStack.Navigator screenOptions={{ headerShown: false }}>
<RootStack.Screen name="DebugRnsGlass" component={RnsGlassDebugRoute} />
<RootStack.Screen name="Home" component={HomeRouteScreen} />
<RootStack.Screen name="NotFound" component={NotFoundRoute} />
</RootStack.Navigator>
</>
);
}
function WorkspaceNavigatorHost() {
const colorScheme = useColorScheme();
const statusBarBg = useThemeColor("--color-status-bar");
useAgentNotificationNavigation();
useThreadOutboxDrain();
return (
<>
<StatusBar
barStyle={colorScheme === "dark" ? "light-content" : "dark-content"}
backgroundColor={String(statusBarBg)}
translucent
/>
<AdaptiveWorkspaceLayout>
<WorkspaceNavigator />
</AdaptiveWorkspaceLayout>
</>
);
}
function WorkspaceNavigator() {
const { collapse, isExpanded } = useClerkSettingsSheetDetent();
const { layout } = useAdaptiveWorkspaceLayout();
const { height } = useWindowDimensions();
const sheetStyle = useResolveClassNames("bg-sheet");
const handleSettingsTransitionEnd = useCallback(
(event: { data: { closing: boolean } }) => {
if (event.data.closing) {
collapse();
}
},
[collapse],
);
const connectionSheetScreenOptions = {
contentStyle: sheetStyle,
gestureEnabled: true,
headerShown: false,
presentation: "formSheet" as const,
sheetAllowedDetents: [0.55, 0.7],
sheetGrabberVisible: true,
};
const settingsScreenOptions = layout.usesSplitView
? {
animation: "none" as const,
contentStyle: sheetStyle,
gestureEnabled: false,
headerShown: false,
presentation: "card" as const,
}
: {
...connectionSheetScreenOptions,
sheetAllowedDetents: isExpanded ? [0.92] : [0.7],
};
const newTaskScreenOptions = {
contentStyle: sheetStyle,
gestureEnabled: true,
headerShown: false,
presentation: "formSheet" as const,
sheetAllowedDetents: [layout.usesSplitView ? deriveStableFormSheetDetent(height) : 0.92],
sheetGrabberVisible: !layout.usesSplitView,
};
return (
<RootStack.Navigator screenOptions={{ headerShown: false }}>
<RootStack.Screen
name="Home"
component={HomeRouteScreen}
options={{
contentStyle: { backgroundColor: "transparent" },
headerShown: true,
headerTransparent: true,
headerShadowVisible: false,
}}
/>
<RootStack.Screen
name="Settings"
component={SettingsRouteScreen}
listeners={{ transitionEnd: handleSettingsTransitionEnd }}
options={settingsScreenOptions}
/>
<RootStack.Screen
name="SettingsEnvironments"
component={SettingsEnvironmentsRouteScreen}
options={settingsScreenOptions}
/>
<RootStack.Screen
name="SettingsEnvironmentNew"
component={ConnectionsNewRouteScreen}
options={settingsScreenOptions}
/>
<RootStack.Screen
name="SettingsArchive"
component={ArchivedThreadsRouteScreen}
listeners={{ transitionEnd: handleSettingsTransitionEnd }}
options={settingsScreenOptions}
/>
<RootStack.Screen
name="SettingsAuth"
component={SettingsAuthRouteScreen}
listeners={{ transitionEnd: handleSettingsTransitionEnd }}
options={settingsScreenOptions}
/>
<RootStack.Screen
name="SettingsWaitlist"
component={SettingsWaitlistRouteScreen}
options={settingsScreenOptions}
/>
<RootStack.Screen
name="Connections"
component={ConnectionsRouteScreen}
options={connectionSheetScreenOptions}
/>
<RootStack.Screen
name="ConnectionsNew"
component={ConnectionsNewRouteScreen}
options={connectionSheetScreenOptions}
/>
<RootStack.Screen name="NewTask" component={NewTaskRoute} options={newTaskScreenOptions} />
<RootStack.Screen
name="AddProject"
component={AddProjectRoute}
options={newTaskScreenOptions}
/>
<RootStack.Screen
name="AddProjectRepository"
component={AddProjectRepositoryRoute}
options={newTaskScreenOptions}
/>
<RootStack.Screen
name="AddProjectDestination"
component={AddProjectDestinationRoute}
options={newTaskScreenOptions}
/>
<RootStack.Screen
name="AddProjectLocal"
component={AddProjectLocalRoute}
options={newTaskScreenOptions}
/>
<RootStack.Screen
name="NewTaskDraft"
component={NewTaskDraftRoute}
options={newTaskScreenOptions}
/>
<RootStack.Screen
name="Thread"
component={ThreadRoute}
options={{
animation: layout.usesSplitView ? "none" : "slide_from_right",
contentStyle: { backgroundColor: "transparent" },
gestureEnabled: !layout.usesSplitView,
headerShown: false,
}}
/>
<RootStack.Screen
name="ThreadTerminal"
component={ThreadTerminalRoute}
options={{ contentStyle: sheetStyle, headerShown: false }}
/>
<RootStack.Screen
name="ThreadReview"
component={ThreadReviewRoute}
options={{ contentStyle: sheetStyle, headerShown: false }}
/>
<RootStack.Screen
name="ThreadReviewComment"
component={ThreadReviewCommentRoute}
options={{
contentStyle: sheetStyle,
headerShown: false,
presentation: "formSheet",
sheetAllowedDetents: [0.72, 0.92],
sheetGrabberVisible: true,
}}
/>
<RootStack.Screen
name="ThreadFiles"
component={ThreadFilesRoute}
options={{ contentStyle: sheetStyle, headerShown: false }}
/>
<RootStack.Screen
name="ThreadFile"
component={ThreadFileRoute}
options={{ contentStyle: sheetStyle, headerShown: false }}
/>
<RootStack.Screen
name="GitOverview"
component={GitOverviewRoute}
options={{
contentStyle: sheetStyle,
headerShown: false,
presentation: "formSheet",
sheetAllowedDetents: [0.85],
sheetGrabberVisible: true,
}}
/>
<RootStack.Screen
name="GitCommit"
component={GitCommitRoute}
options={{ contentStyle: sheetStyle, headerShown: false }}
/>
<RootStack.Screen
name="GitBranches"
component={GitBranchesRoute}
options={{ contentStyle: sheetStyle, headerShown: false }}
/>
<RootStack.Screen
name="GitConfirm"
component={GitConfirmRoute}
options={{
contentStyle: sheetStyle,
headerShown: false,
presentation: "formSheet",
sheetAllowedDetents: [0.4],
sheetGrabberVisible: true,
}}
/>
<RootStack.Screen
name="DebugRnsGlass"
component={RnsGlassDebugRoute}
options={{
animation: "none",
contentStyle: { backgroundColor: "transparent" },
headerShown: false,
}}
/>
<RootStack.Screen name="NotFound" component={NotFoundRoute} />
</RootStack.Navigator>
);
}
export default function App() {
const [fontsLoaded] = useFonts({
DMSans_400Regular,
DMSans_500Medium,
DMSans_700Bold,
});
return (
<RegistryContext.Provider value={appAtomRegistry}>
<CloudAuthProvider>
<GestureHandlerRootView style={{ flex: 1 }}>
<KeyboardProvider statusBarTranslucent>
<SafeAreaProvider>
<AppNavigationProvider>
<HardwareKeyboardCommandProvider>
{fontsLoaded ? (
<AppNavigator />
) : (
<LoadingScreen message="Loading remote workspace…" />
)}
</HardwareKeyboardCommandProvider>
</AppNavigationProvider>
</SafeAreaProvider>
</KeyboardProvider>
</GestureHandlerRootView>
</CloudAuthProvider>
</RegistryContext.Provider>
);
}
-206
View File
@@ -1,206 +0,0 @@
import {
DMSans_400Regular,
DMSans_500Medium,
DMSans_700Bold,
useFonts,
} from "@expo-google-fonts/dm-sans";
import { usePathname } from "expo-router";
import Stack from "expo-router/stack";
import { useCallback } from "react";
import { StatusBar, useColorScheme, useWindowDimensions } 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 { useResolveClassNames } from "uniwind";
import { LoadingScreen } from "../components/LoadingScreen";
import { useThreadOutboxDrain } from "../state/use-thread-outbox-drain";
import { RegistryContext } from "@effect/atom-react";
import { appAtomRegistry } from "../state/atom-registry";
import { CloudAuthProvider } from "../features/cloud/CloudAuthProvider";
import {
ClerkSettingsSheetDetentProvider,
useClerkSettingsSheetDetent,
} from "../features/cloud/ClerkSettingsSheetDetent";
import { useAgentNotificationNavigation } from "../features/agent-awareness/notificationNavigation";
import {
AdaptiveWorkspaceLayout,
useAdaptiveWorkspaceLayout,
} from "../features/layout/AdaptiveWorkspaceLayout";
import { deriveStableFormSheetDetent } from "../lib/layout";
import { useThemeColor } from "../lib/useThemeColor";
import { HardwareKeyboardCommandProvider } from "../features/keyboard/HardwareKeyboardCommandProvider";
require("../../global.css");
function AppNavigator() {
const pathname = usePathname();
const expandedSettingsRouteIsActive =
pathname === "/settings/archive" || pathname === "/settings/auth";
return (
<ClerkSettingsSheetDetentProvider initiallyExpanded={expandedSettingsRouteIsActive}>
<AppNavigatorContent />
</ClerkSettingsSheetDetentProvider>
);
}
function AppNavigatorContent() {
const pathname = usePathname();
const isDebugRoute = pathname.startsWith("/debug/");
if (isDebugRoute) {
return <DebugNavigatorHost />;
}
return <WorkspaceNavigatorHost />;
}
function DebugNavigatorHost() {
return (
<>
<StatusBar barStyle="light-content" backgroundColor="transparent" translucent />
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen
name="debug/rns-glass"
options={{
animation: "none",
contentStyle: { backgroundColor: "transparent" },
headerShown: false,
}}
/>
</Stack>
</>
);
}
function WorkspaceNavigatorHost() {
const colorScheme = useColorScheme();
const statusBarBg = useThemeColor("--color-status-bar");
useAgentNotificationNavigation();
useThreadOutboxDrain();
return (
<>
<StatusBar
barStyle={colorScheme === "dark" ? "light-content" : "dark-content"}
backgroundColor={String(statusBarBg)}
translucent
/>
<AdaptiveWorkspaceLayout>
<WorkspaceNavigator />
</AdaptiveWorkspaceLayout>
</>
);
}
function WorkspaceNavigator() {
const { collapse, isExpanded } = useClerkSettingsSheetDetent();
const { layout } = useAdaptiveWorkspaceLayout();
const { height } = useWindowDimensions();
const sheetStyle = useResolveClassNames("bg-sheet");
const handleSettingsTransitionEnd = useCallback(
(event: { data: { closing: boolean } }) => {
if (event.data.closing) {
collapse();
}
},
[collapse],
);
const connectionSheetScreenOptions = {
contentStyle: sheetStyle,
gestureEnabled: true,
headerShown: false,
presentation: "formSheet" as const,
sheetAllowedDetents: [0.55, 0.7],
sheetGrabberVisible: true,
};
const settingsScreenOptions = layout.usesSplitView
? {
animation: "none" as const,
contentStyle: sheetStyle,
gestureEnabled: false,
headerShown: false,
presentation: "card" as const,
}
: {
...connectionSheetScreenOptions,
sheetAllowedDetents: isExpanded ? [0.92] : [0.7],
};
const newTaskScreenOptions = {
contentStyle: sheetStyle,
gestureEnabled: true,
headerShown: false,
presentation: "formSheet" as const,
sheetAllowedDetents: [layout.usesSplitView ? deriveStableFormSheetDetent(height) : 0.92],
sheetGrabberVisible: !layout.usesSplitView,
};
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen
name="index"
options={{
contentStyle: { backgroundColor: "transparent" },
headerShown: true,
headerTransparent: true,
headerShadowVisible: false,
}}
/>
<Stack.Screen
name="settings"
listeners={{ transitionEnd: handleSettingsTransitionEnd }}
options={settingsScreenOptions}
/>
<Stack.Screen name="connections" options={connectionSheetScreenOptions} />
<Stack.Screen name="new" options={newTaskScreenOptions} />
<Stack.Screen
name="debug/rns-glass"
options={{
animation: "none",
contentStyle: { backgroundColor: "transparent" },
headerShown: false,
}}
/>
<Stack.Screen
name="threads/[environmentId]/[threadId]"
options={{
animation: layout.usesSplitView ? "none" : "slide_from_right",
contentStyle: { backgroundColor: "transparent" },
gestureEnabled: !layout.usesSplitView,
headerShown: false,
}}
/>
</Stack>
);
}
export default function RootLayout() {
const [fontsLoaded] = useFonts({
DMSans_400Regular,
DMSans_500Medium,
DMSans_700Bold,
});
return (
<RegistryContext.Provider value={appAtomRegistry}>
<CloudAuthProvider>
<GestureHandlerRootView style={{ flex: 1 }}>
<KeyboardProvider statusBarTranslucent>
<SafeAreaProvider>
<HardwareKeyboardCommandProvider>
{fontsLoaded ? (
<AppNavigator />
) : (
<LoadingScreen message="Loading remote workspace…" />
)}
</HardwareKeyboardCommandProvider>
</SafeAreaProvider>
</KeyboardProvider>
</GestureHandlerRootView>
</CloudAuthProvider>
</RegistryContext.Provider>
);
}
@@ -1,29 +0,0 @@
import Stack from "expo-router/stack";
import { useResolveClassNames } from "uniwind";
import { useThemeColor } from "../../lib/useThemeColor";
export const unstable_settings = {
anchor: "index",
};
export default function ConnectionsLayout() {
const contentStyle = useResolveClassNames("bg-sheet");
const connSheetBg = useThemeColor("--color-sheet");
const headerTint = useThemeColor("--color-foreground");
return (
<Stack
screenOptions={{
contentStyle,
headerStyle: { backgroundColor: connSheetBg },
headerTintColor: headerTint,
headerTitleStyle: { fontFamily: "DMSans_700Bold" },
headerShadowVisible: false,
headerBackButtonDisplayMode: "minimal",
}}
>
<Stack.Screen name="index" options={{ animation: "none" }} />
<Stack.Screen name="new" options={{ animation: "slide_from_right" }} />
</Stack>
);
}
-52
View File
@@ -1,52 +0,0 @@
import Stack from "expo-router/stack";
import { Platform } from "react-native";
import { useResolveClassNames } from "uniwind";
import { NewTaskFlowProvider } from "../../features/threads/new-task-flow-provider";
import { useThemeColor } from "../../lib/useThemeColor";
export const unstable_settings = {
anchor: "index",
};
export default function NewTaskLayout() {
const sheetStyle = useResolveClassNames("bg-sheet");
const sheetBg = useThemeColor("--color-sheet");
const headerTint = useThemeColor("--color-foreground");
return (
<NewTaskFlowProvider>
<Stack
screenOptions={{
contentStyle: sheetStyle,
headerBackButtonDisplayMode: "minimal",
headerLargeTitle: false,
headerShadowVisible: false,
headerStyle: { backgroundColor: sheetBg },
headerTintColor: headerTint,
headerTitleStyle: { fontFamily: "DMSans_700Bold" },
unstable_navigationItemStyle: Platform.OS === "ios" ? "editor" : undefined,
}}
>
<Stack.Screen name="index" options={{ animation: "none", title: "Choose project" }} />
<Stack.Screen
name="add-project/index"
options={{ animation: "slide_from_right", title: "New project" }}
/>
<Stack.Screen
name="add-project/repository"
options={{ animation: "slide_from_right", title: "Repository" }}
/>
<Stack.Screen
name="add-project/destination"
options={{ animation: "slide_from_right", title: "Clone destination" }}
/>
<Stack.Screen
name="add-project/local"
options={{ animation: "slide_from_right", title: "Local folder" }}
/>
<Stack.Screen name="draft" options={{ animation: "slide_from_right", title: "New task" }} />
</Stack>
</NewTaskFlowProvider>
);
}
-62
View File
@@ -1,62 +0,0 @@
import Stack from "expo-router/stack";
import { useCallback } from "react";
import { useResolveClassNames } from "uniwind";
import { useClerkSettingsSheetDetent } from "../../features/cloud/ClerkSettingsSheetDetent";
import { useThemeColor } from "../../lib/useThemeColor";
export const unstable_settings = {
anchor: "index",
};
export default function SettingsLayout() {
const { collapse } = useClerkSettingsSheetDetent();
const contentStyle = useResolveClassNames("bg-sheet");
const sheetBg = useThemeColor("--color-sheet");
const headerTint = useThemeColor("--color-foreground");
const handleExpandedRouteTransitionEnd = useCallback(
(event: { data: { closing: boolean } }) => {
if (event.data.closing) {
collapse();
}
},
[collapse],
);
return (
<Stack
screenOptions={{
contentStyle,
headerBackButtonDisplayMode: "minimal",
headerShadowVisible: false,
headerStyle: { backgroundColor: sheetBg },
headerTintColor: headerTint,
headerTitleStyle: { fontFamily: "DMSans_700Bold" },
}}
>
<Stack.Screen name="index" options={{ animation: "none", title: "Settings" }} />
<Stack.Screen
name="environments"
options={{ animation: "slide_from_right", title: "Environments" }}
/>
<Stack.Screen
name="environment-new"
options={{ animation: "slide_from_right", title: "Add Environment" }}
/>
<Stack.Screen
name="waitlist"
options={{ animation: "slide_from_right", title: "Join the waitlist" }}
/>
<Stack.Screen
name="archive"
listeners={{ transitionEnd: handleExpandedRouteTransitionEnd }}
options={{ animation: "slide_from_right", title: "Archived Threads" }}
/>
<Stack.Screen
name="auth"
listeners={{ transitionEnd: handleExpandedRouteTransitionEnd }}
options={{ animation: "slide_from_right", title: "Sign in" }}
/>
</Stack>
);
}
@@ -1,113 +0,0 @@
import Stack from "expo-router/stack";
import { StyleSheet } from "react-native";
import { useResolveClassNames } from "uniwind";
import { useAdaptiveWorkspaceLayout } from "../../../../features/layout/AdaptiveWorkspaceLayout";
import { ThreadSelectionProvider } from "../../../../state/use-thread-selection";
export default function ThreadLayout() {
const { fileInspector } = useAdaptiveWorkspaceLayout();
const sheetStyle = StyleSheet.flatten(useResolveClassNames("bg-sheet"));
const headerBg = {
backgroundColor: (sheetStyle as { backgroundColor?: string })?.backgroundColor,
};
return (
<ThreadSelectionProvider>
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen
name="index"
options={{
contentStyle: { backgroundColor: "transparent" },
headerShown: true,
headerTransparent: true,
headerTitle: "",
}}
/>
<Stack.Screen
name="git"
options={{
contentStyle: sheetStyle,
gestureEnabled: true,
headerShown: false,
presentation: "formSheet" as const,
sheetAllowedDetents: [0.85],
sheetGrabberVisible: true,
}}
/>
<Stack.Screen
name="git-confirm"
options={{
contentStyle: sheetStyle,
gestureEnabled: true,
headerShown: false,
presentation: "formSheet" as const,
sheetAllowedDetents: [0.4],
sheetGrabberVisible: true,
}}
/>
<Stack.Screen
name="review"
options={{
animation: "slide_from_right",
contentStyle: sheetStyle,
headerBackButtonDisplayMode: "minimal",
headerShown: true,
headerTitle: "Files changed",
headerBackTitle: "",
headerShadowVisible: false,
headerStyle: headerBg,
}}
/>
<Stack.Screen
name="files/index"
options={{
animation: fileInspector.supported ? "none" : "slide_from_right",
contentStyle: sheetStyle,
gestureEnabled: true,
headerBackButtonDisplayMode: "minimal",
headerShown: true,
headerTitle: "Files",
headerBackTitle: "",
headerShadowVisible: false,
headerStyle: headerBg,
}}
/>
<Stack.Screen
name="files/[...path]"
options={{
animation: fileInspector.supported ? "none" : "slide_from_right",
contentStyle: sheetStyle,
gestureEnabled: true,
headerBackButtonDisplayMode: "minimal",
headerShown: true,
headerTitle: "File",
headerBackTitle: "",
headerShadowVisible: false,
headerStyle: headerBg,
}}
/>
<Stack.Screen
name="review-comment"
options={{
contentStyle: sheetStyle,
gestureEnabled: true,
headerShown: false,
presentation: "formSheet" as const,
sheetAllowedDetents: [0.72, 0.92],
sheetGrabberVisible: true,
}}
/>
<Stack.Screen
name="terminal"
options={{
animation: "slide_from_right",
contentStyle: { backgroundColor: "#050505" },
headerBackButtonDisplayMode: "minimal",
headerShown: true,
headerShadowVisible: false,
}}
/>
</Stack>
</ThreadSelectionProvider>
);
}
@@ -1,58 +0,0 @@
import Stack from "expo-router/stack";
import { StyleSheet } from "react-native";
import { useResolveClassNames } from "uniwind";
export const unstable_settings = {
anchor: "index",
};
export default function GitSheetLayout() {
const sheetStyle = StyleSheet.flatten(useResolveClassNames("bg-sheet"));
const headerBg = {
backgroundColor: (sheetStyle as { backgroundColor?: string })?.backgroundColor,
};
return (
<Stack
screenOptions={{
contentStyle: sheetStyle,
headerShown: false,
}}
>
<Stack.Screen name="index" options={{ animation: "none" }} />
<Stack.Screen
name="commit"
options={{
animation: "slide_from_right",
headerShown: true,
headerTitle: "Commit changes",
headerBackTitle: "",
headerShadowVisible: false,
headerStyle: headerBg,
}}
/>
<Stack.Screen
name="branches"
options={{
animation: "slide_from_right",
headerShown: true,
headerTitle: "Branches & worktrees",
headerBackTitle: "",
headerShadowVisible: false,
headerStyle: headerBg,
}}
/>
<Stack.Screen
name="review"
options={{
animation: "slide_from_right",
headerShown: true,
headerTitle: "Review changes",
headerBackTitle: "",
headerShadowVisible: false,
headerStyle: headerBg,
}}
/>
</Stack>
);
}
@@ -1,18 +0,0 @@
import { Redirect, useLocalSearchParams } from "expo-router";
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
export default function ReviewRoute() {
const { environmentId, threadId } = useLocalSearchParams<{
environmentId: EnvironmentId;
threadId: ThreadId;
}>();
return (
<Redirect
href={{
pathname: "/threads/[environmentId]/[threadId]/review",
params: { environmentId, threadId },
}}
/>
);
}
@@ -1,6 +1,6 @@
import { useEffect, useRef } from "react";
import * as Notifications from "expo-notifications";
import { useRouter } from "expo-router";
import { useRouter } from "../../navigation/router";
import { routeAgentNotificationResponseOnce } from "./notificationPayload";
import { consumeLastAgentNotificationResponse } from "./notificationResponseConsumer";
@@ -1,7 +1,7 @@
import type { EnvironmentId } from "@t3tools/contracts";
import * as Arr from "effect/Array";
import * as Order from "effect/Order";
import { useFocusEffect } from "expo-router";
import { useFocusEffect } from "../../navigation/router";
import { useCallback, useMemo, useState } from "react";
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
@@ -4,7 +4,7 @@ import type {
} from "@t3tools/client-runtime/state/shell";
import type { EnvironmentId } from "@t3tools/contracts";
import type { MenuAction } from "@react-native-menu/menu";
import { Stack } from "expo-router";
import { Stack } from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import { useCallback, useMemo, useRef, type ComponentProps } from "react";
import {
@@ -1,6 +1,6 @@
import Stack from "expo-router/stack";
import Stack from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import { useLocalSearchParams, useRouter } from "expo-router";
import { useLocalSearchParams, useRouter } from "../../navigation/router";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import {
ActivityIndicator,
+1 -1
View File
@@ -3,7 +3,7 @@ import type {
SidebarProjectGroupingMode,
SidebarThreadSortOrder,
} from "@t3tools/contracts";
import { Stack } from "expo-router";
import { Stack } from "../../navigation/router";
import { useCallback, useRef } from "react";
import { Platform } from "react-native";
import type { SearchBarCommands } from "react-native-screens";
@@ -1,4 +1,4 @@
import { usePathname, useRouter } from "expo-router";
import { usePathname, useRouter } from "../../navigation/router";
import { useCallback, useMemo, useSyncExternalStore, type PropsWithChildren } from "react";
import {
@@ -1,6 +1,11 @@
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { useFocusEffect, useGlobalSearchParams, usePathname, useRouter } from "expo-router";
import {
useFocusEffect,
useGlobalSearchParams,
usePathname,
useRouter,
} from "../../navigation/router";
import {
createContext,
use,
@@ -1,4 +1,4 @@
import { Stack } from "expo-router";
import { Stack } from "../../navigation/router";
import type { ReactNode } from "react";
import { useAdaptiveWorkspaceLayout } from "./AdaptiveWorkspaceLayout";
@@ -22,7 +22,7 @@ import {
isFilesystemBrowseQuery,
} from "@t3tools/client-runtime/state/projects";
import { CommandId, type EnvironmentId, ProjectId } from "@t3tools/contracts";
import { useLocalSearchParams, useRouter } from "expo-router";
import { useLocalSearchParams, useRouter } from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react";
import { ActivityIndicator, Alert, Pressable, ScrollView, View } from "react-native";
@@ -1,4 +1,4 @@
import { useLocalSearchParams, useRouter } from "expo-router";
import { useLocalSearchParams, useRouter } from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import { TextInputWrapper } from "expo-paste-input";
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
@@ -1,7 +1,7 @@
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { useLocalSearchParams } from "expo-router";
import { useHeaderHeight } from "expo-router/build/react-navigation/elements";
import Stack from "expo-router/stack";
import { useLocalSearchParams } from "../../navigation/router";
import { useHeaderHeight } from "@react-navigation/elements";
import Stack from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import {
memo,
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import type { NativeSyntheticEvent } from "react-native";
import { useRouter } from "expo-router";
import { useRouter } from "../../navigation/router";
import * as Arr from "effect/Array";
import { pipe } from "effect/Function";
import * as Result from "effect/Result";
@@ -1,7 +1,7 @@
import { DEFAULT_TERMINAL_ID, EnvironmentId, ThreadId } from "@t3tools/contracts";
import { type KnownTerminalSession } from "@t3tools/client-runtime/state/terminal";
import { SymbolView } from "expo-symbols";
import { Stack, useLocalSearchParams, useRouter } from "expo-router";
import { Stack, useLocalSearchParams, useRouter } from "../../navigation/router";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Platform, Pressable, Text as RNText, View, useColorScheme } from "react-native";
import {
@@ -1,4 +1,4 @@
import { Stack, useRouter } from "expo-router";
import { Stack, useRouter } from "../../navigation/router";
import { useCallback, useEffect, useMemo, useRef } from "react";
import { Alert, InteractionManager, View, useColorScheme } from "react-native";
import { KeyboardAvoidingView, useKeyboardState } from "react-native-keyboard-controller";
@@ -15,7 +15,7 @@ import type {
} from "@t3tools/contracts";
import { formatElapsed } from "@t3tools/shared/orchestrationTiming";
import * as Haptics from "expo-haptics";
import { useHeaderHeight } from "expo-router/build/react-navigation/elements";
import { useHeaderHeight } from "@react-navigation/elements";
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { View, type GestureResponderEvent } from "react-native";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
@@ -4,7 +4,7 @@ import { type LegendListRef } from "@legendapp/list/react-native";
import type { EnvironmentId, MessageId, ThreadId, TurnId } from "@t3tools/contracts";
import { CHAT_LIST_ANCHOR_OFFSET, resolveChatListAnchoredEndSpace } from "@t3tools/shared/chatList";
import { SymbolView } from "expo-symbols";
import { useRouter } from "expo-router";
import { useRouter } from "../../navigation/router";
import {
memo,
useCallback,
@@ -10,9 +10,8 @@ import {
requiresDefaultBranchConfirmation,
resolveQuickAction,
} from "@t3tools/client-runtime/state/vcs";
import { useLocalSearchParams, useRouter } from "expo-router";
import type { NativeStackNavigationOptions } from "expo-router/build/react-navigation/native-stack/types";
import Stack from "expo-router/stack";
import { useLocalSearchParams, useRouter } from "../../navigation/router";
import Stack from "../../navigation/router";
import { useCallback, useMemo } from "react";
import { Alert } from "react-native";
import { buildThreadFilesNavigation, buildThreadReviewRoutePath } from "../../lib/routes";
@@ -66,10 +65,8 @@ function compactMenuStatus(gitStatus: VcsStatusResult | null): string {
return parts.join(" · ");
}
type HeaderItems = ReturnType<
NonNullable<NativeStackNavigationOptions["unstable_headerRightItems"]>
>;
type HeaderItem = HeaderItems[number];
type HeaderItem = Record<string, unknown>;
type HeaderItems = HeaderItem[];
type ThreadGitHeaderActionItems = {
readonly terminal: HeaderItem;
readonly files: HeaderItem;
@@ -330,7 +327,7 @@ function useThreadGitHeaderActionItems(props: ThreadGitControlsProps): ThreadGit
type: "sfSymbol",
},
label: compactMenuBranchLabel(model.currentBranchLabel),
onPress: () => {},
onPress: (): void => {},
type: "action",
},
{
@@ -338,7 +335,7 @@ function useThreadGitHeaderActionItems(props: ThreadGitControlsProps): ThreadGit
disabled: model.quickAction.disabled,
icon: { name: model.quickActionIcon, type: "sfSymbol" },
label: model.quickAction.label,
onPress: () => void model.runQuickAction(),
onPress: (): void => void model.runQuickAction(),
type: "action",
},
{
@@ -2,7 +2,7 @@ import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell
import { LegendList } from "@legendapp/list/react-native";
import type { MenuAction } from "@react-native-menu/menu";
import { SymbolView } from "expo-symbols";
import { useRouter } from "expo-router";
import { useRouter } from "../../navigation/router";
import { memo, useCallback, useMemo, useRef, useState, type ComponentProps } from "react";
import type { ColorValue, NativeScrollEvent, NativeSyntheticEvent } from "react-native";
import { Platform, Pressable, StyleSheet, TextInput, View, useColorScheme } from "react-native";
@@ -1,5 +1,4 @@
import { Stack, useFocusEffect, useLocalSearchParams, useRouter } from "expo-router";
import type { NativeStackNavigationOptions } from "expo-router/build/react-navigation/native-stack/types";
import { Stack, useFocusEffect, useLocalSearchParams, useRouter } from "../../navigation/router";
import {
useCallback,
useEffect,
@@ -99,9 +98,7 @@ interface ThreadInspectorSelection {
readonly mode: ThreadInspectorMode;
}
type NativeHeaderItems = ReturnType<
NonNullable<NativeStackNavigationOptions["unstable_headerRightItems"]>
>;
type NativeHeaderItems = ReadonlyArray<Record<string, unknown>>;
type RnsHeaderItems = ComponentProps<typeof ScreenStackHeaderConfig>["headerRightBarButtonItems"];
const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
@@ -1,5 +1,5 @@
import { sanitizeFeatureBranchName } from "@t3tools/shared/git";
import { useRouter } from "expo-router";
import { useRouter } from "../../../navigation/router";
import { useState } from "react";
import { Pressable, ScrollView, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -1,4 +1,4 @@
import { useRouter } from "expo-router";
import { useRouter } from "../../../navigation/router";
import { useCallback, useState } from "react";
import { Pressable, ScrollView, View, useColorScheme } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -2,7 +2,7 @@ import { resolveDefaultBranchActionDialogCopy } from "@t3tools/client-runtime/st
import { resolveAutoFeatureBranchName } from "@t3tools/shared/git";
import * as Arr from "effect/Array";
import * as Result from "effect/Result";
import { useLocalSearchParams, useRouter } from "expo-router";
import { useLocalSearchParams, useRouter } from "../../../navigation/router";
import { useCallback, useMemo } from "react";
import { View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -5,7 +5,7 @@ import {
requiresDefaultBranchConfirmation,
} from "@t3tools/client-runtime/state/vcs";
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { useLocalSearchParams, useRouter } from "expo-router";
import { useLocalSearchParams, useRouter } from "../../../navigation/router";
import { SymbolView } from "expo-symbols";
import { useCallback, useEffect, useMemo, type ComponentProps } from "react";
import { Alert, Platform, Pressable, ScrollView, View } from "react-native";
+1 -1
View File
@@ -1,4 +1,4 @@
import type { Href, useRouter } from "expo-router";
import type { Href, useRouter } from "../navigation/router";
import { type EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
+375
View File
@@ -0,0 +1,375 @@
import type { NavigationState, PartialState, Route } from "@react-navigation/native";
export type RouteParams = Record<string, string | string[] | undefined>;
export type AppRouteName =
| "Home"
| "Settings"
| "SettingsEnvironments"
| "SettingsEnvironmentNew"
| "SettingsArchive"
| "SettingsAuth"
| "SettingsWaitlist"
| "Connections"
| "ConnectionsNew"
| "NewTask"
| "AddProject"
| "AddProjectRepository"
| "AddProjectDestination"
| "AddProjectLocal"
| "NewTaskDraft"
| "Thread"
| "ThreadTerminal"
| "ThreadReview"
| "ThreadReviewComment"
| "ThreadFiles"
| "ThreadFile"
| "GitOverview"
| "GitCommit"
| "GitBranches"
| "GitConfirm"
| "DebugRnsGlass"
| "NotFound";
export type AppStackParamList = {
Home: undefined;
Settings: undefined;
SettingsEnvironments: undefined;
SettingsEnvironmentNew: RouteParams | undefined;
SettingsArchive: undefined;
SettingsAuth: undefined;
SettingsWaitlist: undefined;
Connections: undefined;
ConnectionsNew: RouteParams | undefined;
NewTask: undefined;
AddProject: RouteParams | undefined;
AddProjectRepository: RouteParams | undefined;
AddProjectDestination: RouteParams | undefined;
AddProjectLocal: RouteParams | undefined;
NewTaskDraft: RouteParams | undefined;
Thread: RouteParams;
ThreadTerminal: RouteParams;
ThreadReview: RouteParams;
ThreadReviewComment: RouteParams;
ThreadFiles: RouteParams;
ThreadFile: RouteParams;
GitOverview: RouteParams;
GitCommit: RouteParams;
GitBranches: RouteParams;
GitConfirm: RouteParams;
DebugRnsGlass: undefined;
NotFound: RouteParams | undefined;
};
export type AppHref =
| string
| {
readonly pathname: string;
readonly params?: RouteParams;
};
export type AppNavigationTarget = {
readonly name: AppRouteName;
readonly params?: RouteParams;
};
export type AppFocusedRoute = Pick<Route<string>, "name" | "params">;
function normalizeParamValue(value: unknown): string | string[] | undefined {
if (value === undefined || value === null) {
return undefined;
}
if (Array.isArray(value)) {
return value.map((item) => String(item));
}
return String(value);
}
export function normalizeRouteParams(
params: Record<string, unknown> | undefined,
): RouteParams | undefined {
if (!params) {
return undefined;
}
const normalized: RouteParams = {};
for (const [key, value] of Object.entries(params)) {
const normalizedValue = normalizeParamValue(value);
if (normalizedValue !== undefined) {
normalized[key] = normalizedValue;
}
}
return normalized;
}
function withParams(name: AppRouteName, params?: Record<string, unknown>): AppNavigationTarget {
return { name, params: normalizeRouteParams(params) };
}
function splitPathAndQuery(path: string): {
readonly pathname: string;
readonly query: RouteParams | undefined;
} {
const queryStart = path.indexOf("?");
if (queryStart === -1) {
return { pathname: path, query: undefined };
}
const pathname = path.slice(0, queryStart);
const query = new URLSearchParams(path.slice(queryStart + 1));
const params: RouteParams = {};
for (const [key, value] of query.entries()) {
const existing = params[key];
if (Array.isArray(existing)) {
existing.push(value);
} else if (existing !== undefined) {
params[key] = [existing, value];
} else {
params[key] = value;
}
}
return { pathname, query: Object.keys(params).length > 0 ? params : undefined };
}
function pathSegments(pathname: string): string[] {
return pathname
.replace(/^\/+|\/+$/g, "")
.split("/")
.filter(Boolean)
.map((segment) => decodeURIComponent(segment));
}
function mergeParams(
base: Record<string, unknown> | undefined,
extra: Record<string, unknown> | undefined,
): RouteParams | undefined {
return normalizeRouteParams({ ...base, ...extra });
}
export function resolveNavigationTarget(href: AppHref): AppNavigationTarget {
if (typeof href !== "string") {
return resolveNavigationObject(href.pathname, href.params);
}
const { pathname, query } = splitPathAndQuery(href);
const target = resolveNavigationPath(pathname);
return { name: target.name, params: mergeParams(target.params, query) };
}
function resolveNavigationObject(
pathname: string,
params: RouteParams | undefined,
): AppNavigationTarget {
switch (pathname) {
case "/threads/[environmentId]/[threadId]/terminal":
return withParams("ThreadTerminal", params);
case "/threads/[environmentId]/[threadId]/files":
return withParams("ThreadFiles", params);
case "/threads/[environmentId]/[threadId]/files/[...path]":
return withParams("ThreadFile", params);
case "/threads/[environmentId]/[threadId]/review":
return withParams("ThreadReview", params);
case "/threads/[environmentId]/[threadId]/review-comment":
return withParams("ThreadReviewComment", params);
case "/threads/[environmentId]/[threadId]/git":
return withParams("GitOverview", params);
case "/threads/[environmentId]/[threadId]/git/commit":
return withParams("GitCommit", params);
case "/threads/[environmentId]/[threadId]/git/branches":
return withParams("GitBranches", params);
case "/threads/[environmentId]/[threadId]/git-confirm":
return withParams("GitConfirm", params);
case "/new/draft":
return withParams("NewTaskDraft", params);
case "/new/add-project/repository":
return withParams("AddProjectRepository", params);
case "/new/add-project/destination":
return withParams("AddProjectDestination", params);
case "/new/add-project/local":
return withParams("AddProjectLocal", params);
default: {
const target = resolveNavigationPath(pathname);
return { ...target, params: mergeParams(target.params, params) };
}
}
}
export function resolveNavigationPath(pathname: string): AppNavigationTarget {
const segments = pathSegments(pathname);
if (segments.length === 0) return { name: "Home" };
if (segments[0] === "debug" && segments[1] === "rns-glass") return { name: "DebugRnsGlass" };
if (segments[0] === "settings") {
switch (segments[1]) {
case undefined:
return { name: "Settings" };
case "environments":
return { name: "SettingsEnvironments" };
case "environment-new":
return { name: "SettingsEnvironmentNew" };
case "archive":
return { name: "SettingsArchive" };
case "auth":
return { name: "SettingsAuth" };
case "waitlist":
return { name: "SettingsWaitlist" };
default:
return withParams("NotFound", { pathname });
}
}
if (segments[0] === "connections") {
return segments[1] === "new" ? { name: "ConnectionsNew" } : { name: "Connections" };
}
if (segments[0] === "new") {
if (segments[1] === "add-project") {
switch (segments[2]) {
case undefined:
return { name: "AddProject" };
case "repository":
return { name: "AddProjectRepository" };
case "destination":
return { name: "AddProjectDestination" };
case "local":
return { name: "AddProjectLocal" };
default:
return withParams("NotFound", { pathname });
}
}
return segments[1] === "draft" ? { name: "NewTaskDraft" } : { name: "NewTask" };
}
if (segments[0] === "threads" && segments[1] && segments[2]) {
const baseParams = { environmentId: segments[1], threadId: segments[2] };
switch (segments[3]) {
case undefined:
return withParams("Thread", baseParams);
case "terminal":
return withParams("ThreadTerminal", baseParams);
case "review":
return withParams("ThreadReview", baseParams);
case "review-comment":
return withParams("ThreadReviewComment", baseParams);
case "git":
if (segments[4] === "commit") return withParams("GitCommit", baseParams);
if (segments[4] === "branches") return withParams("GitBranches", baseParams);
if (segments[4] === "review") return withParams("ThreadReview", baseParams);
return withParams("GitOverview", baseParams);
case "git-confirm":
return withParams("GitConfirm", baseParams);
case "files":
if (segments.length > 4) {
return withParams("ThreadFile", { ...baseParams, path: segments.slice(4) });
}
return withParams("ThreadFiles", baseParams);
default:
return withParams("NotFound", { pathname });
}
}
return withParams("NotFound", { pathname });
}
export function buildPathFromRoute(route: AppFocusedRoute): string {
const params = (route.params ?? {}) as RouteParams;
const environmentId = firstParam(params.environmentId);
const threadId = firstParam(params.threadId);
const path = params.path;
const pathSegmentsValue = Array.isArray(path) ? path : path ? [path] : [];
const query = new URLSearchParams();
for (const [key, value] of Object.entries(params)) {
if (key === "environmentId" || key === "threadId" || key === "path") continue;
if (Array.isArray(value)) {
for (const item of value) query.append(key, item);
} else if (value !== undefined) {
query.set(key, value);
}
}
const querySuffix = query.size > 0 ? `?${query.toString()}` : "";
switch (route.name as AppRouteName) {
case "Home":
return "/";
case "Settings":
return "/settings";
case "SettingsEnvironments":
return "/settings/environments";
case "SettingsEnvironmentNew":
return `/settings/environment-new${querySuffix}`;
case "SettingsArchive":
return "/settings/archive";
case "SettingsAuth":
return "/settings/auth";
case "SettingsWaitlist":
return "/settings/waitlist";
case "Connections":
return "/connections";
case "ConnectionsNew":
return `/connections/new${querySuffix}`;
case "NewTask":
return "/new";
case "AddProject":
return "/new/add-project";
case "AddProjectRepository":
return `/new/add-project/repository${querySuffix}`;
case "AddProjectDestination":
return `/new/add-project/destination${querySuffix}`;
case "AddProjectLocal":
return `/new/add-project/local${querySuffix}`;
case "NewTaskDraft":
return `/new/draft${querySuffix}`;
case "Thread":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}`;
case "ThreadTerminal":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/terminal${querySuffix}`;
case "ThreadReview":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/review`;
case "ThreadReviewComment":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/review-comment${querySuffix}`;
case "ThreadFiles":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/files${querySuffix}`;
case "ThreadFile":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/files/${pathSegmentsValue.map(encodeURIComponent).join("/")}${querySuffix}`;
case "GitOverview":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/git${querySuffix}`;
case "GitCommit":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/git/commit${querySuffix}`;
case "GitBranches":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/git/branches${querySuffix}`;
case "GitConfirm":
return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/git-confirm${querySuffix}`;
case "DebugRnsGlass":
return "/debug/rns-glass";
case "NotFound":
return firstParam(params.pathname) ?? "/not-found";
}
}
export function buildPathFromState(
state: NavigationState | PartialState<NavigationState> | undefined,
): string {
const route = getFocusedRoute(state);
return route ? buildPathFromRoute(route) : "/";
}
export function getFocusedRoute(
state: NavigationState | PartialState<NavigationState> | undefined,
): AppFocusedRoute | undefined {
if (!state || state.routes.length === 0) {
return undefined;
}
const index = state.index ?? 0;
const route = state.routes[index];
if (!route) {
return undefined;
}
return getFocusedRoute(route.state as PartialState<NavigationState> | undefined) ?? route;
}
export function firstParam(value: string | string[] | undefined): string | undefined {
return Array.isArray(value) ? value[0] : value;
}
+536
View File
@@ -0,0 +1,536 @@
import {
CommonActions,
StackActions,
useFocusEffect,
useNavigation,
useRoute,
type NavigationContainerRef,
type ParamListBase,
} from "@react-navigation/native";
import type { ColorValue } from "react-native";
import type {
NativeStackHeaderItem,
NativeStackHeaderItemMenu,
NativeStackNavigationOptions,
NativeStackNavigationProp,
} from "@react-navigation/native-stack";
import {
Children,
cloneElement,
createContext,
createElement,
Fragment,
isValidElement,
use,
useEffect,
useMemo,
type ReactElement,
type ReactNode,
} from "react";
import {
buildPathFromRoute,
resolveNavigationTarget,
type AppHref,
type AppStackParamList,
type AppFocusedRoute,
type RouteParams,
} from "./route-model";
export { useFocusEffect };
export type Href = AppHref;
type CompatNativeStackNavigationOptions = Omit<
NativeStackNavigationOptions,
"headerTintColor" | "unstable_headerLeftItems" | "unstable_headerRightItems"
> & {
readonly headerTintColor?: string | ColorValue;
readonly unstable_headerCenterItems?: unknown;
readonly unstable_headerLeftItems?: unknown;
readonly unstable_headerRightItems?: unknown;
readonly unstable_headerSubtitle?: unknown;
readonly unstable_headerToolbarItems?: unknown;
readonly unstable_navigationItemStyle?: unknown;
};
export type { CompatNativeStackNavigationOptions as NativeStackNavigationOptions };
type RouterLike = {
readonly push: (href: AppHref) => void;
readonly replace: (href: AppHref) => void;
readonly back: () => void;
readonly dismiss: () => void;
readonly dismissAll: () => void;
readonly canGoBack: () => boolean;
readonly setParams: (params: RouteParams) => void;
};
type NavigationContextValue = {
readonly navigationRef: React.RefObject<NavigationContainerRef<AppStackParamList> | null>;
readonly pathname: string;
readonly params: RouteParams;
readonly router: RouterLike;
};
export const AppNavigationContext = createContext<NavigationContextValue | null>(null);
export function useRouter(): RouterLike {
const context = use(AppNavigationContext);
if (context === null) {
throw new Error("useRouter must be used within AppNavigationProvider");
}
return context.router;
}
export function usePathname(): string {
const context = use(AppNavigationContext);
if (context === null) {
throw new Error("usePathname must be used within AppNavigationProvider");
}
return context.pathname;
}
export function useLocalSearchParams<T extends RouteParams = RouteParams>(): T {
const route = useRoute();
return (route.params ?? {}) as RouteParams as T;
}
export function useGlobalSearchParams<T extends RouteParams = RouteParams>(): T {
const context = use(AppNavigationContext);
if (context === null) {
throw new Error("useGlobalSearchParams must be used within AppNavigationProvider");
}
return context.params as T;
}
export function createRouter(
navigationRef: React.RefObject<NavigationContainerRef<AppStackParamList> | null>,
): RouterLike {
const navigateWithAction = (href: AppHref, action: "push" | "replace" | "navigate"): void => {
const target = resolveNavigationTarget(href);
const navigation = navigationRef.current;
if (!navigation) {
return;
}
if (action === "push") {
navigation.dispatch(StackActions.push(target.name, target.params));
return;
}
if (action === "replace") {
navigation.dispatch(StackActions.replace(target.name, target.params));
return;
}
navigation.dispatch(
CommonActions.navigate({
name: target.name,
params: target.params,
}),
);
};
return {
push: (href) => navigateWithAction(href, "push"),
replace: (href) => navigateWithAction(href, "replace"),
back: () => {
const navigation = navigationRef.current;
if (!navigation) return;
if (navigation.canGoBack()) {
navigation.goBack();
return;
}
navigation.dispatch(StackActions.replace("Home"));
},
dismiss: () => {
const navigation = navigationRef.current;
if (!navigation) return;
if (navigation.canGoBack()) {
navigation.goBack();
return;
}
navigation.dispatch(StackActions.replace("Home"));
},
dismissAll: () => {
const navigation = navigationRef.current;
if (!navigation) return;
navigation.dispatch(
CommonActions.reset({
index: 0,
routes: [{ name: "Home" }],
}),
);
},
canGoBack: () => navigationRef.current?.canGoBack() ?? false,
setParams: (params) => {
navigationRef.current?.dispatch(CommonActions.setParams(params));
},
};
}
export function deriveNavigationContextValue(input: {
readonly navigationRef: React.RefObject<NavigationContainerRef<AppStackParamList> | null>;
readonly pathname: string;
readonly params: RouteParams;
}): NavigationContextValue {
return {
navigationRef: input.navigationRef,
pathname: input.pathname,
params: input.params,
router: createRouter(input.navigationRef),
};
}
function useNativeStackNavigation(): NativeStackNavigationProp<ParamListBase> | null {
try {
return useNavigation<NativeStackNavigationProp<ParamListBase>>();
} catch {
return null;
}
}
function normalizeScreenOptions(
options: CompatNativeStackNavigationOptions | undefined,
): NativeStackNavigationOptions | undefined {
if (!options) {
return options;
}
const normalized = { ...options } as NativeStackNavigationOptions & {
unstable_navigationItemStyle?: unknown;
unstable_headerCenterItems?: unknown;
unstable_headerSubtitle?: unknown;
unstable_headerToolbarItems?: unknown;
};
delete normalized.unstable_navigationItemStyle;
delete normalized.unstable_headerCenterItems;
delete normalized.unstable_headerSubtitle;
delete normalized.unstable_headerToolbarItems;
if (normalized.headerTintColor !== undefined) {
normalized.headerTintColor = String(normalized.headerTintColor);
}
return normalized as NativeStackNavigationOptions;
}
function StackScreen(props: {
readonly options?: CompatNativeStackNavigationOptions;
readonly listeners?: Record<string, (event: never) => void>;
readonly name?: string;
}) {
const navigation = useNativeStackNavigation();
const normalizedOptions = useMemo(() => normalizeScreenOptions(props.options), [props.options]);
useEffect(() => {
if (!navigation || !normalizedOptions) {
return;
}
navigation.setOptions(normalizedOptions);
}, [navigation, normalizedOptions]);
useEffect(() => {
if (!navigation || !props.listeners) {
return;
}
const subscriptions = Object.entries(props.listeners).map(([eventName, listener]) =>
navigation.addListener(eventName as never, listener as never),
);
return () => {
for (const unsubscribe of subscriptions) {
unsubscribe();
}
};
}, [navigation, props.listeners]);
return null;
}
function labelFromChildren(children: ReactNode): string {
const parts: string[] = [];
Children.forEach(children, (child) => {
if (typeof child === "string" || typeof child === "number") {
parts.push(String(child));
} else if (isValidElement<{ children?: ReactNode }>(child)) {
parts.push(labelFromChildren(child.props.children));
}
});
return parts.join("");
}
type NativeStackHeaderIcon = NonNullable<
Extract<NativeStackHeaderItem, { type: "button" }>["icon"]
>;
function iconFromProp(icon: unknown): NativeStackHeaderIcon | undefined {
if (typeof icon !== "string") {
return undefined;
}
return { type: "sfSymbol", name: icon as never };
}
type ToolbarElementProps = Record<string, unknown> & { readonly children?: ReactNode };
function elementTypeName(element: ReactElement): string | undefined {
const type = element.type;
if (typeof type === "function") {
return (type as { displayName?: string; name?: string }).displayName ?? type.name;
}
return undefined;
}
function convertMenuAction(
element: ReactElement<ToolbarElementProps>,
): NativeStackHeaderItemMenu["menu"]["items"][number] | null {
const typeName = elementTypeName(element);
if (typeName === "ToolbarMenuAction") {
const label = labelFromChildren(element.props.children);
return {
type: "action",
label,
description: typeof element.props.subtitle === "string" ? element.props.subtitle : undefined,
disabled: Boolean(element.props.disabled),
icon: iconFromProp(element.props.icon),
onPress:
typeof element.props.onPress === "function"
? (element.props.onPress as () => void)
: () => undefined,
state: element.props.isOn === true ? "on" : undefined,
destructive: Boolean(element.props.destructive),
discoverabilityLabel:
typeof element.props.discoverabilityLabel === "string"
? element.props.discoverabilityLabel
: undefined,
};
}
if (typeName === "ToolbarMenu") {
return {
type: "submenu",
label:
typeof element.props.title === "string"
? element.props.title
: labelFromChildren(element.props.children),
icon: iconFromProp(element.props.icon),
inline: Boolean(element.props.inline),
items: collectMenuItems(element.props.children),
};
}
return null;
}
function collectMenuItems(children: ReactNode): NativeStackHeaderItemMenu["menu"]["items"] {
const items: NativeStackHeaderItemMenu["menu"]["items"] = [];
Children.forEach(children, (child) => {
if (!isValidElement<ToolbarElementProps>(child)) {
return;
}
const item = convertMenuAction(child);
if (item) {
items.push(item);
return;
}
items.push(...collectMenuItems(child.props.children));
});
return items;
}
function convertToolbarChild(child: ReactNode): NativeStackHeaderItem | null {
if (!isValidElement<ToolbarElementProps>(child)) {
return null;
}
const typeName = elementTypeName(child);
if (typeName === "ToolbarButton") {
return {
type: "button",
label: "",
accessibilityLabel:
typeof child.props.accessibilityLabel === "string"
? child.props.accessibilityLabel
: undefined,
disabled: Boolean(child.props.disabled),
icon: iconFromProp(child.props.icon),
onPress:
typeof child.props.onPress === "function"
? (child.props.onPress as () => void)
: () => undefined,
sharesBackground: !child.props.separateBackground,
variant: "prominent",
};
}
if (typeName === "ToolbarMenu") {
return {
type: "menu",
label: typeof child.props.title === "string" ? child.props.title : "",
accessibilityLabel:
typeof child.props.accessibilityLabel === "string"
? child.props.accessibilityLabel
: undefined,
disabled: Boolean(child.props.disabled),
icon: iconFromProp(child.props.icon),
menu: {
title: typeof child.props.title === "string" ? child.props.title : undefined,
items: collectMenuItems(child.props.children),
},
sharesBackground: !child.props.separateBackground,
variant: "prominent",
};
}
if (typeName === "ToolbarSpacer") {
return {
type: "spacing",
spacing: typeof child.props.width === "number" ? child.props.width : 8,
};
}
return null;
}
function collectToolbarItems(children: ReactNode): NativeStackHeaderItem[] {
const items: NativeStackHeaderItem[] = [];
Children.forEach(children, (child) => {
const item = convertToolbarChild(child);
if (item) {
items.push(item);
}
});
return items;
}
function Toolbar(props: {
readonly placement?: "left" | "right" | "bottom";
readonly children?: ReactNode;
}) {
const navigation = useNativeStackNavigation();
const items = useMemo(() => collectToolbarItems(props.children), [props.children]);
useEffect(() => {
if (!navigation || props.placement === "bottom" || items.length === 0) {
return;
}
if (props.placement === "left") {
navigation.setOptions({ unstable_headerLeftItems: () => items });
return;
}
navigation.setOptions({ unstable_headerRightItems: () => items });
}, [items, navigation, props.placement]);
return null;
}
function ToolbarButton(_props: {
readonly accessibilityLabel?: string;
readonly disabled?: boolean;
readonly icon?: string;
readonly onPress?: () => void;
readonly separateBackground?: boolean;
}) {
return null;
}
ToolbarButton.displayName = "ToolbarButton";
function ToolbarMenu(_props: {
readonly accessibilityLabel?: string;
readonly children?: ReactNode;
readonly disabled?: boolean;
readonly icon?: string;
readonly inline?: boolean;
readonly separateBackground?: boolean;
readonly title?: string;
}) {
return null;
}
ToolbarMenu.displayName = "ToolbarMenu";
function ToolbarMenuAction(_props: {
readonly children?: ReactNode;
readonly destructive?: boolean;
readonly disabled?: boolean;
readonly discoverabilityLabel?: string;
readonly icon?: string;
readonly isOn?: boolean;
readonly onPress?: () => void;
readonly subtitle?: string;
}) {
return null;
}
ToolbarMenuAction.displayName = "ToolbarMenuAction";
function ToolbarLabel(_props: { readonly children?: ReactNode }) {
return null;
}
ToolbarLabel.displayName = "ToolbarLabel";
function ToolbarSpacer(_props: { readonly sharesBackground?: boolean; readonly width?: number }) {
return null;
}
ToolbarSpacer.displayName = "ToolbarSpacer";
function ToolbarSearchBarSlot() {
return null;
}
ToolbarSearchBarSlot.displayName = "ToolbarSearchBarSlot";
function StackScreenTitle(_props: { readonly asChild?: boolean; readonly children?: ReactNode }) {
return null;
}
StackScreen.Title = StackScreenTitle;
export const Stack = Object.assign(
function StackCompat(props: { readonly children?: ReactNode }) {
return createElement(Fragment, null, props.children);
},
{
Screen: StackScreen,
Toolbar: Object.assign(Toolbar, {
Button: ToolbarButton,
Label: ToolbarLabel,
Menu: Object.assign(ToolbarMenu, {
Action: ToolbarMenuAction,
}),
MenuAction: ToolbarMenuAction,
SearchBarSlot: ToolbarSearchBarSlot,
Spacer: ToolbarSpacer,
}),
},
);
export default Stack;
export function Redirect(props: { readonly href: AppHref }) {
const router = useRouter();
useEffect(() => {
router.replace(props.href);
}, [props.href, router]);
return null;
}
export function Link(props: {
readonly href: AppHref;
readonly asChild?: boolean;
readonly children?: ReactNode;
}) {
const router = useRouter();
if (props.asChild && isValidElement<{ onPress?: () => void }>(props.children)) {
return cloneElement(props.children, {
onPress: () => router.push(props.href),
});
}
return null;
}
export function pathAndParamsFromCurrentRoute(route: {
readonly name: string;
readonly params?: object;
}): { readonly pathname: string; readonly params: RouteParams } {
return {
pathname: buildPathFromRoute(route as AppFocusedRoute),
params: (route.params ?? {}) as RouteParams,
};
}
export type Router = RouterLike;
@@ -1,4 +1,4 @@
import { Link } from "expo-router";
import { Link } from "../navigation/router";
import { Pressable, ScrollView, StyleSheet } from "react-native";
import { useResolveClassNames } from "uniwind";
@@ -1,4 +1,4 @@
import { Stack, useRouter } from "expo-router";
import { Stack, useRouter } from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import type { EnvironmentId } from "@t3tools/contracts";
import { useCallback, useState } from "react";
@@ -1,5 +1,5 @@
import { CameraView, useCameraPermissions } from "expo-camera";
import { Stack, useLocalSearchParams, useRouter } from "expo-router";
import { Stack, useLocalSearchParams, useRouter } from "../../navigation/router";
import { AsyncResult } from "effect/unstable/reactivity";
import { useCallback, useEffect, useState } from "react";
import { Alert, ScrollView, View } from "react-native";
@@ -1,4 +1,4 @@
import { Stack } from "expo-router";
import { Stack } from "../../navigation/router";
import { useEffect, useRef, useState, type ComponentProps } from "react";
import {
Platform,
@@ -1,6 +1,6 @@
import * as Arr from "effect/Array";
import * as Order from "effect/Order";
import { Stack, useRouter } from "expo-router";
import { Stack, useRouter } from "../navigation/router";
import { useMemo, useState } from "react";
import { useProjects, useThreadShells } from "../state/entities";
@@ -1,4 +1,4 @@
import { Stack, useLocalSearchParams } from "expo-router";
import { Stack, useLocalSearchParams } from "../../../navigation/router";
import { addProjectRemoteSourceLabel } from "@t3tools/client-runtime/operations/projects";
import { AddProjectRepositoryScreen } from "../../../features/projects/AddProjectScreen";
@@ -1,4 +1,4 @@
import { Stack, useLocalSearchParams } from "expo-router";
import { Stack, useLocalSearchParams } from "../../navigation/router";
import { NewTaskDraftScreen } from "../../features/threads/NewTaskDraftScreen";
@@ -1,4 +1,4 @@
import { Link, Stack, useRouter } from "expo-router";
import { Link, Stack, useRouter } from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import type { EnvironmentId, ProjectId } from "@t3tools/contracts";
import { useMemo } from "react";
@@ -1,6 +1,6 @@
import { useAuth } from "@clerk/expo";
import { AuthView, UserProfileView } from "@clerk/expo/native";
import { Redirect, Stack } from "expo-router";
import { Redirect, Stack } from "../../navigation/router";
import { View } from "react-native";
import { hasCloudPublicConfig } from "../../features/cloud/publicConfig";
@@ -1,5 +1,5 @@
import { useAuth } from "@clerk/expo";
import { Stack, useRouter } from "expo-router";
import { Stack, useRouter } from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import {
connectionStatusText,
@@ -1,6 +1,6 @@
import { useAuth, useUser } from "@clerk/expo";
import * as Notifications from "expo-notifications";
import { Link, Stack, useRouter } from "expo-router";
import { Link, Stack, useRouter } from "../../navigation/router";
import { SymbolView } from "expo-symbols";
import * as Effect from "effect/Effect";
import { useCallback, useEffect, useMemo, useState } from "react";
@@ -1,5 +1,5 @@
import { useAuth } from "@clerk/expo";
import { Redirect, Stack, useFocusEffect, useRouter } from "expo-router";
import { Redirect, Stack, useFocusEffect, useRouter } from "../../navigation/router";
import { useCallback } from "react";
import { ScrollView } from "react-native";
@@ -1,4 +1,4 @@
import { useGlobalSearchParams } from "expo-router";
import { useGlobalSearchParams } from "../navigation/router";
import { createContext, createElement, use, useMemo, useRef, type ReactNode } from "react";
import {
EnvironmentId,