@devries-cameron20 / t3code-1 / commits / d1b9b23008
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

refactor(mobile): Android's sidebar is the Home route in the sidebar column (#27087)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 3, 2026 at 16:53 UTC d1b9b230081f3159ed3b5c7893f2fecbc0b31ab5
12 files changed +151 -122
apps/mobile/src/Stack.tsx
+3 -2
@@ -50,7 +50,6 @@ import { ConnectOnboardingRouteScreen } from "./features/cloud/ConnectOnboarding
50 import { AttachmentFileScreen } from "./features/files/AttachmentFileScreen";
51 import { ThreadFilesTreeScreen, ThreadFileScreen } from "./features/files/ThreadFilesRouteScreen";
52 import { AdaptiveWorkspaceLayout } from "./features/layout/AdaptiveWorkspaceLayout";
53 -import { selectedPullRequestKey } from "./features/pull-requests/pullRequestSelection";
53 import {
54 HardwareKeyboardCommandOverlay,
55 HardwareKeyboardCommandProvider,
@@ -535,7 +534,6 @@ function RootStackLayout(props: {
534 pathname={workspaceLocation.pathname}
535 workspaceRouteKey={workspaceLocation.routeKey}
536 workspaceRouteName={workspaceLocation.routeName}
538 - selectedPullRequestKey={selectedPullRequestKey(props.state)}
537 >
538 {props.children}
539 <HardwareKeyboardCommandOverlay />
@@ -619,6 +617,9 @@ const RootStackConfig = createWorkspaceStackNavigator({
617 contentStyle: { backgroundColor: "transparent" },
618 headerBackVisible: false,
619 ...getCompactBrandHeaderOptions(),
620 + // Android draws Home's bars itself. Set here, not by the screen: Home also renders in the
621 + // sidebar column, and that copy clears the route's set options when it unmounts.
622 + headerShown: Platform.OS !== "android",
623 },
624 }),
625 PullRequest: createNativeStackScreen({
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+5 -99
@@ -7,10 +7,6 @@ import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area
7 import { AdaptiveWorkspaceContext, useAdaptiveWorkspaceLayout } from "./adaptive-workspace-context";
8 import { threadSelectionDeferral } from "./deferred-navigation";
9 import { uuidv4 } from "../../lib/uuid";
10 -import type {
11 - EnvironmentProject,
12 - EnvironmentThreadShell,
13 -} from "@t3tools/client-runtime/state/shell";
10 import { EnvironmentId, ThreadId, type SidebarProjectGroupingMode } from "@t3tools/contracts";
11 import { useAtomValue } from "@effect/atom-react";
12 import { NavigationContext, NavigationRouteContext, useNavigation } from "@react-navigation/native";
@@ -44,7 +40,6 @@ import {
40 isPrimarySidebarPinned,
41 isWorkspaceListPath,
42 } from "../../lib/layout";
47 -import { scopedThreadKey } from "../../lib/scopedEntities";
43 import type { ThreadListFilters } from "../../persistence/mobile-preferences";
44 import { appAtomRegistry } from "../../state/atom-registry";
45 import { useProjects } from "../../state/entities";
@@ -61,13 +56,11 @@ import {
56 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
57 import { useEnabledNavigationTabs } from "../workspace/navigation-tabs";
58 import { FLOATING_TABS, floatingTabsMetrics } from "../workspace/floating-workspace-tabs";
64 -import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
59 import {
60 AndroidWorkspaceNavigation,
61 FloatingWorkspaceTabs,
62 ANDROID_WORKSPACE_RAIL_WIDTH,
63 } from "../workspace/AndroidWorkspaceNavigation";
70 -import { AndroidWorkspaceSidebar } from "../workspace/AndroidWorkspaceSidebar";
64 import {
65 selectWorkspaceDetail,
66 type WorkspaceDetail,
@@ -77,9 +70,6 @@ import { startOpeningDetail } from "../workspace/useSelectWorkspaceDetail";
70 import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
71 import { HomeListOptionsProvider } from "../home/home-list-options";
72 import { newTaskDestination } from "../threads/new-task-project-selection";
80 -import { usePendingTaskListActions } from "../home/usePendingTaskListActions";
81 -import { ThreadNavigationSidebar } from "../threads/ThreadNavigationSidebar";
82 -import { useOpenThreadPullRequests } from "../threads/use-open-thread-pull-requests";
73 import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
74 import { PaneContext } from "../../components/ui/Pane";
75 import { WORKSPACE_PANE_TIMING } from "./workspace-pane-animation";
@@ -97,7 +87,6 @@ import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
87 import { AndroidHingeObserver } from "../../native/AndroidHingeObserver";
88 import { WindowHingeContext } from "../../native/window-hinge-context";
89 import { useAndroidWorkspaceRoot } from "../workspace/AndroidWorkspaceTabsProvider";
100 -import { openSettings } from "../settings/settings-navigation";
90 import { dispatchRootStackReset, rootStackState } from "../../lib/root-stack-reset";
91 import {
92 currentWorkspaceSelections,
@@ -110,6 +99,7 @@ import {
99 import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
100 import { workspaceRoutesOf } from "./workspace-overlay-routes";
101 import { SettingsWorkspaceLayout } from "../settings/SettingsWorkspaceLayout";
102 +import { WorkspaceThreadSidebar } from "../workspace/WorkspaceThreadSidebar";
103
104 export { useAdaptiveWorkspaceLayout };
105
@@ -187,7 +177,6 @@ export function AdaptiveWorkspaceLayout(props: {
177 readonly pathname: string;
178 readonly workspaceRouteKey: string | undefined;
179 readonly workspaceRouteName: string | undefined;
190 - readonly selectedPullRequestKey?: string | null;
180 }) {
181 const preferencesResult = useAtomValue(mobilePreferencesAtom);
182 if (!AsyncResult.isSuccess(preferencesResult)) {
@@ -214,7 +203,6 @@ function AdaptiveWorkspaceLayoutContent(
203 readonly pathname: string;
204 readonly workspaceRouteKey: string | undefined;
205 readonly workspaceRouteName: string | undefined;
217 - readonly selectedPullRequestKey?: string | null;
206 } & {
207 readonly projectGroupingMode: SidebarProjectGroupingMode;
208 readonly savedThreadListFilters?: ThreadListFilters | undefined;
@@ -375,26 +363,6 @@ function AdaptiveWorkspaceLayoutContent(
363 workspacePage,
364 ],
365 );
378 - const activeThread = parseActiveThreadPath(pathname);
379 - const environmentId = activeThread?.environmentId ?? null;
380 - const threadId = activeThread?.threadId ?? null;
381 - const selectedThreadRef = (() => {
382 - if (environmentId === null || threadId === null) {
383 - return null;
384 - }
385 - try {
386 - return {
387 - environmentId: EnvironmentId.make(environmentId),
388 - threadId: ThreadId.make(threadId),
389 - };
390 - } catch {
391 - return null;
392 - }
393 - })();
394 - const selectedThreadKey =
395 - selectedThreadRef === null
396 - ? null
397 - : scopedThreadKey(selectedThreadRef.environmentId, selectedThreadRef.threadId);
366 // Routes still on the stack remember their reveal, so going back to one keeps the user's choice.
367 const revealedInspectors = useRef<ReadonlyMap<string, string>>(new Map());
368 const workspaceInspectorOwner = useRef<symbol | null>(null);
@@ -570,38 +538,6 @@ function AdaptiveWorkspaceLayoutContent(
538 return true;
539 });
540
573 - // Create at root: the iOS sidebar renders in an independent navigation tree.
574 - const handleOpenEnvironmentSettings = () => {
575 - openSettings(navigation, "SettingsEnvironments");
576 - };
577 -
578 - const handleOpenThreadPullRequests = useOpenThreadPullRequests();
579 - const { openPendingTask: handleOpenPendingTask } =
580 - usePendingTaskListActions(handleSelectThreadRoute);
581 -
582 - const handleNewThreadOnBranch = (thread: EnvironmentThreadShell) => {
583 - handleSelectThreadRoute({
584 - draft: {
585 - requestId: uuidv4(),
586 - environmentId: String(thread.environmentId),
587 - projectId: String(thread.projectId),
588 - branch: thread.branch,
589 - worktreePath: thread.worktreePath,
590 - },
591 - });
592 - };
593 -
594 - const handleNewThreadInProject = (project: EnvironmentProject) => {
595 - handleSelectThreadRoute({
596 - draft: {
597 - requestId: uuidv4(),
598 - environmentId: String(project.environmentId),
599 - projectId: String(project.id),
600 - title: project.title,
601 - },
602 - });
603 - };
604 -
541 const inspectorColumnTargetWidth = panes.auxiliaryPaneVisible
542 ? (panes.auxiliaryPaneWidth ?? 0)
543 : 0;
@@ -776,13 +712,6 @@ function AdaptiveWorkspaceLayoutContent(
712 : ("100%" as const),
713 }));
714
779 - const handleSelectThread = (thread: EnvironmentThreadShell) => {
780 - handleSelectThreadRoute({
781 - environmentId: String(thread.environmentId),
782 - threadId: String(thread.id),
783 - });
784 - };
785 -
715 // Rotating flips the overlay; until the new size reaches JS, predict the reset above.
716 const sidebarOverRotates =
717 nativeWorkspace && nativeMetrics?.hasHinge === true && layout.usesSplitView;
@@ -814,6 +743,7 @@ function AdaptiveWorkspaceLayoutContent(
743 toggleAuxiliaryPane,
744 sidebarToggleable: layout.usesSplitView && !primarySidebarPinned && !workspacePage,
745 togglePrimarySidebar,
746 + revealPrimarySidebar,
747 setPrimarySidebarVisible,
748 openWorkspaceTab,
749 setAuxiliaryPaneWidth: setFileInspectorPreferredWidth,
@@ -838,7 +768,7 @@ function AdaptiveWorkspaceLayoutContent(
768 </HomeListOptionsProvider>
769 );
770 }
841 - const renderColumns = (children: ReactNode) => (
771 + const renderColumns = (children: ReactNode, sidebar?: ReactNode) => (
772 <View
773 testID="adaptive-workspace-layout"
774 className={Platform.OS === "android" ? "flex-1 flex-row bg-header" : "flex-1 flex-row"}
@@ -875,32 +805,8 @@ function AdaptiveWorkspaceLayoutContent(
805 />
806 )}
807 >
878 - <AndroidWorkspaceSidebar
879 - onRequestVisibility={revealPrimarySidebar}
880 - selectedPullRequestKey={props.selectedPullRequestKey ?? null}
881 - >
882 - <AndroidHomeFabLayout
883 - sidebar
884 - disabled={workspacePage}
885 - onStartNewTask={handleStartNewTask}
886 - >
887 - <ThreadNavigationSidebar
888 - width={layout.listPaneWidth}
889 - visible={panes.primarySidebarVisible}
890 - onRequestVisibility={revealPrimarySidebar}
891 - selectedThreadKey={selectedThreadKey}
892 - onOpenSettings={handleOpenSettings}
893 - onOpenEnvironmentSettings={handleOpenEnvironmentSettings}
894 - onNewThreadInProject={handleNewThreadInProject}
895 - onNewThreadOnBranch={handleNewThreadOnBranch}
896 - onOpenPendingTask={handleOpenPendingTask}
897 - onSelectThread={handleSelectThread}
898 - onOpenThreadPullRequests={handleOpenThreadPullRequests}
899 - onSearchQueryChange={setPrimarySidebarSearchQuery}
900 - searchQuery={primarySidebarSearchQuery}
901 - />
902 - </AndroidHomeFabLayout>
903 - </AndroidWorkspaceSidebar>
808 + {/* Without a sidebar route (iPadOS before 26) the columns draw the thread list. */}
809 + {sidebar ?? <WorkspaceThreadSidebar />}
810 </RenderErrorBoundary>
811 </PaneContext>
812 {/* Keep the pill under the content throughout the sidebar's clipping animation. */}
apps/mobile/src/features/layout/adaptive-workspace-context.ts
+3
@@ -34,6 +34,8 @@ interface AdaptiveWorkspaceContextValue {
34 */
35 readonly sidebarToggleable: boolean;
36 readonly togglePrimarySidebar: () => void;
37 + /** Shows the sidebar, setting aside the keyboard or an inspector that took its room. */
38 + readonly revealPrimarySidebar: () => void;
39 readonly setPrimarySidebarVisible: (visible: boolean) => void;
40 /** Opens a workspace tab with its list and, with columns, the page it last showed. */
41 readonly openWorkspaceTab: (
@@ -78,6 +80,7 @@ export const AdaptiveWorkspaceContext = createContext<AdaptiveWorkspaceContextVa
80 toggleAuxiliaryPane: () => undefined,
81 sidebarToggleable: false,
82 togglePrimarySidebar: () => undefined,
83 + revealPrimarySidebar: () => undefined,
84 setPrimarySidebarVisible: () => undefined,
85 openWorkspaceTab: () => undefined,
86 setAuxiliaryPaneWidth: () => undefined,
apps/mobile/src/features/layout/createWorkspaceStackNavigator.android.tsx
+3
@@ -46,6 +46,8 @@ function WorkspaceStackView(props: ViewProps) {
46 if (!visibleRoute) return <NativeStackView {...props} />;
47
48 const visibleDescriptor = props.descriptors[visibleRoute.key]!;
49 + // Home is the sidebar beside the pages, and under them the page shown when none is selected.
50 + const home = workspaceRoutes.find((route) => route.name === "Home");
51 const baseRoute = { key: `${props.state.key}:workspace`, name: "Workspace" };
52 const baseDescriptor: Descriptor = {
53 ...visibleDescriptor,
@@ -61,6 +63,7 @@ function WorkspaceStackView(props: ViewProps) {
63 preloadedRoutes: props.state.preloadedRoutes.filter((route) => !isOverlay(route)),
64 }}
65 />,
66 + home ? props.descriptors[home.key]?.render() : null,
67 ),
68 };
69 const routes = [baseRoute, ...projection.overlays];
apps/mobile/src/features/layout/workspace-presentation-context.tsx
+2 -1
@@ -2,6 +2,7 @@ import { createContext, type ReactElement, type ReactNode } from "react";
2
3 /** Android's native presentation stack surrounds all workspace columns. */
4 export const WorkspacePresentationHostContext = createContext(false);
5 +/** Lays out the workspace columns around the navigator's content and its sidebar route. */
6 export const WorkspaceColumnsRendererContext = createContext<
6 - ((children: ReactNode) => ReactElement) | null
7 + ((content: ReactNode, sidebar: ReactNode) => ReactElement) | null
8 >(null);
apps/mobile/src/features/threads/use-visible-second-clock.ts
+4 -1
@@ -3,6 +3,7 @@ import { secondTick } from "@t3tools/client-runtime/clock";
3 import { useSyncExternalStore } from "react";
4
5 import { useAppActive } from "../../lib/appState";
6 +import { usePaneRole } from "../../components/ui/Pane";
7
8 const subscribeNever = () => () => undefined;
9
@@ -12,8 +13,10 @@ const subscribeNever = () => () => undefined;
13 */
14 export function useVisibleSecondClock(enabled: boolean): number {
15 const focused = useIsFocused();
16 + // The sidebar's route stays unfocused under the page beside it.
17 + const inSidebar = usePaneRole() === "sidebar";
18 const appActive = useAppActive();
16 - const ticking = enabled && focused && appActive;
19 + const ticking = enabled && (focused || inSidebar) && appActive;
20 // While paused the snapshot still reads the shared tick, so resuming shows
21 // the current second rather than the one the clock stopped on.
22 return useSyncExternalStore(
apps/mobile/src/features/workspace/AndroidWorkspaceSidebar.android.tsx
+18 -9
@@ -2,7 +2,7 @@ import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePrefere
2 import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
3 import { useEnabledNavigationTabs } from "./navigation-tabs";
4 import { NAVIGATION_TAB_ORDER } from "./navigation-tab-order";
5 -import { type ReactNode } from "react";
5 +import { useNavigationState } from "@react-navigation/native";
6 import { useSafeAreaInsets } from "react-native-safe-area-context";
7 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
8 import { FLOATING_TABS } from "./floating-workspace-tabs";
@@ -10,20 +10,27 @@ import { View } from "react-native";
10 import { ScreenContent } from "../../components/ui/ScreenContent";
11 import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
12 import { PullRequestToolbar } from "../pull-requests/PullRequestToolbar.android";
13 +import { selectedPullRequestKey } from "../pull-requests/pullRequestSelection";
14 +import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
15 +import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
16 +import { useAndroidWorkspaceRoot } from "./AndroidWorkspaceTabsProvider";
17 import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
18 import { WorkspaceTabPanes } from "./WorkspaceTabPanes";
19 +import { WorkspaceThreadSidebar } from "./WorkspaceThreadSidebar";
20 import { WorkspaceAppBarScope } from "../../components/ui/WorkspaceAppBar.android";
21
17 -export function AndroidWorkspaceSidebar(props: {
18 - readonly children: ReactNode;
19 - readonly onRequestVisibility: () => void;
20 - readonly selectedPullRequestKey: string | null;
21 -}) {
22 +/** The Home route in the sidebar column: the selected tab's list. */
23 +export function AndroidWorkspaceSidebar() {
24 const floatingTabsEnabled = useAndroidFloatingTabs();
25 const workspace = useWorkspaceTabs()!;
26 const enabled = useEnabledNavigationTabs();
27 const insets = useSafeAreaInsets();
28 const { fabSize } = useAndroidControlSizing();
29 + const { revealPrimarySidebar, startNewTask } = useAdaptiveWorkspaceLayout();
30 + const selectedPullRequest = useNavigationState(selectedPullRequestKey);
31 + // Settings and Usage cover the sidebar.
32 + const coveredByPage =
33 + (useAndroidWorkspaceRoot()?.settingsOpen ?? false) || workspace.state.selectedTab === "usage";
34 const bottomClearance = floatingTabsEnabled
35 ? insets.bottom + FLOATING_TABS.bottom + FLOATING_TABS.edge + fabSize
36 : 16;
@@ -36,19 +43,21 @@ export function AndroidWorkspaceSidebar(props: {
43 selected={workspace.state.selectedTab}
44 renderTab={(tab) =>
45 tab === "threads" ? (
39 - props.children
46 + <AndroidHomeFabLayout sidebar disabled={coveredByPage} onStartNewTask={startNewTask}>
47 + <WorkspaceThreadSidebar />
48 + </AndroidHomeFabLayout>
49 ) : tab !== "pullRequests" ? (
50 <View className="flex-1 bg-screen" />
51 ) : (
52 <WorkspaceTabsContext value={context}>
53 <PullRequestsScreen
54 sidebar
46 - selectedPullRequestKey={props.selectedPullRequestKey}
55 + selectedPullRequestKey={selectedPullRequest}
56 renderFrame={(filters, list) => (
57 <View className="flex-1 bg-header">
58 <PullRequestToolbar
59 filters={filters}
51 - onRequestVisibility={props.onRequestVisibility}
60 + onRequestVisibility={revealPrimarySidebar}
61 />
62 <ScreenContent insetHorizontal>{list}</ScreenContent>
63 </View>
apps/mobile/src/features/workspace/AndroidWorkspaceSidebar.tsx deleted
-9
@@ -1,9 +0,0 @@
1 -import type { ReactNode } from "react";
2 -
3 -export function AndroidWorkspaceSidebar(props: {
4 - readonly children: ReactNode;
5 - readonly onRequestVisibility: () => void;
6 - readonly selectedPullRequestKey: string | null;
7 -}) {
8 - return props.children;
9 -}
apps/mobile/src/features/workspace/WorkspaceRootScreen.android.tsx
+6
@@ -19,11 +19,17 @@ import { FLOATING_TABS } from "./floating-workspace-tabs";
19 import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
20 import { WorkspaceTabPanes } from "./WorkspaceTabPanes";
21 import { WorkspaceAppBarScope } from "../../components/ui/WorkspaceAppBar.android";
22 +import { usePaneRole } from "../../components/ui/Pane";
23 +import { AndroidWorkspaceSidebar } from "./AndroidWorkspaceSidebar.android";
24 import type { WorkspaceTab } from "./workspace-tabs-state";
25
26 const TABS: readonly WorkspaceTab[] = NAVIGATION_TAB_ORDER;
27
28 export function WorkspaceRootScreen() {
29 + return usePaneRole() === "sidebar" ? <AndroidWorkspaceSidebar /> : <WorkspaceRoot />;
30 +}
31 +
32 +function WorkspaceRoot() {
33 const floatingTabsEnabled = useAndroidFloatingTabs();
34 const { layout, startNewTask } = useAdaptiveWorkspaceLayout();
35 const workspace = useWorkspaceTabs()!;
apps/mobile/src/features/workspace/WorkspaceThreadSidebar.tsx new
+100
@@ -0,0 +1,100 @@
1 +import type {
2 + EnvironmentProject,
3 + EnvironmentThreadShell,
4 +} from "@t3tools/client-runtime/state/shell";
5 +import { EnvironmentId, ThreadId } from "@t3tools/contracts";
6 +import { useNavigation, useNavigationState } from "@react-navigation/native";
7 +
8 +import { scopedThreadKey } from "../../lib/scopedEntities";
9 +import { uuidv4 } from "../../lib/uuid";
10 +import { usePendingTaskListActions } from "../home/usePendingTaskListActions";
11 +import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
12 +import { openSettings } from "../settings/settings-navigation";
13 +import { ThreadNavigationSidebar } from "../threads/ThreadNavigationSidebar";
14 +import { useOpenThreadPullRequests } from "../threads/use-open-thread-pull-requests";
15 +import { useSelectWorkspaceDetail } from "./useSelectWorkspaceDetail";
16 +
17 +type Route = { readonly name: string; readonly params?: object };
18 +
19 +function selectedThreadKey(state: { readonly index: number; readonly routes: readonly Route[] }) {
20 + const params = state.routes
21 + .slice(0, state.index + 1)
22 + .findLast((route) => route.name.startsWith("Thread"))?.params;
23 + if (
24 + !params ||
25 + !("environmentId" in params) ||
26 + !("threadId" in params) ||
27 + typeof params.environmentId !== "string" ||
28 + typeof params.threadId !== "string"
29 + ) {
30 + return null;
31 + }
32 + try {
33 + return scopedThreadKey(
34 + EnvironmentId.make(params.environmentId),
35 + ThreadId.make(params.threadId),
36 + );
37 + } catch {
38 + return null;
39 + }
40 +}
41 +
42 +/** The thread list in the workspace's sidebar column. */
43 +export function WorkspaceThreadSidebar() {
44 + const navigation = useNavigation();
45 + const {
46 + layout,
47 + panes,
48 + primarySidebarSearchQuery,
49 + setPrimarySidebarSearchQuery,
50 + revealPrimarySidebar,
51 + openWorkspaceTab,
52 + } = useAdaptiveWorkspaceLayout();
53 + const selectDetail = useSelectWorkspaceDetail();
54 + const openThreadPullRequests = useOpenThreadPullRequests();
55 + const selectedThread = useNavigationState(selectedThreadKey);
56 + const selectThreadRoute = (params: ReactNavigation.RootParamList["Thread"]) =>
57 + selectDetail({ name: "Thread", params });
58 + const { openPendingTask } = usePendingTaskListActions(selectThreadRoute);
59 + return (
60 + <ThreadNavigationSidebar
61 + width={layout.listPaneWidth ?? 0}
62 + visible={panes.primarySidebarVisible}
63 + onRequestVisibility={revealPrimarySidebar}
64 + selectedThreadKey={selectedThread}
65 + onOpenSettings={() => openWorkspaceTab("settings")}
66 + onOpenEnvironmentSettings={() => openSettings(navigation, "SettingsEnvironments")}
67 + onNewThreadInProject={(project: EnvironmentProject) =>
68 + selectThreadRoute({
69 + draft: {
70 + requestId: uuidv4(),
71 + environmentId: String(project.environmentId),
72 + projectId: String(project.id),
73 + title: project.title,
74 + },
75 + })
76 + }
77 + onNewThreadOnBranch={(thread: EnvironmentThreadShell) =>
78 + selectThreadRoute({
79 + draft: {
80 + requestId: uuidv4(),
81 + environmentId: String(thread.environmentId),
82 + projectId: String(thread.projectId),
83 + branch: thread.branch,
84 + worktreePath: thread.worktreePath,
85 + },
86 + })
87 + }
88 + onOpenPendingTask={openPendingTask}
89 + onSelectThread={(thread) =>
90 + selectThreadRoute({
91 + environmentId: String(thread.environmentId),
92 + threadId: String(thread.id),
93 + })
94 + }
95 + onOpenThreadPullRequests={openThreadPullRequests}
96 + onSearchQueryChange={setPrimarySidebarSearchQuery}
97 + searchQuery={primarySidebarSearchQuery}
98 + />
99 + );
100 +}
apps/mobile/src/features/workspace/workspace-tabs-state.test.ts
+2
@@ -232,6 +232,8 @@ vi.mock("./AndroidWorkspaceNavigation", () => ({
232 FloatingWorkspaceTabs: () => null,
233 }));
234 vi.mock("./WorkspaceNoTabs", () => ({ WorkspaceNoTabs: () => null }));
235 +vi.mock("../../components/ui/Pane", () => ({ usePaneRole: () => "screen" }));
236 +vi.mock("./AndroidWorkspaceSidebar.android", () => ({ AndroidWorkspaceSidebar: () => null }));
237 vi.mock("../../components/ui/WorkspaceAppBar.android", () => ({
238 WorkspaceAppBarScope: ({ children }: { children: ReactNode }) => children,
239 }));
apps/mobile/src/lib/backHandler.ts
+5 -1
@@ -2,13 +2,17 @@ import { useIsFocused } from "@react-navigation/native";
2 import { useEffect, useEffectEvent } from "react";
3 import { BackHandler } from "react-native";
4
5 +import { usePaneRole } from "../components/ui/Pane";
6 +
7 /**
8 * Android hardware back while `active` and the owning screen is focused.
9 * Keyed on those alone, not `onBack`: BackHandler calls the newest listener
10 * first, so re-registering per render lets a covered screen consume Back.
11 */
12 export function useHardwareBack(active: boolean, onBack: () => boolean) {
11 - const focused = useIsFocused();
13 + // The sidebar's route stays unfocused under the page beside it.
14 + const inSidebar = usePaneRole() === "sidebar";
15 + const focused = useIsFocused() || inSidebar;
16 const handleBack = useEffectEvent(onBack);
17 // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to BackHandler for the focused screen's lifetime
18 useEffect(() => {