Structure mobile navigation around native stack
This commit is contained in:
1 parent
f6df16ab1e
commit
ee203ed518
57 files changed
+1090
-1105
No files matched your search
+7
-503
@@ -4,513 +4,19 @@ import {
|
||||
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 { AppNavigationProvider } from "./navigation/app-navigation";
|
||||
import { RootNavigator } from "./navigation/RootNavigator";
|
||||
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,
|
||||
@@ -525,13 +31,11 @@ export default function App() {
|
||||
<KeyboardProvider statusBarTranslucent>
|
||||
<SafeAreaProvider>
|
||||
<AppNavigationProvider>
|
||||
<HardwareKeyboardCommandProvider>
|
||||
{fontsLoaded ? (
|
||||
<AppNavigator />
|
||||
) : (
|
||||
<LoadingScreen message="Loading remote workspace…" />
|
||||
)}
|
||||
</HardwareKeyboardCommandProvider>
|
||||
{fontsLoaded ? (
|
||||
<RootNavigator />
|
||||
) : (
|
||||
<LoadingScreen message="Loading remote workspace…" />
|
||||
)}
|
||||
</AppNavigationProvider>
|
||||
</SafeAreaProvider>
|
||||
</KeyboardProvider>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import * as Notifications from "expo-notifications";
|
||||
import { useRouter } from "../../navigation/router";
|
||||
import { useAppNavigation } from "../../navigation/native-stack-header";
|
||||
|
||||
import { routeAgentNotificationResponseOnce } from "./notificationPayload";
|
||||
import { consumeLastAgentNotificationResponse } from "./notificationResponseConsumer";
|
||||
|
||||
export function useAgentNotificationNavigation(): void {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const handledResponseIds = useRef(new Set<string>());
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -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 "../../navigation/router";
|
||||
import { useFocusEffect } from "../../navigation/native-stack-header";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
|
||||
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
|
||||
|
||||
@@ -4,7 +4,10 @@ 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 "../../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import { useCallback, useMemo, useRef, type ComponentProps } from "react";
|
||||
import {
|
||||
@@ -111,7 +114,7 @@ function ArchivedThreadsHeader(props: {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
title: "Archived Threads",
|
||||
headerTransparent: usesNativeChrome,
|
||||
@@ -162,16 +165,16 @@ function ArchivedThreadsHeader(props: {
|
||||
/>
|
||||
|
||||
{usesCompactMailToolbar ? null : (
|
||||
<Stack.Toolbar placement="right">
|
||||
<NativeHeaderToolbar placement="right">
|
||||
{usesNativeChrome ? (
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Refresh archived threads"
|
||||
icon="arrow.clockwise"
|
||||
onPress={props.onRefresh}
|
||||
separateBackground
|
||||
/>
|
||||
) : null}
|
||||
<Stack.Toolbar.Menu
|
||||
<NativeHeaderToolbar.Menu
|
||||
accessibilityLabel="Filter and sort archived threads"
|
||||
icon={
|
||||
hasCustomFilter
|
||||
@@ -181,42 +184,42 @@ function ArchivedThreadsHeader(props: {
|
||||
separateBackground
|
||||
title="Archived thread options"
|
||||
>
|
||||
<Stack.Toolbar.Menu title="Environment">
|
||||
<Stack.Toolbar.Label>Environment</Stack.Toolbar.Label>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Menu title="Environment">
|
||||
<NativeHeaderToolbar.Label>Environment</NativeHeaderToolbar.Label>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
isOn={props.selectedEnvironmentId === null}
|
||||
onPress={() => props.onEnvironmentChange(null)}
|
||||
>
|
||||
<Stack.Toolbar.Label>All environments</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>All environments</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
{props.environments.map((environment) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={environment.environmentId}
|
||||
isOn={props.selectedEnvironmentId === environment.environmentId}
|
||||
onPress={() => props.onEnvironmentChange(environment.environmentId)}
|
||||
>
|
||||
<Stack.Toolbar.Label>{environment.label}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>{environment.label}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
</Stack.Toolbar.Menu>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
|
||||
<Stack.Toolbar.Menu title="Sort by archived date">
|
||||
<Stack.Toolbar.Label>Sort by archived date</Stack.Toolbar.Label>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Menu title="Sort by archived date">
|
||||
<NativeHeaderToolbar.Label>Sort by archived date</NativeHeaderToolbar.Label>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
isOn={props.sortOrder === "newest"}
|
||||
onPress={() => props.onSortOrderChange("newest")}
|
||||
>
|
||||
<Stack.Toolbar.Label>Newest first</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Label>Newest first</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
isOn={props.sortOrder === "oldest"}
|
||||
onPress={() => props.onSortOrderChange("oldest")}
|
||||
>
|
||||
<Stack.Toolbar.Label>Oldest first</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
</Stack.Toolbar.Menu>
|
||||
</Stack.Toolbar.Menu>
|
||||
</Stack.Toolbar>
|
||||
<NativeHeaderToolbar.Label>Oldest first</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
</NativeHeaderToolbar>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import Stack from "../../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import { useLocalSearchParams, useRouter } from "../../navigation/router";
|
||||
import { useRouteParams, useAppNavigation } from "../../navigation/native-stack-header";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
ActivityIndicator,
|
||||
@@ -355,7 +358,7 @@ function FileContent(props: {
|
||||
}
|
||||
|
||||
function useThreadFilesWorkspace() {
|
||||
const params = useLocalSearchParams<{
|
||||
const params = useRouteParams<{
|
||||
environmentId?: string | string[];
|
||||
threadId?: string | string[];
|
||||
}>();
|
||||
@@ -385,7 +388,7 @@ function useThreadFilesWorkspace() {
|
||||
function FilesUnavailable() {
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center bg-sheet px-6">
|
||||
<Stack.Screen options={{ title: "Files" }} />
|
||||
<NativeStackScreenOptions options={{ title: "Files" }} />
|
||||
<EmptyState
|
||||
title="Files unavailable"
|
||||
detail="This thread does not have an active workspace path."
|
||||
@@ -465,7 +468,7 @@ function FilesToolbarBottomFade() {
|
||||
|
||||
export function ThreadFilesTreeScreen() {
|
||||
useAdaptiveWorkspacePaneRole("inspector");
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const { fileInspector, layout, panes, showAuxiliaryPane, togglePrimarySidebar } =
|
||||
useAdaptiveWorkspaceLayout();
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
@@ -577,7 +580,7 @@ export function ThreadFilesTreeScreen() {
|
||||
|
||||
return (
|
||||
<View className="flex-1 bg-sheet">
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
title: "Files",
|
||||
headerShown: true,
|
||||
@@ -616,8 +619,8 @@ export function ThreadFilesTreeScreen() {
|
||||
}}
|
||||
/>
|
||||
{layout.usesSplitView ? (
|
||||
<Stack.Toolbar placement="left">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="left">
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel={panes.primarySidebarVisible ? "Maximize files" : "Show threads"}
|
||||
icon={
|
||||
panes.primarySidebarVisible ? "arrow.up.left.and.arrow.down.right" : "sidebar.left"
|
||||
@@ -625,21 +628,21 @@ export function ThreadFilesTreeScreen() {
|
||||
onPress={togglePrimarySidebar}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
) : null}
|
||||
{!usesCompactMailToolbar ? (
|
||||
<Stack.Toolbar placement="right">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="right">
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Refresh files"
|
||||
icon="arrow.clockwise"
|
||||
onPress={entriesQuery.refresh}
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
) : null}
|
||||
{usesCompactMailToolbar ? null : (
|
||||
<Stack.Toolbar placement="bottom">
|
||||
<Stack.Toolbar.SearchBarSlot />
|
||||
</Stack.Toolbar>
|
||||
<NativeHeaderToolbar placement="bottom">
|
||||
<NativeHeaderToolbar.SearchBarSlot />
|
||||
</NativeHeaderToolbar>
|
||||
)}
|
||||
<FileTreeBrowser
|
||||
entries={entriesData?.entries ?? []}
|
||||
@@ -658,10 +661,10 @@ export function ThreadFilesTreeScreen() {
|
||||
|
||||
export function ThreadFileScreen() {
|
||||
useAdaptiveWorkspacePaneRole("inspector");
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const { fileInspector, panes, toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
|
||||
const iconColor = useThemeColor("--color-icon");
|
||||
const params = useLocalSearchParams<{
|
||||
const params = useRouteParams<{
|
||||
line?: string | string[];
|
||||
path?: string | string[];
|
||||
}>();
|
||||
@@ -744,7 +747,7 @@ export function ThreadFileScreen() {
|
||||
if (relativePath === null) {
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center bg-sheet px-6">
|
||||
<Stack.Screen options={{ title: "Files" }} />
|
||||
<NativeStackScreenOptions options={{ title: "Files" }} />
|
||||
<EmptyState title="File unavailable" detail="This file path is invalid." />
|
||||
</View>
|
||||
);
|
||||
@@ -753,7 +756,7 @@ export function ThreadFileScreen() {
|
||||
return (
|
||||
<ReviewHighlighterProvider>
|
||||
<View className="flex-1 bg-sheet">
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
headerTitle: basename(relativePath),
|
||||
headerTransparent: true,
|
||||
@@ -767,7 +770,7 @@ export function ThreadFileScreen() {
|
||||
/>
|
||||
<WorkspaceSidebarToolbar>
|
||||
{fileInspector.supported ? (
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Return to chat"
|
||||
icon="chevron.left"
|
||||
onPress={() => {
|
||||
@@ -776,9 +779,9 @@ export function ThreadFileScreen() {
|
||||
/>
|
||||
) : null}
|
||||
</WorkspaceSidebarToolbar>
|
||||
<Stack.Toolbar placement="right">
|
||||
<NativeHeaderToolbar placement="right">
|
||||
{fileInspector.supported ? (
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel={
|
||||
panes.auxiliaryPaneVisible ? "Hide file navigator" : "Show file navigator"
|
||||
}
|
||||
@@ -787,7 +790,7 @@ export function ThreadFileScreen() {
|
||||
separateBackground
|
||||
/>
|
||||
) : null}
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Refresh file"
|
||||
icon="arrow.clockwise"
|
||||
onPress={() => {
|
||||
@@ -798,7 +801,7 @@ export function ThreadFileScreen() {
|
||||
fileQuery.refresh();
|
||||
}}
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
<AdaptiveInspectorLayout
|
||||
renderInspector={fileInspector.supported ? () => renderInspector(0) : undefined}
|
||||
>
|
||||
|
||||
@@ -3,7 +3,10 @@ import type {
|
||||
SidebarProjectGroupingMode,
|
||||
SidebarThreadSortOrder,
|
||||
} from "@t3tools/contracts";
|
||||
import { Stack } from "../../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { useCallback, useRef } from "react";
|
||||
import { Platform } from "react-native";
|
||||
import type { SearchBarCommands } from "react-native-screens";
|
||||
@@ -54,7 +57,7 @@ export function HomeHeader(props: {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
headerShown: true,
|
||||
headerTransparent: true,
|
||||
@@ -121,19 +124,19 @@ export function HomeHeader(props: {
|
||||
/>
|
||||
|
||||
{Platform.OS === "ios" ? null : (
|
||||
<Stack.Toolbar placement="right">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="right">
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Open settings"
|
||||
icon="gearshape"
|
||||
onPress={props.onOpenSettings}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
)}
|
||||
|
||||
{Platform.OS === "ios" ? null : (
|
||||
<Stack.Toolbar placement="bottom">
|
||||
<Stack.Toolbar.Menu
|
||||
<NativeHeaderToolbar placement="bottom">
|
||||
<NativeHeaderToolbar.Menu
|
||||
accessibilityLabel="Filter and sort threads"
|
||||
icon={
|
||||
hasCustomListOptions
|
||||
@@ -143,80 +146,80 @@ export function HomeHeader(props: {
|
||||
title="Thread list options"
|
||||
separateBackground
|
||||
>
|
||||
<Stack.Toolbar.MenuAction onPress={props.onOpenSettings}>
|
||||
<Stack.Toolbar.Label>Settings</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction onPress={props.onOpenSettings}>
|
||||
<NativeHeaderToolbar.Label>Settings</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
|
||||
<Stack.Toolbar.Menu title="Environment">
|
||||
<Stack.Toolbar.Label>Environment</Stack.Toolbar.Label>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Menu title="Environment">
|
||||
<NativeHeaderToolbar.Label>Environment</NativeHeaderToolbar.Label>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
isOn={props.selectedEnvironmentId === null}
|
||||
onPress={() => props.onEnvironmentChange(null)}
|
||||
subtitle="Show threads from every environment"
|
||||
>
|
||||
<Stack.Toolbar.Label>All environments</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>All environments</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
{props.environments.map((environment) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={environment.environmentId}
|
||||
isOn={props.selectedEnvironmentId === environment.environmentId}
|
||||
onPress={() => props.onEnvironmentChange(environment.environmentId)}
|
||||
>
|
||||
<Stack.Toolbar.Label>{environment.label}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>{environment.label}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
</Stack.Toolbar.Menu>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
|
||||
<Stack.Toolbar.Menu title="Sort projects">
|
||||
<Stack.Toolbar.Label>Sort projects</Stack.Toolbar.Label>
|
||||
<NativeHeaderToolbar.Menu title="Sort projects">
|
||||
<NativeHeaderToolbar.Label>Sort projects</NativeHeaderToolbar.Label>
|
||||
{PROJECT_SORT_OPTIONS.map((option) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={option.value}
|
||||
isOn={props.projectSortOrder === option.value}
|
||||
onPress={() => props.onProjectSortOrderChange(option.value)}
|
||||
>
|
||||
<Stack.Toolbar.Label>{option.label}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>{option.label}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
</Stack.Toolbar.Menu>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
|
||||
<Stack.Toolbar.Menu title="Sort threads">
|
||||
<Stack.Toolbar.Label>Sort threads</Stack.Toolbar.Label>
|
||||
<NativeHeaderToolbar.Menu title="Sort threads">
|
||||
<NativeHeaderToolbar.Label>Sort threads</NativeHeaderToolbar.Label>
|
||||
{THREAD_SORT_OPTIONS.map((option) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={option.value}
|
||||
isOn={props.threadSortOrder === option.value}
|
||||
onPress={() => props.onThreadSortOrderChange(option.value)}
|
||||
>
|
||||
<Stack.Toolbar.Label>{option.label}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>{option.label}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
</Stack.Toolbar.Menu>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
|
||||
<Stack.Toolbar.Menu title="Group projects">
|
||||
<Stack.Toolbar.Label>Group projects</Stack.Toolbar.Label>
|
||||
<NativeHeaderToolbar.Menu title="Group projects">
|
||||
<NativeHeaderToolbar.Label>Group projects</NativeHeaderToolbar.Label>
|
||||
{PROJECT_GROUPING_OPTIONS.map((option) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={option.value}
|
||||
isOn={props.projectGroupingMode === option.value}
|
||||
onPress={() => props.onProjectGroupingModeChange(option.value)}
|
||||
subtitle={option.subtitle}
|
||||
>
|
||||
<Stack.Toolbar.Label>{option.label}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>{option.label}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
</Stack.Toolbar.Menu>
|
||||
</Stack.Toolbar.Menu>
|
||||
<Stack.Toolbar.Spacer width={8} sharesBackground={false} />
|
||||
<Stack.Toolbar.SearchBarSlot />
|
||||
<Stack.Toolbar.Spacer width={8} sharesBackground={false} />
|
||||
<Stack.Toolbar.Button
|
||||
</NativeHeaderToolbar.Menu>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
<NativeHeaderToolbar.Spacer width={8} sharesBackground={false} />
|
||||
<NativeHeaderToolbar.SearchBarSlot />
|
||||
<NativeHeaderToolbar.Spacer width={8} sharesBackground={false} />
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="New task"
|
||||
icon="square.and.pencil"
|
||||
onPress={props.onStartNewTask}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { usePathname, useRouter } from "../../navigation/router";
|
||||
import { useCurrentPathname, useAppNavigation } from "../../navigation/native-stack-header";
|
||||
import { useCallback, useMemo, useSyncExternalStore, type PropsWithChildren } from "react";
|
||||
|
||||
import {
|
||||
@@ -18,8 +18,8 @@ import {
|
||||
} from "./hardwareKeyboardCommands";
|
||||
|
||||
export function HardwareKeyboardCommandProvider({ children }: PropsWithChildren) {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const pathname = useCurrentPathname();
|
||||
const router = useAppNavigation();
|
||||
const registrationVersion = useSyncExternalStore(
|
||||
subscribeToHardwareKeyboardCommandRegistrations,
|
||||
getHardwareKeyboardCommandRegistrationVersion,
|
||||
|
||||
@@ -2,10 +2,10 @@ import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell
|
||||
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
import {
|
||||
useFocusEffect,
|
||||
useGlobalSearchParams,
|
||||
usePathname,
|
||||
useRouter,
|
||||
} from "../../navigation/router";
|
||||
useCurrentRouteParams,
|
||||
useCurrentPathname,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import {
|
||||
createContext,
|
||||
use,
|
||||
@@ -99,8 +99,8 @@ export function useAdaptiveWorkspacePaneRole(role: WorkspaceAuxiliaryPaneRole) {
|
||||
|
||||
export function AdaptiveWorkspaceLayout(props: { readonly children: ReactNode }) {
|
||||
const { width, height } = useWindowDimensions();
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const pathname = useCurrentPathname();
|
||||
const router = useAppNavigation();
|
||||
const activeRoleOwner = useRef<symbol | null>(null);
|
||||
const [primarySidebarPreferredVisible, setPrimarySidebarPreferredVisible] = useState(true);
|
||||
const [supplementaryPanePreferredVisible, setSupplementaryPanePreferredVisible] = useState(true);
|
||||
@@ -114,7 +114,7 @@ export function AdaptiveWorkspaceLayout(props: { readonly children: ReactNode })
|
||||
const [primarySidebarSearchQuery, setPrimarySidebarSearchQuery] = useState("");
|
||||
const [focusedAuxiliaryPaneRole, setFocusedAuxiliaryPaneRole] =
|
||||
useState<WorkspaceAuxiliaryPaneRole | null>(null);
|
||||
const params = useGlobalSearchParams<{
|
||||
const params = useCurrentRouteParams<{
|
||||
environmentId?: string | string[];
|
||||
threadId?: string | string[];
|
||||
}>();
|
||||
|
||||
@@ -9,7 +9,7 @@ type NativeGlassHeaderItem = {
|
||||
/**
|
||||
* iOS 26/27 Mail-style header controls need the native glass button
|
||||
* configuration when they are not part of a larger toolbar. Keep this
|
||||
* centralized so Expo Router screens and plain react-native-screens demos
|
||||
* centralized so native-stack screens and plain react-native-screens demos
|
||||
* don't drift apart.
|
||||
*/
|
||||
export function withNativeGlassHeaderItem<T extends NativeGlassHeaderItem>(
|
||||
|
||||
@@ -10,7 +10,8 @@ type NativeMailSearchToolbarInput = Omit<
|
||||
*
|
||||
* Keeping this behind an app-level helper makes the iOS-only RNS patch an
|
||||
* explicit layout primitive instead of a per-screen object literal. Android can
|
||||
* keep using Expo Router toolbar primitives without depending on this helper.
|
||||
* keep using platform-specific header/search primitives without depending on
|
||||
* this helper.
|
||||
*/
|
||||
export function createNativeMailSearchToolbarItem(
|
||||
input: NativeMailSearchToolbarInput,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Stack } from "../../navigation/router";
|
||||
import { NativeHeaderToolbar } from "../../navigation/native-stack-header";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { useAdaptiveWorkspaceLayout } from "./AdaptiveWorkspaceLayout";
|
||||
@@ -16,9 +16,9 @@ export function WorkspaceSidebarToolbar(
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack.Toolbar placement="left">
|
||||
<NativeHeaderToolbar placement="left">
|
||||
{props.children}
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel={
|
||||
panes.primarySidebarVisible ? "Maximize content" : "Show thread sidebar"
|
||||
}
|
||||
@@ -26,6 +26,6 @@ export function WorkspaceSidebarToolbar(
|
||||
onPress={togglePrimarySidebar}
|
||||
/>
|
||||
{props.afterSidebarButton}
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
isFilesystemBrowseQuery,
|
||||
} from "@t3tools/client-runtime/state/projects";
|
||||
import { CommandId, type EnvironmentId, ProjectId } from "@t3tools/contracts";
|
||||
import { useLocalSearchParams, useRouter } from "../../navigation/router";
|
||||
import { useRouteParams, useAppNavigation } from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react";
|
||||
import { ActivityIndicator, Alert, Pressable, ScrollView, View } from "react-native";
|
||||
@@ -250,8 +250,8 @@ function useSelectedEnvironment(): {
|
||||
readonly selectedEnvironment: EnvironmentOption | null;
|
||||
readonly setSelectedEnvironmentId: (environmentId: EnvironmentId) => void;
|
||||
} {
|
||||
const router = useRouter();
|
||||
const params = useLocalSearchParams<{ environmentId?: string }>();
|
||||
const router = useAppNavigation();
|
||||
const params = useRouteParams<{ environmentId?: string }>();
|
||||
const environmentOptions = useEnvironmentOptions();
|
||||
const requestedEnvironmentId = stringParam(params.environmentId) as EnvironmentId | null;
|
||||
const selectedEnvironment =
|
||||
@@ -269,7 +269,7 @@ function useSelectedEnvironment(): {
|
||||
}
|
||||
|
||||
function EmptyEnvironmentState() {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
|
||||
return (
|
||||
<View className="items-center gap-3 rounded-2xl bg-card px-5 py-8">
|
||||
@@ -294,7 +294,7 @@ function SourceControlRow(props: {
|
||||
readonly hint: string;
|
||||
readonly isFirst: boolean;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const iconColor = useThemeColor("--color-icon");
|
||||
const title =
|
||||
props.source === "url" ? "Git URL" : `${addProjectRemoteSourceLabel(props.source)} repository`;
|
||||
@@ -323,7 +323,7 @@ function SourceControlRow(props: {
|
||||
isFirst={props.isFirst}
|
||||
onPress={() =>
|
||||
router.push({
|
||||
pathname: "/new/add-project/repository",
|
||||
name: "AddProjectRepository",
|
||||
params: {
|
||||
environmentId: props.selectedEnvironmentId,
|
||||
source: props.source,
|
||||
@@ -335,7 +335,7 @@ function SourceControlRow(props: {
|
||||
}
|
||||
|
||||
export function AddProjectSourceScreen() {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const accentColor = useThemeColor("--color-icon-muted");
|
||||
const iconColor = useThemeColor("--color-icon");
|
||||
const { environmentOptions, selectedEnvironment, setSelectedEnvironmentId } =
|
||||
@@ -410,7 +410,7 @@ export function AddProjectSourceScreen() {
|
||||
isFirst
|
||||
onPress={() =>
|
||||
router.push({
|
||||
pathname: "/new/add-project/local",
|
||||
name: "AddProjectLocal",
|
||||
params: { environmentId: selectedEnvironment.environmentId },
|
||||
})
|
||||
}
|
||||
@@ -440,7 +440,7 @@ export function AddProjectSourceScreen() {
|
||||
}
|
||||
|
||||
function useCreateProject(environment: EnvironmentOption | null) {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const createProject = useAtomCommand(projectEnvironment.create, { reportFailure: false });
|
||||
const projects = useProjects();
|
||||
|
||||
@@ -456,7 +456,7 @@ function useCreateProject(environment: EnvironmentOption | null) {
|
||||
if (existing) {
|
||||
Alert.alert("Project already exists", existing.title);
|
||||
router.replace({
|
||||
pathname: "/new/draft",
|
||||
name: "NewTaskDraft",
|
||||
params: {
|
||||
environmentId: existing.environmentId,
|
||||
projectId: existing.id,
|
||||
@@ -481,7 +481,7 @@ function useCreateProject(environment: EnvironmentOption | null) {
|
||||
return result;
|
||||
}
|
||||
router.replace({
|
||||
pathname: "/new/draft",
|
||||
name: "NewTaskDraft",
|
||||
params: {
|
||||
environmentId: environment.environmentId,
|
||||
projectId,
|
||||
@@ -495,7 +495,7 @@ function useCreateProject(environment: EnvironmentOption | null) {
|
||||
}
|
||||
|
||||
function useEnvironmentFromParam(): EnvironmentOption | null {
|
||||
const params = useLocalSearchParams<{ environmentId?: string }>();
|
||||
const params = useRouteParams<{ environmentId?: string }>();
|
||||
const environmentOptions = useEnvironmentOptions();
|
||||
const environmentId = stringParam(params.environmentId) as EnvironmentId | null;
|
||||
return (
|
||||
@@ -509,8 +509,8 @@ export function AddProjectRepositoryScreen() {
|
||||
const lookupRepositoryQuery = useAtomQueryRunner(sourceControlEnvironment.repository, {
|
||||
reportFailure: false,
|
||||
});
|
||||
const router = useRouter();
|
||||
const params = useLocalSearchParams<{ environmentId?: string; source?: string }>();
|
||||
const router = useAppNavigation();
|
||||
const params = useRouteParams<{ environmentId?: string; source?: string }>();
|
||||
const environment = useEnvironmentFromParam();
|
||||
const source = sourceFromParam(params.source);
|
||||
const [repositoryInput, setRepositoryInput] = useState("");
|
||||
@@ -525,7 +525,7 @@ export function AddProjectRepositoryScreen() {
|
||||
if (!provider) {
|
||||
const remoteUrl = repositoryInput.trim();
|
||||
router.push({
|
||||
pathname: "/new/add-project/destination",
|
||||
name: "AddProjectDestination",
|
||||
params: {
|
||||
environmentId: environment.environmentId,
|
||||
source,
|
||||
@@ -549,7 +549,7 @@ export function AddProjectRepositoryScreen() {
|
||||
} else {
|
||||
const repository = result.value;
|
||||
router.push({
|
||||
pathname: "/new/add-project/destination",
|
||||
name: "AddProjectDestination",
|
||||
params: {
|
||||
environmentId: environment.environmentId,
|
||||
source,
|
||||
@@ -749,7 +749,7 @@ export function AddProjectDestinationScreen() {
|
||||
const cloneRepository = useAtomCommand(sourceControlEnvironment.cloneRepository, {
|
||||
reportFailure: false,
|
||||
});
|
||||
const params = useLocalSearchParams<{
|
||||
const params = useRouteParams<{
|
||||
environmentId?: string;
|
||||
remoteUrl?: string;
|
||||
repositoryTitle?: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useLocalSearchParams, useRouter } from "../../navigation/router";
|
||||
import { useRouteParams, useAppNavigation } from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import { TextInputWrapper } from "expo-paste-input";
|
||||
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
@@ -41,13 +41,13 @@ import {
|
||||
const REVIEW_COMMENT_PREVIEW_MAX_LINES = 5;
|
||||
|
||||
export function ReviewCommentComposerSheet() {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const { width } = useWindowDimensions();
|
||||
const colorScheme = useColorScheme();
|
||||
const iconTint = String(useThemeColor("--color-icon"));
|
||||
const target = useReviewCommentTarget();
|
||||
const { environmentId, threadId } = useLocalSearchParams<{
|
||||
const { environmentId, threadId } = useRouteParams<{
|
||||
environmentId: EnvironmentId;
|
||||
threadId: ThreadId;
|
||||
}>();
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
import { useLocalSearchParams } from "../../navigation/router";
|
||||
import { useRouteParams } from "../../navigation/native-stack-header";
|
||||
import { useHeaderHeight } from "@react-navigation/elements";
|
||||
import Stack from "../../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import {
|
||||
memo,
|
||||
@@ -395,7 +398,7 @@ export function ReviewSheet() {
|
||||
const headerForeground = String(useThemeColor("--color-foreground"));
|
||||
const headerMuted = String(useThemeColor("--color-foreground-muted"));
|
||||
const headerIcon = String(useThemeColor("--color-icon"));
|
||||
const { environmentId, threadId } = useLocalSearchParams<{
|
||||
const { environmentId, threadId } = useRouteParams<{
|
||||
environmentId: EnvironmentId;
|
||||
threadId: ThreadId;
|
||||
}>();
|
||||
@@ -584,7 +587,7 @@ export function ReviewSheet() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
headerTransparent: true,
|
||||
headerShadowVisible: false,
|
||||
@@ -599,8 +602,8 @@ export function ReviewSheet() {
|
||||
/>
|
||||
|
||||
{layout.usesSplitView ? (
|
||||
<Stack.Toolbar placement="left">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="left">
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel={panes.primarySidebarVisible ? "Maximize review" : "Show threads"}
|
||||
icon={
|
||||
panes.primarySidebarVisible ? "arrow.up.left.and.arrow.down.right" : "sidebar.left"
|
||||
@@ -608,13 +611,13 @@ export function ReviewSheet() {
|
||||
onPress={togglePrimarySidebar}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
) : null}
|
||||
|
||||
{showSectionToolbar || panes.supportsAuxiliaryPane ? (
|
||||
<Stack.Toolbar placement="right">
|
||||
<NativeHeaderToolbar placement="right">
|
||||
{panes.supportsAuxiliaryPane ? (
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel={
|
||||
panes.auxiliaryPaneVisible ? "Hide changed files" : "Show changed files"
|
||||
}
|
||||
@@ -624,9 +627,9 @@ export function ReviewSheet() {
|
||||
/>
|
||||
) : null}
|
||||
{showSectionToolbar ? (
|
||||
<Stack.Toolbar.Menu icon="ellipsis.circle" title="Select diff" separateBackground>
|
||||
<Stack.Toolbar.Menu inline>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Menu icon="ellipsis.circle" title="Select diff" separateBackground>
|
||||
<NativeHeaderToolbar.Menu inline>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
disabled={sectionMenu.workingTree === null}
|
||||
isOn={selectedSection?.id === sectionMenu.workingTree?.id}
|
||||
onPress={() => {
|
||||
@@ -635,9 +638,9 @@ export function ReviewSheet() {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Stack.Toolbar.Label>Working tree</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Label>Working tree</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
disabled={sectionMenu.branchChanges === null}
|
||||
isOn={selectedSection?.id === sectionMenu.branchChanges?.id}
|
||||
onPress={() => {
|
||||
@@ -646,9 +649,9 @@ export function ReviewSheet() {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Stack.Toolbar.Label>Branch changes</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Label>Branch changes</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
disabled={sectionMenu.latestTurn === null}
|
||||
isOn={selectedSection?.id === sectionMenu.latestTurn?.id}
|
||||
onPress={() => {
|
||||
@@ -657,24 +660,24 @@ export function ReviewSheet() {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Stack.Toolbar.Label>Latest turn</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>Latest turn</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
{sectionMenu.turns.length > 0 ? (
|
||||
<Stack.Toolbar.Menu title="Turn">
|
||||
<NativeHeaderToolbar.Menu title="Turn">
|
||||
{sectionMenu.turns.map((section) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={section.id}
|
||||
isOn={section.id === selectedSection?.id}
|
||||
onPress={() => selectSection(section.id)}
|
||||
subtitle={section.subtitle ?? undefined}
|
||||
>
|
||||
<Stack.Toolbar.Label>{section.title}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>{section.title}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
</Stack.Toolbar.Menu>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
) : null}
|
||||
</Stack.Toolbar.Menu>
|
||||
<Stack.Toolbar.MenuAction
|
||||
</NativeHeaderToolbar.Menu>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon="arrow.clockwise"
|
||||
disabled={
|
||||
loadingGitDiffs ||
|
||||
@@ -683,11 +686,11 @@ export function ReviewSheet() {
|
||||
onPress={() => void refreshSelectedSection()}
|
||||
subtitle="Reload current diff"
|
||||
>
|
||||
<Stack.Toolbar.Label>Refresh</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
</Stack.Toolbar.Menu>
|
||||
<NativeHeaderToolbar.Label>Refresh</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
) : null}
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
) : null}
|
||||
|
||||
<View className="flex-1 bg-sheet">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import type { NativeSyntheticEvent } from "react-native";
|
||||
import { useRouter } from "../../navigation/router";
|
||||
import { useAppNavigation } from "../../navigation/native-stack-header";
|
||||
import * as Arr from "effect/Array";
|
||||
import { pipe } from "effect/Function";
|
||||
import * as Result from "effect/Result";
|
||||
@@ -34,7 +34,7 @@ export function useReviewCommentSelectionController(input: {
|
||||
readonly nativeReviewDiffData: NativeReviewDiffData;
|
||||
}) {
|
||||
const { environmentId, nativeReviewDiffData, selectedSection, threadId } = input;
|
||||
const { push } = useRouter();
|
||||
const { push } = useAppNavigation();
|
||||
const activeCommentTarget = useReviewCommentTarget();
|
||||
const [pendingNativeCommentSelection, setPendingNativeCommentSelection] =
|
||||
useState<PendingNativeCommentSelection | null>(null);
|
||||
@@ -45,7 +45,7 @@ export function useReviewCommentSelectionController(input: {
|
||||
}
|
||||
|
||||
push({
|
||||
pathname: "/threads/[environmentId]/[threadId]/review-comment",
|
||||
name: "ThreadReviewComment",
|
||||
params: { environmentId, threadId },
|
||||
});
|
||||
}, [environmentId, push, threadId]);
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
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 "../../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
useRouteParams,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Platform, Pressable, Text as RNText, View, useColorScheme } from "react-native";
|
||||
import {
|
||||
@@ -198,7 +203,7 @@ function pickRunningTerminalSessionForBootstrap(
|
||||
}
|
||||
|
||||
export function ThreadTerminalRouteScreen() {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const writeTerminal = useAtomCommand(terminalEnvironment.write, "terminal write");
|
||||
const resizeTerminal = useAtomCommand(terminalEnvironment.resize, "terminal resize");
|
||||
const clearTerminal = useAtomCommand(terminalEnvironment.clear, "terminal clear");
|
||||
@@ -206,7 +211,7 @@ export function ThreadTerminalRouteScreen() {
|
||||
const appearanceScheme = useColorScheme() === "light" ? "light" : "dark";
|
||||
const { state: workspaceState } = useWorkspaceState();
|
||||
const { layout, panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
|
||||
const params = useLocalSearchParams<{
|
||||
const params = useRouteParams<{
|
||||
environmentId?: string | string[];
|
||||
threadId?: string | string[];
|
||||
terminalId?: string | string[];
|
||||
@@ -960,7 +965,7 @@ export function ThreadTerminalRouteScreen() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
headerShown: true,
|
||||
headerBackButtonDisplayMode: "minimal",
|
||||
@@ -986,8 +991,8 @@ export function ThreadTerminalRouteScreen() {
|
||||
/>
|
||||
|
||||
{layout.usesSplitView ? (
|
||||
<Stack.Toolbar placement="left">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="left">
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel={panes.primarySidebarVisible ? "Maximize terminal" : "Show threads"}
|
||||
icon={
|
||||
panes.primarySidebarVisible ? "arrow.up.left.and.arrow.down.right" : "sidebar.left"
|
||||
@@ -995,37 +1000,37 @@ export function ThreadTerminalRouteScreen() {
|
||||
onPress={togglePrimarySidebar}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
) : null}
|
||||
|
||||
{isEnvironmentReady ? (
|
||||
<Stack.Toolbar placement="right">
|
||||
<Stack.Toolbar.Menu icon="terminal" title="Terminal options" separateBackground>
|
||||
<Stack.Toolbar.Label>
|
||||
<NativeHeaderToolbar placement="right">
|
||||
<NativeHeaderToolbar.Menu icon="terminal" title="Terminal options" separateBackground>
|
||||
<NativeHeaderToolbar.Label>
|
||||
{getTerminalStatusLabel({
|
||||
status: terminal.status,
|
||||
hasRunningSubprocess: terminal.hasRunningSubprocess,
|
||||
})}
|
||||
</Stack.Toolbar.Label>
|
||||
<Stack.Toolbar.Menu icon="textformat.size" inline title="Text size">
|
||||
<Stack.Toolbar.Label>Text size</Stack.Toolbar.Label>
|
||||
<Stack.Toolbar.MenuAction
|
||||
</NativeHeaderToolbar.Label>
|
||||
<NativeHeaderToolbar.Menu icon="textformat.size" inline title="Text size">
|
||||
<NativeHeaderToolbar.Label>Text size</NativeHeaderToolbar.Label>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
disabled={fontSize <= MIN_TERMINAL_FONT_SIZE}
|
||||
discoverabilityLabel="Decrease terminal text size"
|
||||
onPress={handleDecreaseFontSize}
|
||||
>
|
||||
<Stack.Toolbar.Label>{`A- ${Math.max(MIN_TERMINAL_FONT_SIZE, fontSize - TERMINAL_FONT_SIZE_STEP).toFixed(1)} pt`}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Label>{`A- ${Math.max(MIN_TERMINAL_FONT_SIZE, fontSize - TERMINAL_FONT_SIZE_STEP).toFixed(1)} pt`}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
disabled={fontSize >= MAX_TERMINAL_FONT_SIZE}
|
||||
discoverabilityLabel="Increase terminal text size"
|
||||
onPress={handleIncreaseFontSize}
|
||||
>
|
||||
<Stack.Toolbar.Label>{`A+ ${Math.min(MAX_TERMINAL_FONT_SIZE, fontSize + TERMINAL_FONT_SIZE_STEP).toFixed(1)} pt`}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
</Stack.Toolbar.Menu>
|
||||
<NativeHeaderToolbar.Label>{`A+ ${Math.min(MAX_TERMINAL_FONT_SIZE, fontSize + TERMINAL_FONT_SIZE_STEP).toFixed(1)} pt`}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
{terminalMenuSessions.map((session) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={session.terminalId}
|
||||
icon={session.terminalId === terminalId ? "checkmark" : "terminal"}
|
||||
onPress={() => handleSelectTerminal(session.terminalId)}
|
||||
@@ -1036,18 +1041,18 @@ export function ThreadTerminalRouteScreen() {
|
||||
.filter(Boolean)
|
||||
.join(" · ")}
|
||||
>
|
||||
<Stack.Toolbar.Label>{session.displayLabel}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>{session.displayLabel}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon="plus"
|
||||
onPress={handleOpenNewTerminal}
|
||||
subtitle={`Start another shell in ${basename(selectedThreadProject.workspaceRoot) ?? "this workspace"}`}
|
||||
>
|
||||
<Stack.Toolbar.Label>Open new terminal</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
</Stack.Toolbar.Menu>
|
||||
</Stack.Toolbar>
|
||||
<NativeHeaderToolbar.Label>Open new terminal</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
</NativeHeaderToolbar>
|
||||
) : null}
|
||||
|
||||
<View style={{ flex: 1, backgroundColor: terminalTheme.background }}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Stack, useRouter } from "../../navigation/router";
|
||||
import { NativeStackScreenOptions, useAppNavigation } from "../../navigation/native-stack-header";
|
||||
import { useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { Alert, InteractionManager, View, useColorScheme } from "react-native";
|
||||
import { KeyboardAvoidingView, useKeyboardState } from "react-native-keyboard-controller";
|
||||
@@ -58,7 +58,7 @@ export function NewTaskDraftScreen(props: {
|
||||
const projects = useProjects();
|
||||
const createProjectThread = useCreateProjectThread();
|
||||
const flow = useNewTaskFlow();
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const colorScheme = useColorScheme();
|
||||
const isKeyboardVisible = useKeyboardState((state) => state.isVisible);
|
||||
@@ -435,14 +435,14 @@ export function NewTaskDraftScreen(props: {
|
||||
if (!selectedProject) {
|
||||
return (
|
||||
<View className="flex-1 bg-sheet">
|
||||
<Stack.Screen options={{ title: "Loading task" }} />
|
||||
<NativeStackScreenOptions options={{ title: "Loading task" }} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="flex-1 bg-sheet">
|
||||
<Stack.Screen options={{ title: selectedProject.title }} />
|
||||
<NativeStackScreenOptions options={{ title: selectedProject.title }} />
|
||||
|
||||
<KeyboardAvoidingView automaticOffset behavior="padding" style={{ flex: 1 }}>
|
||||
<View style={{ flex: 1, minHeight: 0, paddingHorizontal: 20, paddingTop: 8 }}>
|
||||
|
||||
@@ -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 "../../navigation/router";
|
||||
import { useAppNavigation } from "../../navigation/native-stack-header";
|
||||
import {
|
||||
memo,
|
||||
useCallback,
|
||||
@@ -1125,7 +1125,7 @@ function ThreadFeedPlaceholder(props: {
|
||||
}
|
||||
|
||||
export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const copyFeedbackTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const foldSettleFrameRef = useRef<number | null>(null);
|
||||
const foldSettleSecondFrameRef = useRef<number | null>(null);
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
requiresDefaultBranchConfirmation,
|
||||
resolveQuickAction,
|
||||
} from "@t3tools/client-runtime/state/vcs";
|
||||
import { useLocalSearchParams, useRouter } from "../../navigation/router";
|
||||
import Stack from "../../navigation/router";
|
||||
import { useRouteParams, useAppNavigation } from "../../navigation/native-stack-header";
|
||||
import { NativeHeaderToolbar } from "../../navigation/native-stack-header";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { Alert } from "react-native";
|
||||
import { buildThreadFilesNavigation, buildThreadReviewRoutePath } from "../../lib/routes";
|
||||
@@ -102,8 +102,8 @@ type ThreadGitControlsProps = {
|
||||
};
|
||||
|
||||
function useThreadGitControlModel(props: ThreadGitControlsProps) {
|
||||
const router = useRouter();
|
||||
const { environmentId, threadId } = useLocalSearchParams<{
|
||||
const router = useAppNavigation();
|
||||
const { environmentId, threadId } = useRouteParams<{
|
||||
environmentId: EnvironmentId;
|
||||
threadId: ThreadId;
|
||||
}>();
|
||||
@@ -171,7 +171,7 @@ function useThreadGitControlModel(props: ThreadGitControlsProps) {
|
||||
requiresDefaultBranchConfirmation(input.action, isDefaultRef)
|
||||
) {
|
||||
router.push({
|
||||
pathname: "/threads/[environmentId]/[threadId]/git-confirm",
|
||||
name: "GitConfirm",
|
||||
params: {
|
||||
environmentId,
|
||||
threadId,
|
||||
@@ -222,7 +222,7 @@ function useThreadGitControlModel(props: ThreadGitControlsProps) {
|
||||
return;
|
||||
}
|
||||
router.push({
|
||||
pathname: "/threads/[environmentId]/[threadId]/git",
|
||||
name: "GitOverview",
|
||||
params: { environmentId, threadId },
|
||||
});
|
||||
}, [environmentId, props.onOpenGitInspector, router, threadId]);
|
||||
@@ -417,9 +417,9 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack.Toolbar placement="right">
|
||||
<NativeHeaderToolbar placement="right">
|
||||
{showActionControls && props.auxiliaryPaneControl ? (
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel={props.auxiliaryPaneControl.accessibilityLabel}
|
||||
icon="sidebar.right"
|
||||
onPress={props.auxiliaryPaneControl.onPress}
|
||||
@@ -427,30 +427,36 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
|
||||
/>
|
||||
) : null}
|
||||
{showActionControls ? (
|
||||
<Stack.Toolbar.Menu icon="terminal" disabled={!props.canOpenTerminal} separateBackground>
|
||||
<NativeHeaderToolbar.Menu
|
||||
icon="terminal"
|
||||
disabled={!props.canOpenTerminal}
|
||||
separateBackground
|
||||
>
|
||||
{props.projectScripts.length > 0 ? (
|
||||
props.projectScripts.map((script) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={script.id}
|
||||
icon={projectScriptMenuIcon(script.icon)}
|
||||
onPress={() => void props.onRunProjectScript(script)}
|
||||
subtitle={script.command}
|
||||
>
|
||||
<Stack.Toolbar.Label>{projectScriptMenuLabel(script)}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>
|
||||
{projectScriptMenuLabel(script)}
|
||||
</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))
|
||||
) : (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon="play"
|
||||
disabled
|
||||
onPress={() => {}}
|
||||
subtitle="This project has no saved scripts yet"
|
||||
>
|
||||
<Stack.Toolbar.Label>No project scripts</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>No project scripts</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
)}
|
||||
{props.terminalSessions.map((session) => (
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={session.terminalId}
|
||||
icon="terminal"
|
||||
onPress={() => props.onOpenTerminal(session.terminalId)}
|
||||
@@ -464,20 +470,20 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
|
||||
.filter(Boolean)
|
||||
.join(" · ")}
|
||||
>
|
||||
<Stack.Toolbar.Label>{session.displayLabel}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<NativeHeaderToolbar.Label>{session.displayLabel}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon="plus"
|
||||
onPress={props.onOpenNewTerminal}
|
||||
subtitle="Start another shell for this thread"
|
||||
>
|
||||
<Stack.Toolbar.Label>Open new terminal</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
</Stack.Toolbar.Menu>
|
||||
<NativeHeaderToolbar.Label>Open new terminal</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
) : null}
|
||||
{showActionControls && props.showDirectFileControl ? (
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Open files"
|
||||
disabled={!props.canOpenFiles}
|
||||
icon="folder"
|
||||
@@ -486,50 +492,50 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
|
||||
/>
|
||||
) : null}
|
||||
{showActionControls ? (
|
||||
<Stack.Toolbar.Menu icon="point.topleft.down.curvedto.point.bottomright.up">
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Menu icon="point.topleft.down.curvedto.point.bottomright.up">
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon="point.topleft.down.curvedto.point.bottomright.up"
|
||||
disabled
|
||||
onPress={() => {}}
|
||||
subtitle={compactMenuStatus(props.gitStatus)}
|
||||
>
|
||||
<Stack.Toolbar.Label>
|
||||
<NativeHeaderToolbar.Label>
|
||||
{compactMenuBranchLabel(model.currentBranchLabel)}
|
||||
</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<Stack.Toolbar.MenuAction
|
||||
</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon={model.quickActionIcon}
|
||||
disabled={model.quickAction.disabled}
|
||||
onPress={() => void model.runQuickAction()}
|
||||
subtitle={model.quickActionHint ?? undefined}
|
||||
>
|
||||
<Stack.Toolbar.Label>{model.quickAction.label}</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Label>{model.quickAction.label}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon="text.bubble"
|
||||
disabled={!model.isRepo}
|
||||
onPress={model.openReview}
|
||||
subtitle="Turn diffs and worktree changes"
|
||||
>
|
||||
<Stack.Toolbar.Label>Review changes</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Label>Review changes</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon="folder"
|
||||
disabled={!props.canOpenFiles}
|
||||
onPress={model.openFiles}
|
||||
subtitle="Browse this workspace"
|
||||
>
|
||||
<Stack.Toolbar.Label>Files</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
<Stack.Toolbar.MenuAction
|
||||
<NativeHeaderToolbar.Label>Files</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
icon="ellipsis.circle"
|
||||
onPress={model.openGitInspector}
|
||||
subtitle="Commit, files, branches"
|
||||
>
|
||||
<Stack.Toolbar.Label>More</Stack.Toolbar.Label>
|
||||
</Stack.Toolbar.MenuAction>
|
||||
</Stack.Toolbar.Menu>
|
||||
<NativeHeaderToolbar.Label>More</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
</NativeHeaderToolbar.Menu>
|
||||
) : null}
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
);
|
||||
}
|
||||
@@ -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 "../../navigation/router";
|
||||
import { useAppNavigation } from "../../navigation/native-stack-header";
|
||||
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";
|
||||
@@ -257,7 +257,7 @@ export function ThreadNavigationSidebar(props: {
|
||||
}) {
|
||||
const insets = useSafeAreaInsets();
|
||||
const colorScheme = useColorScheme() === "dark" ? "dark" : "light";
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const projects = useProjects();
|
||||
const threads = useThreadShells();
|
||||
const { state: catalogState } = useWorkspaceState();
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { Stack, useFocusEffect, useLocalSearchParams, useRouter } from "../../navigation/router";
|
||||
import {
|
||||
NativeStackScreenOptions,
|
||||
useFocusEffect,
|
||||
useRouteParams,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -153,7 +158,7 @@ export function ThreadRouteScreen(props: ThreadRouteScreenProps = {}) {
|
||||
const { state: workspaceState } = useWorkspaceState();
|
||||
const { connectionState } = useRemoteConnectionStatus();
|
||||
const { selectedThread } = useThreadSelection();
|
||||
const params = useLocalSearchParams<{
|
||||
const params = useRouteParams<{
|
||||
environmentId?: string | string[];
|
||||
threadId?: string | string[];
|
||||
}>();
|
||||
@@ -268,8 +273,8 @@ function ThreadRouteContent(
|
||||
const gitActions = useSelectedThreadGitActions();
|
||||
const requests = useSelectedThreadRequests();
|
||||
const interruptThreadTurn = useAtomCommand(threadEnvironment.interruptTurn, "thread interrupt");
|
||||
const router = useRouter();
|
||||
const params = useLocalSearchParams<{
|
||||
const router = useAppNavigation();
|
||||
const params = useRouteParams<{
|
||||
environmentId?: string | string[];
|
||||
threadId?: string | string[];
|
||||
}>();
|
||||
@@ -808,7 +813,7 @@ function ThreadRouteContent(
|
||||
return (
|
||||
<>
|
||||
{activeInspectorRenderer ? <InspectorPaneRoleActivation /> : null}
|
||||
<Stack.Screen options={{ headerShown: false }} />
|
||||
<NativeStackScreenOptions options={{ headerShown: false }} />
|
||||
<ScreenStack style={{ flex: 1 }}>
|
||||
<Screen
|
||||
activityState={2}
|
||||
@@ -872,7 +877,7 @@ function ThreadRouteContent(
|
||||
return (
|
||||
<>
|
||||
{activeInspectorRenderer ? <InspectorPaneRoleActivation /> : null}
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
headerShown: true,
|
||||
headerTransparent: usesNativeHeaderGlass,
|
||||
@@ -924,14 +929,14 @@ function ThreadRouteContent(
|
||||
/>
|
||||
|
||||
{layout.usesSplitView || usesNativeHeaderGlass ? null : (
|
||||
<Stack.Screen.Title asChild>
|
||||
<NativeStackScreenOptions.Title asChild>
|
||||
<ThreadHeaderTitle
|
||||
foregroundColor={foregroundColor}
|
||||
secondaryForegroundColor={secondaryFg}
|
||||
subtitle={headerSubtitle}
|
||||
title={selectedThread.title}
|
||||
/>
|
||||
</Stack.Screen.Title>
|
||||
</NativeStackScreenOptions.Title>
|
||||
)}
|
||||
|
||||
{renderThreadRouteBody(!layout.usesSplitView)}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sanitizeFeatureBranchName } from "@t3tools/shared/git";
|
||||
import { useRouter } from "../../../navigation/router";
|
||||
import { useAppNavigation } from "../../../navigation/native-stack-header";
|
||||
import { useState } from "react";
|
||||
import { Pressable, ScrollView, View } from "react-native";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
@@ -15,7 +15,7 @@ import { vcsEnvironment } from "../../../state/vcs";
|
||||
import { SheetActionButton } from "./gitSheetComponents";
|
||||
|
||||
export function GitBranchesSheet() {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const { selectedThread } = useThreadSelection();
|
||||
const { selectedThreadCwd, selectedThreadWorktreePath } = useSelectedThreadWorktree();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useRouter } from "../../../navigation/router";
|
||||
import { useAppNavigation } from "../../../navigation/native-stack-header";
|
||||
import { useCallback, useState } from "react";
|
||||
import { Pressable, ScrollView, View, useColorScheme } from "react-native";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
@@ -14,7 +14,7 @@ import { vcsEnvironment } from "../../../state/vcs";
|
||||
import { SheetActionButton } from "./gitSheetComponents";
|
||||
|
||||
export function GitCommitSheet() {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const isDarkMode = useColorScheme() === "dark";
|
||||
const { selectedThread } = useThreadSelection();
|
||||
|
||||
@@ -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 "../../../navigation/router";
|
||||
import { useRouteParams, useAppNavigation } from "../../../navigation/native-stack-header";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { View } from "react-native";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
@@ -13,12 +13,12 @@ import { useSelectedThreadGitState } from "../../../state/use-selected-thread-gi
|
||||
import { SheetActionButton } from "./gitSheetComponents";
|
||||
|
||||
export function GitConfirmSheet() {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const gitState = useSelectedThreadGitState();
|
||||
const gitActions = useSelectedThreadGitActions();
|
||||
|
||||
const params = useLocalSearchParams<{
|
||||
const params = useRouteParams<{
|
||||
confirmAction?: string;
|
||||
branchName?: string;
|
||||
includesCommit?: string;
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
requiresDefaultBranchConfirmation,
|
||||
} from "@t3tools/client-runtime/state/vcs";
|
||||
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
import { useLocalSearchParams, useRouter } from "../../../navigation/router";
|
||||
import { useRouteParams, useAppNavigation } from "../../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import { useCallback, useEffect, useMemo, type ComponentProps } from "react";
|
||||
import { Alert, Platform, Pressable, ScrollView, View } from "react-native";
|
||||
@@ -33,11 +33,11 @@ export function GitOverviewSheet(
|
||||
readonly presentation?: "sheet" | "inspector";
|
||||
} = {},
|
||||
) {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const presentation = props.presentation ?? "sheet";
|
||||
const isInspector = presentation === "inspector";
|
||||
const { environmentId, threadId } = useLocalSearchParams<{
|
||||
const { environmentId, threadId } = useRouteParams<{
|
||||
environmentId: EnvironmentId;
|
||||
threadId: ThreadId;
|
||||
}>();
|
||||
@@ -120,7 +120,7 @@ export function GitOverviewSheet(
|
||||
requiresDefaultBranchConfirmation(input.action, isDefaultRef)
|
||||
) {
|
||||
router.push({
|
||||
pathname: "/threads/[environmentId]/[threadId]/git-confirm",
|
||||
name: "GitConfirm",
|
||||
params: {
|
||||
environmentId,
|
||||
threadId,
|
||||
@@ -151,7 +151,7 @@ export function GitOverviewSheet(
|
||||
}
|
||||
if (item.dialogAction === "commit") {
|
||||
router.push({
|
||||
pathname: "/threads/[environmentId]/[threadId]/git/commit",
|
||||
name: "GitCommit",
|
||||
params: { environmentId, threadId },
|
||||
});
|
||||
return;
|
||||
@@ -248,7 +248,7 @@ export function GitOverviewSheet(
|
||||
disabled={busy || !isRepo}
|
||||
onPress={() =>
|
||||
router.push({
|
||||
pathname: "/threads/[environmentId]/[threadId]/git/branches",
|
||||
name: "GitBranches",
|
||||
params: { environmentId, threadId },
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ describe("thread file routes", () => {
|
||||
|
||||
it("builds typed navigation params for a file and source line", () => {
|
||||
expect(buildThreadFilesNavigation(thread, "src/main.ts", 42)).toEqual({
|
||||
pathname: "/threads/[environmentId]/[threadId]/files/[...path]",
|
||||
name: "ThreadFile",
|
||||
params: {
|
||||
environmentId: "environment-1",
|
||||
threadId: "thread-1",
|
||||
@@ -35,7 +35,7 @@ describe("thread file routes", () => {
|
||||
|
||||
it("targets the files index when no file path is provided", () => {
|
||||
expect(buildThreadFilesNavigation(thread)).toEqual({
|
||||
pathname: "/threads/[environmentId]/[threadId]/files",
|
||||
name: "ThreadFiles",
|
||||
params: {
|
||||
environmentId: "environment-1",
|
||||
threadId: "thread-1",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import type { Href, useRouter } from "../navigation/router";
|
||||
import { type EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
|
||||
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
|
||||
import type { AppNavigation } from "../navigation/app-navigation";
|
||||
import type { AppNavigationTarget } from "../navigation/route-model";
|
||||
import type { SelectedThreadRef } from "../state/remote-runtime-types";
|
||||
|
||||
type Router = ReturnType<typeof useRouter>;
|
||||
type Router = AppNavigation;
|
||||
|
||||
type ThreadRouteInput =
|
||||
| Pick<SelectedThreadRef, "environmentId" | "threadId">
|
||||
@@ -65,15 +66,10 @@ export function buildThreadTerminalRoutePath(
|
||||
return `${basePath}?terminalId=${encodeURIComponent(terminalId)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer this over {@link buildThreadTerminalRoutePath} with `router.push(string)` — Expo Router
|
||||
* often does not merge query strings into `useLocalSearchParams`, which breaks terminal bootstrap
|
||||
* (`requestedTerminalId` stays null while the UI assumes `default`).
|
||||
*/
|
||||
export function buildThreadTerminalNavigation(
|
||||
input: ThreadRouteInput | PlainThreadRouteInput,
|
||||
terminalId?: string | null,
|
||||
): Href {
|
||||
): AppNavigationTarget {
|
||||
const environmentId = String(input.environmentId);
|
||||
const threadId = String("threadId" in input ? input.threadId : input.id);
|
||||
|
||||
@@ -87,7 +83,7 @@ export function buildThreadTerminalNavigation(
|
||||
}
|
||||
|
||||
return {
|
||||
pathname: "/threads/[environmentId]/[threadId]/terminal",
|
||||
name: "ThreadTerminal",
|
||||
params,
|
||||
};
|
||||
}
|
||||
@@ -96,14 +92,14 @@ export function buildThreadFilesNavigation(
|
||||
input: ThreadRouteInput | PlainThreadRouteInput,
|
||||
relativePath?: string | null,
|
||||
line?: number | null,
|
||||
): Href {
|
||||
): AppNavigationTarget {
|
||||
const environmentId = String(input.environmentId);
|
||||
const threadId = String("threadId" in input ? input.threadId : input.id);
|
||||
const path = relativePath?.split("/").filter((segment) => segment.length > 0) ?? [];
|
||||
|
||||
if (path.length === 0) {
|
||||
return {
|
||||
pathname: "/threads/[environmentId]/[threadId]/files",
|
||||
name: "ThreadFiles",
|
||||
params: { environmentId, threadId },
|
||||
};
|
||||
}
|
||||
@@ -119,7 +115,7 @@ export function buildThreadFilesNavigation(
|
||||
}
|
||||
|
||||
return {
|
||||
pathname: "/threads/[environmentId]/[threadId]/files/[...path]",
|
||||
name: "ThreadFile",
|
||||
params,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,405 @@
|
||||
import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
||||
import { useCallback, type ReactNode } from "react";
|
||||
import { StatusBar, useColorScheme, useWindowDimensions } from "react-native";
|
||||
import { useResolveClassNames } from "uniwind";
|
||||
|
||||
import { ArchivedThreadsRouteScreen } from "../features/archive/ArchivedThreadsRouteScreen";
|
||||
import { useAgentNotificationNavigation } from "../features/agent-awareness/notificationNavigation";
|
||||
import {
|
||||
ClerkSettingsSheetDetentProvider,
|
||||
useClerkSettingsSheetDetent,
|
||||
} from "../features/cloud/ClerkSettingsSheetDetent";
|
||||
import {
|
||||
AdaptiveWorkspaceLayout,
|
||||
useAdaptiveWorkspaceLayout,
|
||||
} from "../features/layout/AdaptiveWorkspaceLayout";
|
||||
import { ThreadFilesTreeScreen, ThreadFileScreen } from "../features/files/ThreadFilesRouteScreen";
|
||||
import { HardwareKeyboardCommandProvider } from "../features/keyboard/HardwareKeyboardCommandProvider";
|
||||
import { ReviewCommentComposerSheet } from "../features/review/ReviewCommentComposerSheet";
|
||||
import { ReviewHighlighterProvider } from "../features/review/ReviewHighlighterProvider";
|
||||
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 { deriveStableFormSheetDetent } from "../lib/layout";
|
||||
import { useThemeColor } from "../lib/useThemeColor";
|
||||
import NotFoundRoute from "../screens/+not-found";
|
||||
import ConnectionsRouteScreen from "../screens/connections";
|
||||
import ConnectionsNewRouteScreen from "../screens/connections/new";
|
||||
import RnsGlassDebugRoute from "../screens/debug/rns-glass";
|
||||
import HomeRouteScreen from "../screens";
|
||||
import AddProjectRoute from "../screens/new/add-project";
|
||||
import AddProjectDestinationRoute from "../screens/new/add-project/destination";
|
||||
import AddProjectLocalRoute from "../screens/new/add-project/local";
|
||||
import AddProjectRepositoryRoute from "../screens/new/add-project/repository";
|
||||
import NewTaskDraftRoute from "../screens/new/draft";
|
||||
import NewTaskRoute from "../screens/new";
|
||||
import SettingsAuthRouteScreen from "../screens/settings/auth";
|
||||
import SettingsEnvironmentsRouteScreen from "../screens/settings/environments";
|
||||
import SettingsRouteScreen from "../screens/settings";
|
||||
import SettingsWaitlistRouteScreen from "../screens/settings/waitlist";
|
||||
import { ThreadSelectionProvider } from "../state/use-thread-selection";
|
||||
import { useThreadOutboxDrain } from "../state/use-thread-outbox-drain";
|
||||
import { useCurrentPathname } from "./app-navigation";
|
||||
import type { AppStackParamList } from "./route-model";
|
||||
|
||||
const RootStack = createNativeStackNavigator<AppStackParamList>();
|
||||
|
||||
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>
|
||||
);
|
||||
}
|
||||
|
||||
export function RootNavigator() {
|
||||
const pathname = useCurrentPathname();
|
||||
const expandedSettingsRouteIsActive =
|
||||
pathname === "/settings/archive" || pathname === "/settings/auth";
|
||||
|
||||
return (
|
||||
<HardwareKeyboardCommandProvider>
|
||||
<ClerkSettingsSheetDetentProvider initiallyExpanded={expandedSettingsRouteIsActive}>
|
||||
<RootNavigatorContent />
|
||||
</ClerkSettingsSheetDetentProvider>
|
||||
</HardwareKeyboardCommandProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function RootNavigatorContent() {
|
||||
const pathname = useCurrentPathname();
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
import {
|
||||
CommonActions,
|
||||
NavigationContainer,
|
||||
StackActions,
|
||||
type NavigationContainerRef,
|
||||
} from "@react-navigation/native";
|
||||
import { createContext, use, useCallback, useMemo, useRef, useState, type ReactNode } from "react";
|
||||
|
||||
import { appLinking } from "./linking";
|
||||
import {
|
||||
buildPathFromRoute,
|
||||
getFocusedRoute,
|
||||
resolveNavigationTarget,
|
||||
type AppFocusedRoute,
|
||||
type AppHref,
|
||||
type AppStackParamList,
|
||||
type RouteParams,
|
||||
} from "./route-model";
|
||||
|
||||
export type AppNavigation = {
|
||||
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 AppNavigationContextValue = {
|
||||
readonly navigationRef: React.RefObject<NavigationContainerRef<AppStackParamList> | null>;
|
||||
readonly pathname: string;
|
||||
readonly params: RouteParams;
|
||||
readonly navigation: AppNavigation;
|
||||
};
|
||||
|
||||
export const AppNavigationContext = createContext<AppNavigationContextValue | null>(null);
|
||||
|
||||
export function useAppNavigation(): AppNavigation {
|
||||
const context = use(AppNavigationContext);
|
||||
if (context === null) {
|
||||
throw new Error("useAppNavigation must be used within AppNavigationProvider");
|
||||
}
|
||||
return context.navigation;
|
||||
}
|
||||
|
||||
export function useCurrentPathname(): string {
|
||||
const context = use(AppNavigationContext);
|
||||
if (context === null) {
|
||||
throw new Error("useCurrentPathname must be used within AppNavigationProvider");
|
||||
}
|
||||
return context.pathname;
|
||||
}
|
||||
|
||||
export function useCurrentRouteParams<T extends RouteParams = RouteParams>(): T {
|
||||
const context = use(AppNavigationContext);
|
||||
if (context === null) {
|
||||
throw new Error("useCurrentRouteParams must be used within AppNavigationProvider");
|
||||
}
|
||||
return context.params as T;
|
||||
}
|
||||
|
||||
export function createAppNavigation(
|
||||
navigationRef: React.RefObject<NavigationContainerRef<AppStackParamList> | null>,
|
||||
): AppNavigation {
|
||||
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 AppNavigationProvider(props: { readonly children: ReactNode }) {
|
||||
const navigationRef = useRef<NavigationContainerRef<AppStackParamList>>(null);
|
||||
const [pathname, setPathname] = useState("/");
|
||||
const [params, setParams] = useState<RouteParams>({});
|
||||
const navigation = useMemo(() => createAppNavigation(navigationRef), []);
|
||||
const contextValue = useMemo(
|
||||
() => ({
|
||||
navigationRef,
|
||||
pathname,
|
||||
params,
|
||||
navigation,
|
||||
}),
|
||||
[navigation, params, pathname],
|
||||
);
|
||||
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={appLinking}
|
||||
onReady={syncState}
|
||||
onStateChange={syncState}
|
||||
ref={navigationRef}
|
||||
>
|
||||
{props.children}
|
||||
</NavigationContainer>
|
||||
</AppNavigationContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function pathAndParamsFromCurrentRoute(route: AppFocusedRoute): {
|
||||
readonly pathname: string;
|
||||
readonly params: RouteParams;
|
||||
} {
|
||||
return {
|
||||
pathname: buildPathFromRoute(route),
|
||||
params: (route.params ?? {}) as RouteParams,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { LinkingOptions } from "@react-navigation/native";
|
||||
import * as Linking from "expo-linking";
|
||||
|
||||
import type { AppStackParamList } from "./route-model";
|
||||
|
||||
export const appLinking: LinkingOptions<AppStackParamList> = {
|
||||
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: "*",
|
||||
},
|
||||
},
|
||||
};
|
||||
+60
-201
@@ -1,13 +1,9 @@
|
||||
import {
|
||||
CommonActions,
|
||||
StackActions,
|
||||
useFocusEffect,
|
||||
useNavigation,
|
||||
useRoute,
|
||||
type NavigationContainerRef,
|
||||
type ParamListBase,
|
||||
} from "@react-navigation/native";
|
||||
import type { ColorValue } from "react-native";
|
||||
import type {
|
||||
NativeStackHeaderItem,
|
||||
NativeStackHeaderItemMenu,
|
||||
@@ -17,29 +13,24 @@ import type {
|
||||
import {
|
||||
Children,
|
||||
cloneElement,
|
||||
createContext,
|
||||
createElement,
|
||||
Fragment,
|
||||
isValidElement,
|
||||
use,
|
||||
useEffect,
|
||||
useMemo,
|
||||
type ReactElement,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import type { ColorValue } from "react-native";
|
||||
|
||||
import {
|
||||
buildPathFromRoute,
|
||||
resolveNavigationTarget,
|
||||
type AppHref,
|
||||
type AppStackParamList,
|
||||
type AppFocusedRoute,
|
||||
type RouteParams,
|
||||
} from "./route-model";
|
||||
import { useAppNavigation } from "./app-navigation";
|
||||
import type { AppHref, RouteParams } from "./route-model";
|
||||
|
||||
export { useFocusEffect };
|
||||
export type Href = AppHref;
|
||||
type CompatNativeStackNavigationOptions = Omit<
|
||||
export { useAppNavigation, useCurrentPathname, useCurrentRouteParams } from "./app-navigation";
|
||||
export type { AppHref };
|
||||
|
||||
export type AppNativeStackNavigationOptions = Omit<
|
||||
NativeStackNavigationOptions,
|
||||
"headerTintColor" | "unstable_headerLeftItems" | "unstable_headerRightItems"
|
||||
> & {
|
||||
@@ -52,133 +43,11 @@ type CompatNativeStackNavigationOptions = Omit<
|
||||
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 {
|
||||
export function useRouteParams<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>>();
|
||||
@@ -188,7 +57,7 @@ function useNativeStackNavigation(): NativeStackNavigationProp<ParamListBase> |
|
||||
}
|
||||
|
||||
function normalizeScreenOptions(
|
||||
options: CompatNativeStackNavigationOptions | undefined,
|
||||
options: AppNativeStackNavigationOptions | undefined,
|
||||
): NativeStackNavigationOptions | undefined {
|
||||
if (!options) {
|
||||
return options;
|
||||
@@ -213,8 +82,8 @@ function normalizeScreenOptions(
|
||||
return normalized as NativeStackNavigationOptions;
|
||||
}
|
||||
|
||||
function StackScreen(props: {
|
||||
readonly options?: CompatNativeStackNavigationOptions;
|
||||
export function NativeStackScreenOptions(props: {
|
||||
readonly options?: AppNativeStackNavigationOptions;
|
||||
readonly listeners?: Record<string, (event: never) => void>;
|
||||
readonly name?: string;
|
||||
}) {
|
||||
@@ -282,7 +151,7 @@ function convertMenuAction(
|
||||
element: ReactElement<ToolbarElementProps>,
|
||||
): NativeStackHeaderItemMenu["menu"]["items"][number] | null {
|
||||
const typeName = elementTypeName(element);
|
||||
if (typeName === "ToolbarMenuAction") {
|
||||
if (typeName === "NativeHeaderToolbarMenuAction") {
|
||||
const label = labelFromChildren(element.props.children);
|
||||
return {
|
||||
type: "action",
|
||||
@@ -303,7 +172,7 @@ function convertMenuAction(
|
||||
};
|
||||
}
|
||||
|
||||
if (typeName === "ToolbarMenu") {
|
||||
if (typeName === "NativeHeaderToolbarMenu") {
|
||||
return {
|
||||
type: "submenu",
|
||||
label:
|
||||
@@ -341,7 +210,7 @@ function convertToolbarChild(child: ReactNode): NativeStackHeaderItem | null {
|
||||
}
|
||||
|
||||
const typeName = elementTypeName(child);
|
||||
if (typeName === "ToolbarButton") {
|
||||
if (typeName === "NativeHeaderToolbarButton") {
|
||||
return {
|
||||
type: "button",
|
||||
label: "",
|
||||
@@ -360,7 +229,7 @@ function convertToolbarChild(child: ReactNode): NativeStackHeaderItem | null {
|
||||
};
|
||||
}
|
||||
|
||||
if (typeName === "ToolbarMenu") {
|
||||
if (typeName === "NativeHeaderToolbarMenu") {
|
||||
return {
|
||||
type: "menu",
|
||||
label: typeof child.props.title === "string" ? child.props.title : "",
|
||||
@@ -379,7 +248,7 @@ function convertToolbarChild(child: ReactNode): NativeStackHeaderItem | null {
|
||||
};
|
||||
}
|
||||
|
||||
if (typeName === "ToolbarSpacer") {
|
||||
if (typeName === "NativeHeaderToolbarSpacer") {
|
||||
return {
|
||||
type: "spacing",
|
||||
spacing: typeof child.props.width === "number" ? child.props.width : 8,
|
||||
@@ -400,7 +269,7 @@ function collectToolbarItems(children: ReactNode): NativeStackHeaderItem[] {
|
||||
return items;
|
||||
}
|
||||
|
||||
function Toolbar(props: {
|
||||
function NativeHeaderToolbarRoot(props: {
|
||||
readonly placement?: "left" | "right" | "bottom";
|
||||
readonly children?: ReactNode;
|
||||
}) {
|
||||
@@ -421,7 +290,7 @@ function Toolbar(props: {
|
||||
return null;
|
||||
}
|
||||
|
||||
function ToolbarButton(_props: {
|
||||
function NativeHeaderToolbarButton(_props: {
|
||||
readonly accessibilityLabel?: string;
|
||||
readonly disabled?: boolean;
|
||||
readonly icon?: string;
|
||||
@@ -430,9 +299,9 @@ function ToolbarButton(_props: {
|
||||
}) {
|
||||
return null;
|
||||
}
|
||||
ToolbarButton.displayName = "ToolbarButton";
|
||||
NativeHeaderToolbarButton.displayName = "NativeHeaderToolbarButton";
|
||||
|
||||
function ToolbarMenu(_props: {
|
||||
function NativeHeaderToolbarMenu(_props: {
|
||||
readonly accessibilityLabel?: string;
|
||||
readonly children?: ReactNode;
|
||||
readonly disabled?: boolean;
|
||||
@@ -443,9 +312,9 @@ function ToolbarMenu(_props: {
|
||||
}) {
|
||||
return null;
|
||||
}
|
||||
ToolbarMenu.displayName = "ToolbarMenu";
|
||||
NativeHeaderToolbarMenu.displayName = "NativeHeaderToolbarMenu";
|
||||
|
||||
function ToolbarMenuAction(_props: {
|
||||
function NativeHeaderToolbarMenuAction(_props: {
|
||||
readonly children?: ReactNode;
|
||||
readonly destructive?: boolean;
|
||||
readonly disabled?: boolean;
|
||||
@@ -457,80 +326,70 @@ function ToolbarMenuAction(_props: {
|
||||
}) {
|
||||
return null;
|
||||
}
|
||||
ToolbarMenuAction.displayName = "ToolbarMenuAction";
|
||||
NativeHeaderToolbarMenuAction.displayName = "NativeHeaderToolbarMenuAction";
|
||||
|
||||
function ToolbarLabel(_props: { readonly children?: ReactNode }) {
|
||||
function NativeHeaderToolbarLabel(_props: { readonly children?: ReactNode }) {
|
||||
return null;
|
||||
}
|
||||
ToolbarLabel.displayName = "ToolbarLabel";
|
||||
NativeHeaderToolbarLabel.displayName = "NativeHeaderToolbarLabel";
|
||||
|
||||
function ToolbarSpacer(_props: { readonly sharesBackground?: boolean; readonly width?: number }) {
|
||||
function NativeHeaderToolbarSpacer(_props: {
|
||||
readonly sharesBackground?: boolean;
|
||||
readonly width?: number;
|
||||
}) {
|
||||
return null;
|
||||
}
|
||||
ToolbarSpacer.displayName = "ToolbarSpacer";
|
||||
NativeHeaderToolbarSpacer.displayName = "NativeHeaderToolbarSpacer";
|
||||
|
||||
function ToolbarSearchBarSlot() {
|
||||
function NativeHeaderToolbarSearchBarSlot() {
|
||||
return null;
|
||||
}
|
||||
ToolbarSearchBarSlot.displayName = "ToolbarSearchBarSlot";
|
||||
NativeHeaderToolbarSearchBarSlot.displayName = "NativeHeaderToolbarSearchBarSlot";
|
||||
|
||||
function StackScreenTitle(_props: { readonly asChild?: boolean; readonly children?: ReactNode }) {
|
||||
export const NativeHeaderToolbar = Object.assign(NativeHeaderToolbarRoot, {
|
||||
Button: NativeHeaderToolbarButton,
|
||||
Label: NativeHeaderToolbarLabel,
|
||||
Menu: Object.assign(NativeHeaderToolbarMenu, {
|
||||
Action: NativeHeaderToolbarMenuAction,
|
||||
}),
|
||||
MenuAction: NativeHeaderToolbarMenuAction,
|
||||
SearchBarSlot: NativeHeaderToolbarSearchBarSlot,
|
||||
Spacer: NativeHeaderToolbarSpacer,
|
||||
});
|
||||
|
||||
function NativeStackScreenTitle(_props: {
|
||||
readonly asChild?: boolean;
|
||||
readonly children?: ReactNode;
|
||||
}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StackScreen.Title = StackScreenTitle;
|
||||
NativeStackScreenOptions.Title = NativeStackScreenTitle;
|
||||
|
||||
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();
|
||||
export function NavigateTo(props: { readonly href: AppHref }) {
|
||||
const navigation = useAppNavigation();
|
||||
useEffect(() => {
|
||||
router.replace(props.href);
|
||||
}, [props.href, router]);
|
||||
navigation.replace(props.href);
|
||||
}, [navigation, props.href]);
|
||||
return null;
|
||||
}
|
||||
|
||||
export function Link(props: {
|
||||
export function NavigationLink(props: {
|
||||
readonly href: AppHref;
|
||||
readonly asChild?: boolean;
|
||||
readonly children?: ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const navigation = useAppNavigation();
|
||||
if (props.asChild && isValidElement<{ onPress?: () => void }>(props.children)) {
|
||||
return cloneElement(props.children, {
|
||||
onPress: () => router.push(props.href),
|
||||
onPress: () => navigation.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;
|
||||
export const NativeStackFragment = function NativeStackFragment(props: {
|
||||
readonly children?: ReactNode;
|
||||
}) {
|
||||
return createElement(Fragment, null, props.children);
|
||||
};
|
||||
@@ -63,6 +63,7 @@ export type AppStackParamList = {
|
||||
|
||||
export type AppHref =
|
||||
| string
|
||||
| AppNavigationTarget
|
||||
| {
|
||||
readonly pathname: string;
|
||||
readonly params?: RouteParams;
|
||||
@@ -148,6 +149,9 @@ function mergeParams(
|
||||
|
||||
export function resolveNavigationTarget(href: AppHref): AppNavigationTarget {
|
||||
if (typeof href !== "string") {
|
||||
if ("name" in href) {
|
||||
return withParams(href.name, href.params);
|
||||
}
|
||||
return resolveNavigationObject(href.pathname, href.params);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Link } from "../navigation/router";
|
||||
import { NavigationLink } from "../navigation/native-stack-header";
|
||||
import { Pressable, ScrollView, StyleSheet } from "react-native";
|
||||
import { useResolveClassNames } from "uniwind";
|
||||
|
||||
@@ -32,11 +32,11 @@ export default function NotFoundRoute() {
|
||||
<Text className="text-3xl font-t3-bold text-foreground" selectable>
|
||||
Route not found
|
||||
</Text>
|
||||
<Link href="/" asChild>
|
||||
<NavigationLink href="/" asChild>
|
||||
<Pressable style={returnHomeButtonStyle}>
|
||||
<Text className="text-base font-t3-bold text-primary-foreground">Return home</Text>
|
||||
</Pressable>
|
||||
</Link>
|
||||
</NavigationLink>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
import { Stack, useRouter } from "../../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import type { EnvironmentId } from "@t3tools/contracts";
|
||||
import { useCallback, useState } from "react";
|
||||
@@ -18,7 +22,7 @@ export default function ConnectionsRouteScreen() {
|
||||
onRemoveEnvironmentPress,
|
||||
onUpdateEnvironment,
|
||||
} = useRemoteConnections();
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const hasEnvironments = connectedEnvironments.length > 0;
|
||||
const [expandedId, setExpandedId] = useState<EnvironmentId | null>(null);
|
||||
@@ -31,18 +35,18 @@ export default function ConnectionsRouteScreen() {
|
||||
|
||||
return (
|
||||
<View collapsable={false} className="flex-1 bg-sheet">
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
title: "Environments",
|
||||
}}
|
||||
/>
|
||||
<Stack.Toolbar placement="right">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="right">
|
||||
<NativeHeaderToolbar.Button
|
||||
icon="plus"
|
||||
onPress={() => router.push("/connections/new")}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
showsVerticalScrollIndicator={false}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { CameraView, useCameraPermissions } from "expo-camera";
|
||||
import { Stack, useLocalSearchParams, useRouter } from "../../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
useRouteParams,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { AsyncResult } from "effect/unstable/reactivity";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Alert, ScrollView, View } from "react-native";
|
||||
@@ -21,8 +26,8 @@ export default function ConnectionsNewRouteScreen() {
|
||||
onConnectPress,
|
||||
pairingConnectionError,
|
||||
} = useRemoteConnections();
|
||||
const router = useRouter();
|
||||
const params = useLocalSearchParams<{ mode?: string }>();
|
||||
const router = useAppNavigation();
|
||||
const params = useRouteParams<{ mode?: string }>();
|
||||
const insets = useSafeAreaInsets();
|
||||
const [hostInput, setHostInput] = useState("");
|
||||
const [codeInput, setCodeInput] = useState("");
|
||||
@@ -124,13 +129,13 @@ export default function ConnectionsNewRouteScreen() {
|
||||
|
||||
return (
|
||||
<View collapsable={false} className="flex-1 bg-sheet">
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
title: showScanner ? "Scan QR Code" : "Add Environment",
|
||||
}}
|
||||
/>
|
||||
<Stack.Toolbar placement="right">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="right">
|
||||
<NativeHeaderToolbar.Button
|
||||
icon={showScanner ? "xmark" : "qrcode.viewfinder"}
|
||||
onPress={() => {
|
||||
if (showScanner) {
|
||||
@@ -141,7 +146,7 @@ export default function ConnectionsNewRouteScreen() {
|
||||
}}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Stack } from "../../navigation/router";
|
||||
import { NativeStackScreenOptions } from "../../navigation/native-stack-header";
|
||||
import { useEffect, useRef, useState, type ComponentProps } from "react";
|
||||
import {
|
||||
Platform,
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
const CODE_LINES = [
|
||||
"# Native RNS glass debug route",
|
||||
"",
|
||||
"This screen intentionally avoids Expo Router headers.",
|
||||
"This screen intentionally avoids app-level header wrappers.",
|
||||
"The native header below is owned by react-native-screens.",
|
||||
"",
|
||||
"Expected iOS 26 behavior:",
|
||||
@@ -198,7 +198,7 @@ export default function RnsGlassDebugRoute() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen options={{ headerShown: false }} />
|
||||
<NativeStackScreenOptions options={{ headerShown: false }} />
|
||||
<View style={[styles.host, { backgroundColor: background }]}>
|
||||
{usesWideSplit ? (
|
||||
<MailWideSplitDemo
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import * as Arr from "effect/Array";
|
||||
import * as Order from "effect/Order";
|
||||
import { Stack, useRouter } from "../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
useAppNavigation,
|
||||
} from "../navigation/native-stack-header";
|
||||
import { useMemo, useState } from "react";
|
||||
|
||||
import { useProjects, useThreadShells } from "../state/entities";
|
||||
@@ -23,7 +27,7 @@ export default function HomeRouteScreen() {
|
||||
const threads = useThreadShells();
|
||||
const { state: catalogState } = useWorkspaceState();
|
||||
const { savedConnectionsById } = useSavedRemoteConnections();
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
const { archiveThread, confirmDeleteThread } = useThreadListActions();
|
||||
const environments = useMemo(
|
||||
@@ -56,7 +60,7 @@ export default function HomeRouteScreen() {
|
||||
if (layout.usesSplitView) {
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
headerShown: true,
|
||||
headerTransparent: true,
|
||||
@@ -66,7 +70,7 @@ export default function HomeRouteScreen() {
|
||||
/>
|
||||
<WorkspaceSidebarToolbar
|
||||
afterSidebarButton={
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Start new task"
|
||||
icon="square.and.pencil"
|
||||
onPress={() => router.push("/new")}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Stack, useLocalSearchParams } from "../../../navigation/router";
|
||||
import { NativeStackScreenOptions, useRouteParams } from "../../../navigation/native-stack-header";
|
||||
import { addProjectRemoteSourceLabel } from "@t3tools/client-runtime/operations/projects";
|
||||
|
||||
import { AddProjectRepositoryScreen } from "../../../features/projects/AddProjectScreen";
|
||||
|
||||
export default function AddProjectRepositoryRoute() {
|
||||
const params = useLocalSearchParams<{ source?: string | string[] }>();
|
||||
const params = useRouteParams<{ source?: string | string[] }>();
|
||||
const source = Array.isArray(params.source) ? params.source[0] : params.source;
|
||||
const title =
|
||||
source === "github" ||
|
||||
@@ -16,7 +16,7 @@ export default function AddProjectRepositoryRoute() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen options={{ title }} />
|
||||
<NativeStackScreenOptions options={{ title }} />
|
||||
<AddProjectRepositoryScreen />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Stack, useLocalSearchParams } from "../../navigation/router";
|
||||
import { NativeStackScreenOptions, useRouteParams } from "../../navigation/native-stack-header";
|
||||
|
||||
import { NewTaskDraftScreen } from "../../features/threads/NewTaskDraftScreen";
|
||||
|
||||
export default function NewTaskDraftRoute() {
|
||||
const params = useLocalSearchParams<{
|
||||
const params = useRouteParams<{
|
||||
environmentId?: string | string[];
|
||||
projectId?: string | string[];
|
||||
title?: string | string[];
|
||||
@@ -11,7 +11,7 @@ export default function NewTaskDraftRoute() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
title: Array.isArray(params.title) ? params.title[0] : (params.title ?? "New task"),
|
||||
}}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { Link, Stack, useRouter } from "../../navigation/router";
|
||||
import {
|
||||
NavigationLink,
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import type { EnvironmentId, ProjectId } from "@t3tools/contracts";
|
||||
import { useMemo } from "react";
|
||||
@@ -73,7 +78,7 @@ export default function NewTaskRoute() {
|
||||
const projects = useProjects();
|
||||
const threads = useThreadShells();
|
||||
const { state: catalogState } = useWorkspaceState();
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const { layout } = useAdaptiveWorkspaceLayout();
|
||||
const insets = useSafeAreaInsets();
|
||||
const chevronColor = useThemeColor("--color-chevron");
|
||||
@@ -110,22 +115,22 @@ export default function NewTaskRoute() {
|
||||
|
||||
return (
|
||||
<View collapsable={false} className="flex-1 bg-sheet">
|
||||
<Stack.Screen options={{ title: "Choose project" }} />
|
||||
<Stack.Toolbar placement="right">
|
||||
<NativeStackScreenOptions options={{ title: "Choose project" }} />
|
||||
<NativeHeaderToolbar placement="right">
|
||||
{layout.usesSplitView ? (
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Close new task"
|
||||
icon="xmark"
|
||||
onPress={() => router.dismiss()}
|
||||
separateBackground
|
||||
/>
|
||||
) : null}
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar.Button
|
||||
icon="plus"
|
||||
onPress={() => router.push("/new/add-project")}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
|
||||
<ScrollView
|
||||
showsVerticalScrollIndicator={false}
|
||||
@@ -172,10 +177,10 @@ export default function NewTaskRoute() {
|
||||
const isLast = index === items.length - 1;
|
||||
|
||||
return (
|
||||
<Link
|
||||
<NavigationLink
|
||||
key={item.key}
|
||||
href={{
|
||||
pathname: "/new/draft",
|
||||
name: "NewTaskDraft",
|
||||
params: {
|
||||
environmentId: item.environmentId,
|
||||
projectId: item.id,
|
||||
@@ -217,7 +222,7 @@ export default function NewTaskRoute() {
|
||||
/>
|
||||
</View>
|
||||
</Pressable>
|
||||
</Link>
|
||||
</NavigationLink>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import { ArchivedThreadsRouteScreen } from "../../features/archive/ArchivedThreadsRouteScreen";
|
||||
|
||||
export default ArchivedThreadsRouteScreen;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAuth } from "@clerk/expo";
|
||||
import { AuthView, UserProfileView } from "@clerk/expo/native";
|
||||
import { Redirect, Stack } from "../../navigation/router";
|
||||
import { NavigateTo, NativeStackScreenOptions } from "../../navigation/native-stack-header";
|
||||
import { View } from "react-native";
|
||||
|
||||
import { hasCloudPublicConfig } from "../../features/cloud/publicConfig";
|
||||
@@ -9,7 +9,7 @@ export default function SettingsAuthRouteScreen() {
|
||||
return hasCloudPublicConfig() ? (
|
||||
<ConfiguredSettingsAuthRouteScreen />
|
||||
) : (
|
||||
<Redirect href="/settings" />
|
||||
<NavigateTo href="/settings" />
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ function ConfiguredSettingsAuthRouteScreen() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen options={{ title: isSignedIn ? "Account" : "Sign in" }} />
|
||||
<NativeStackScreenOptions options={{ title: isSignedIn ? "Account" : "Sign in" }} />
|
||||
<View collapsable={false} className="flex-1 overflow-hidden bg-sheet">
|
||||
{isLoaded ? (
|
||||
isSignedIn ? (
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../connections/new";
|
||||
@@ -1,5 +1,9 @@
|
||||
import { useAuth } from "@clerk/expo";
|
||||
import { Stack, useRouter } from "../../navigation/router";
|
||||
import {
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import {
|
||||
connectionStatusText,
|
||||
@@ -41,7 +45,7 @@ export default function SettingsEnvironmentsRouteScreen() {
|
||||
onRemoveEnvironmentPress,
|
||||
onUpdateEnvironment,
|
||||
} = useRemoteConnections();
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const { localEnvironments, connectedCloudEnvironments } = splitEnvironmentSections({
|
||||
connectedEnvironments,
|
||||
@@ -57,18 +61,18 @@ export default function SettingsEnvironmentsRouteScreen() {
|
||||
|
||||
return (
|
||||
<View collapsable={false} className="flex-1 bg-sheet">
|
||||
<Stack.Screen
|
||||
<NativeStackScreenOptions
|
||||
options={{
|
||||
title: "Environments",
|
||||
}}
|
||||
/>
|
||||
<Stack.Toolbar placement="right">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="right">
|
||||
<NativeHeaderToolbar.Button
|
||||
icon="plus"
|
||||
onPress={() => router.push("/settings/environment-new")}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
showsVerticalScrollIndicator={false}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { useAuth, useUser } from "@clerk/expo";
|
||||
import * as Notifications from "expo-notifications";
|
||||
import { Link, Stack, useRouter } from "../../navigation/router";
|
||||
import {
|
||||
NavigationLink,
|
||||
NativeHeaderToolbar,
|
||||
NativeStackScreenOptions,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
@@ -36,21 +41,21 @@ type NotificationStatus = "checking" | "enabled" | "disabled" | "unsupported";
|
||||
type LiveActivityStatus = "checking" | "enabled" | "disabled" | "signed-out" | "linking";
|
||||
|
||||
export default function SettingsRouteScreen() {
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
const { layout } = useAdaptiveWorkspaceLayout();
|
||||
|
||||
return (
|
||||
<>
|
||||
<WorkspaceSidebarToolbar />
|
||||
{layout.usesSplitView ? (
|
||||
<Stack.Toolbar placement="right">
|
||||
<Stack.Toolbar.Button
|
||||
<NativeHeaderToolbar placement="right">
|
||||
<NativeHeaderToolbar.Button
|
||||
accessibilityLabel="Close settings"
|
||||
icon="xmark"
|
||||
onPress={() => router.back()}
|
||||
separateBackground
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
</NativeHeaderToolbar>
|
||||
) : null}
|
||||
{hasCloudPublicConfig() ? <ConfiguredSettingsRouteScreen /> : <LocalSettingsRouteScreen />}
|
||||
</>
|
||||
@@ -64,7 +69,7 @@ function LocalSettingsRouteScreen() {
|
||||
|
||||
return (
|
||||
<View collapsable={false} className="flex-1 bg-sheet">
|
||||
<Stack.Screen options={{ title: "Settings" }} />
|
||||
<NativeStackScreenOptions options={{ title: "Settings" }} />
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
showsVerticalScrollIndicator={false}
|
||||
@@ -95,7 +100,7 @@ function LocalSettingsRouteScreen() {
|
||||
|
||||
function ConfiguredSettingsRouteScreen() {
|
||||
const insets = useSafeAreaInsets();
|
||||
const { push } = useRouter();
|
||||
const { push } = useAppNavigation();
|
||||
const { expand: expandClerkSheet } = useClerkSettingsSheetDetent();
|
||||
const { getToken, isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false });
|
||||
const { user } = useUser();
|
||||
@@ -345,7 +350,7 @@ function ConfiguredSettingsRouteScreen() {
|
||||
|
||||
return (
|
||||
<View collapsable={false} className="flex-1 bg-sheet">
|
||||
<Stack.Screen options={{ title: "Settings" }} />
|
||||
<NativeStackScreenOptions options={{ title: "Settings" }} />
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
showsVerticalScrollIndicator={false}
|
||||
@@ -490,11 +495,11 @@ function SettingsRow(props: {
|
||||
|
||||
if (props.href) {
|
||||
return (
|
||||
<Link href={props.href} asChild>
|
||||
<NavigationLink href={props.href} asChild>
|
||||
<Pressable accessibilityLabel={props.label} accessibilityRole="button">
|
||||
{content}
|
||||
</Pressable>
|
||||
</Link>
|
||||
</NavigationLink>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { useAuth } from "@clerk/expo";
|
||||
import { Redirect, Stack, useFocusEffect, useRouter } from "../../navigation/router";
|
||||
import {
|
||||
NavigateTo,
|
||||
NativeStackScreenOptions,
|
||||
useFocusEffect,
|
||||
useAppNavigation,
|
||||
} from "../../navigation/native-stack-header";
|
||||
import { useCallback } from "react";
|
||||
import { ScrollView } from "react-native";
|
||||
|
||||
@@ -11,14 +16,14 @@ export default function SettingsWaitlistRouteScreen() {
|
||||
return hasCloudPublicConfig() ? (
|
||||
<ConfiguredSettingsWaitlistRouteScreen />
|
||||
) : (
|
||||
<Redirect href="/settings" />
|
||||
<NavigateTo href="/settings" />
|
||||
);
|
||||
}
|
||||
|
||||
function ConfiguredSettingsWaitlistRouteScreen() {
|
||||
const { isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false });
|
||||
const { expand } = useClerkSettingsSheetDetent();
|
||||
const router = useRouter();
|
||||
const router = useAppNavigation();
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
@@ -30,7 +35,7 @@ function ConfiguredSettingsWaitlistRouteScreen() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen options={{ title: "Join the waitlist" }} />
|
||||
<NativeStackScreenOptions options={{ title: "Join the waitlist" }} />
|
||||
<ScrollView
|
||||
automaticallyAdjustKeyboardInsets
|
||||
contentContainerStyle={{
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import { ThreadFileScreen } from "../../../../../features/files/ThreadFilesRouteScreen";
|
||||
|
||||
export default function ThreadFileRoute() {
|
||||
return <ThreadFileScreen />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { ThreadFilesTreeScreen } from "../../../../../features/files/ThreadFilesRouteScreen";
|
||||
|
||||
export default function ThreadFilesIndexRoute() {
|
||||
return <ThreadFilesTreeScreen />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { GitConfirmSheet } from "../../../../features/threads/git/GitConfirmSheet";
|
||||
|
||||
export default function GitConfirmRoute() {
|
||||
return <GitConfirmSheet />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { GitBranchesSheet } from "../../../../../features/threads/git/GitBranchesSheet";
|
||||
|
||||
export default function GitBranchesRoute() {
|
||||
return <GitBranchesSheet />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { GitCommitSheet } from "../../../../../features/threads/git/GitCommitSheet";
|
||||
|
||||
export default function GitCommitRoute() {
|
||||
return <GitCommitSheet />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { GitOverviewSheet } from "../../../../../features/threads/git/GitOverviewSheet";
|
||||
|
||||
export default function GitRoute() {
|
||||
return <GitOverviewSheet />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { ThreadRouteScreen } from "../../../../features/threads/ThreadRouteScreen";
|
||||
|
||||
export default function ThreadRoute() {
|
||||
return <ThreadRouteScreen />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { ReviewCommentComposerSheet } from "../../../../features/review/ReviewCommentComposerSheet";
|
||||
|
||||
export default function ReviewCommentRoute() {
|
||||
return <ReviewCommentComposerSheet />;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { ReviewHighlighterProvider } from "../../../../features/review/ReviewHighlighterProvider";
|
||||
import { ReviewSheet } from "../../../../features/review/ReviewSheet";
|
||||
|
||||
export default function ReviewRoute() {
|
||||
return (
|
||||
<ReviewHighlighterProvider>
|
||||
<ReviewSheet />
|
||||
</ReviewHighlighterProvider>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { ThreadTerminalRouteScreen } from "../../../../features/terminal/ThreadTerminalRouteScreen";
|
||||
|
||||
export default function ThreadTerminalRoute() {
|
||||
return <ThreadTerminalRouteScreen />;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useGlobalSearchParams } from "../navigation/router";
|
||||
import { useCurrentRouteParams } from "../navigation/native-stack-header";
|
||||
import { createContext, createElement, use, useMemo, useRef, type ReactNode } from "react";
|
||||
import {
|
||||
EnvironmentId,
|
||||
@@ -63,7 +63,7 @@ function threadDetailToShell(
|
||||
}
|
||||
|
||||
function useResolvedThreadSelection() {
|
||||
const params = useGlobalSearchParams<{
|
||||
const params = useCurrentRouteParams<{
|
||||
environmentId?: string | string[];
|
||||
threadId?: string | string[];
|
||||
}>();
|
||||
|
||||
Reference in new issue
Block a user