@devries-cameron20 / t3code-1 / commits / 29a23fdf14
Fork 0

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

fix(mobile): adapt workspace navigation and expand controls (#12551)

Julius Marminge committed Sep 18, 2026 at 23:58 UTC 29a23fdf1481485593d7d90e195b7c8bf2a705a8
12 files changed +109 -124
apps/mobile/src/Stack.tsx
+38 -23
@@ -11,7 +11,14 @@ import {
11 type NativeStackNavigationOptions,
12 } from "@react-navigation/native-stack";
13 import { useEffect, useRef } from "react";
14 -import { Platform, Pressable, ScrollView, StyleSheet, View } from "react-native";
14 +import {
15 + Platform,
16 + Pressable,
17 + ScrollView,
18 + StyleSheet,
19 + View,
20 + useWindowDimensions,
21 +} from "react-native";
22 import { useResolveClassNames } from "uniwind";
23
24 import { AppText as Text } from "./components/AppText";
@@ -93,6 +100,7 @@ import {
100 transitionIncomingSharePresentation,
101 } from "./features/sharing/incoming-share-presentation";
102 import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native/native-glass";
103 +import { deriveLayout } from "./lib/layout";
104 import { nativeHeaderScrollEdgeEffects } from "./native/StackHeader";
105 import { FORM_SHEET_PRESENTATION_OPTIONS } from "./native/sheet-surface";
106 import { useThreadOutboxDrain } from "./state/use-thread-outbox-drain";
@@ -339,9 +347,8 @@ const SettingsSheetStack = createNativeStackNavigator({
347 // the same deep-link URLs the nested config produced.
348 const THREAD_LINKING_PREFIX = "threads/:environmentId/:threadId";
349
342 -// New-task / add-project flow: nested navigator inside the formSheet (Settings-sheet
343 -// pattern — a plain formSheet screen cannot render a stack header; the header and
344 -// in-sheet pushes come from this nested stack).
350 +// New-task / add-project flow: the nested navigator owns the header and pushes
351 +// whether the flow opens in the workspace or in a compact form sheet.
352 const NewTaskSheetStack = createNativeStackNavigator({
353 initialRouteName: "NewTask",
354 screenOptions: {
@@ -570,7 +577,7 @@ function NotFoundScreen() {
577 );
578 }
579
573 -export const RootStack = createNativeStackNavigator({
580 +const RootStackConfig = createNativeStackNavigator({
581 initialRouteName: "Home",
582 layout: RootStackLayout,
583 screenOptions: {
@@ -698,15 +705,6 @@ export const RootStack = createNativeStackNavigator({
705 options: {
706 gestureEnabled: true,
707 headerShown: false,
701 - // Android pushes settings as a regular full page with an in-screen
702 - // back header; iOS keeps the detented form sheet.
703 - ...(Platform.OS === "android"
704 - ? { presentation: "card" as const }
705 - : {
706 - ...FORM_SHEET_PRESENTATION_OPTIONS,
707 - sheetAllowedDetents: [0.92],
708 - sheetGrabberVisible: true,
709 - }),
708 },
709 }),
710 SettingsLegal: createNativeStackScreen({
@@ -770,15 +768,6 @@ export const RootStack = createNativeStackNavigator({
768 options: {
769 gestureEnabled: true,
770 headerShown: false,
773 - // Android pushes the flow as a regular full page — the draft should
774 - // read like a thread that just doesn't exist yet; iOS keeps the sheet.
775 - ...(Platform.OS === "android"
776 - ? { presentation: "card" as const }
777 - : {
778 - ...FORM_SHEET_PRESENTATION_OPTIONS,
779 - sheetAllowedDetents: [0.92],
780 - sheetGrabberVisible: true,
781 - }),
771 },
772 }),
773 NotFound: createNativeStackScreen({
@@ -787,6 +776,32 @@ export const RootStack = createNativeStackNavigator({
776 }),
777 },
778 });
779 +
780 +export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navigator }) {
781 + const { width, height } = useWindowDimensions();
782 + const usesWorkspaceFlowScreens =
783 + Platform.OS === "android" || deriveLayout({ width, height }).usesSplitView;
784 +
785 + return (
786 + <Navigator
787 + screenOptions={({ route }) => {
788 + if (route.name !== "SettingsSheet" && route.name !== "NewTaskSheet") {
789 + return {};
790 + }
791 +
792 + // Follow the workspace viewport as it resizes; compact iOS keeps sheets.
793 + return usesWorkspaceFlowScreens
794 + ? { presentation: "card" }
795 + : {
796 + ...FORM_SHEET_PRESENTATION_OPTIONS,
797 + sheetAllowedDetents: [0.92],
798 + sheetGrabberVisible: true,
799 + };
800 + }}
801 + />
802 + );
803 +});
804 +
805 type RootStackType = typeof RootStack;
806
807 const navigationPathConfig = {
apps/mobile/src/components/AndroidScreenHeader.tsx
+1 -7
@@ -25,13 +25,7 @@ export function AndroidHeaderIconButton(props: {
25 readonly disabled?: boolean;
26 readonly selected?: boolean;
27 }) {
28 - return (
29 - <MaterialIconButton
30 - {...props}
31 - tintColorClassName="accent-header-foreground"
32 - variant={props.selected ? "tonal" : "standard"}
33 - />
34 - );
28 + return <MaterialIconButton {...props} tintColorClassName="accent-header-foreground" />;
29 }
30
31 export function AndroidScreenHeader(props: {
apps/mobile/src/components/AppSymbol.tsx
+2 -2
@@ -19,7 +19,7 @@ import IconArrowUp from "@tabler/icons-react-native/IconArrowUp";
19 import IconArrowUpCircle from "@tabler/icons-react-native/IconArrowUpCircle";
20 import IconArrowUpRight from "@tabler/icons-react-native/IconArrowUpRight";
21 import IconArrowUpRightCircle from "@tabler/icons-react-native/IconArrowUpRightCircle";
22 -import IconArrowsMaximize from "@tabler/icons-react-native/IconArrowsMaximize";
22 +import IconArrowsDiagonal2 from "@tabler/icons-react-native/IconArrowsDiagonal2";
23 import IconArrowsMinimize from "@tabler/icons-react-native/IconArrowsMinimize";
24 import IconBellRinging from "@tabler/icons-react-native/IconBellRinging";
25 import IconBolt from "@tabler/icons-react-native/IconBolt";
@@ -122,7 +122,7 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
122 "arrow.turn.left.up": IconArrowBackUp,
123 "arrow.up": IconArrowUp,
124 "arrow.up.circle": IconArrowUpCircle,
125 - "arrow.up.left.and.arrow.down.right": IconArrowsMaximize,
125 + "arrow.up.left.and.arrow.down.right": IconArrowsDiagonal2,
126 "arrow.down.right.and.arrow.up.left": IconArrowsMinimize,
127 "arrow.up.right": IconArrowUpRight,
128 "arrow.up.right.circle": IconArrowUpRightCircle,
apps/mobile/src/components/ScreenHeader.tsx
+17 -13
@@ -103,7 +103,7 @@ export function ScreenHeader(props: ScreenHeaderProps) {
103 ...props.options,
104 }}
105 />
106 - {props.sidebar !== false && layout.usesSplitView ? (
106 + {layout.usesSplitView && (props.sidebar !== false || props.backInSplitView) ? (
107 <NativeHeaderToolbar placement="left">
108 {props.backInSplitView && (props.backInSplitView.onPress || props.onBack) ? (
109 <ScreenHeaderButton
@@ -111,18 +111,22 @@ export function ScreenHeader(props: ScreenHeaderProps) {
111 onPress={props.backInSplitView.onPress ?? props.onBack}
112 />
113 ) : null}
114 - <ScreenHeaderButton
115 - accessibilityLabel={
116 - panes.primarySidebarVisible ? `Maximize ${props.title.toLowerCase()}` : "Show threads"
117 - }
118 - icon={
119 - panes.primarySidebarVisible ? "arrow.up.left.and.arrow.down.right" : "sidebar.left"
120 - }
121 - onPress={togglePrimarySidebar}
122 - separateBackground={
123 - props.backInSplitView ? props.backInSplitView.separateBackground : true
124 - }
125 - />
114 + {props.sidebar !== false ? (
115 + <ScreenHeaderButton
116 + accessibilityLabel={
117 + panes.primarySidebarVisible
118 + ? `Maximize ${props.title.toLowerCase()}`
119 + : "Show threads"
120 + }
121 + icon={
122 + panes.primarySidebarVisible ? "arrow.up.left.and.arrow.down.right" : "sidebar.left"
123 + }
124 + onPress={togglePrimarySidebar}
125 + separateBackground={
126 + props.backInSplitView ? props.backInSplitView.separateBackground : true
127 + }
128 + />
129 + ) : null}
130 </NativeHeaderToolbar>
131 ) : null}
132 {(props.actions?.length ||
apps/mobile/src/features/home/HomeRouteScreen.tsx
+4 -10
@@ -11,10 +11,6 @@ import { useWorkspaceState } from "../../state/workspace";
11 import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
12 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
13 import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail";
14 -import {
15 - AndroidWorkspaceSidebarButton,
16 - WorkspaceSidebarToolbar,
17 -} from "../layout/workspace-sidebar-toolbar";
14 import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
15 import { checkForAppUpdateOnLaunch, startAppUpdateForegroundRecheck } from "../updates/app-updates";
16 import { AndroidHomeFabLayout } from "./AndroidHomeFab";
@@ -121,18 +117,16 @@ export function HomeRouteScreen() {
117 : { title: "", headerTitle: "", unstable_headerLeftItems: () => [] }
118 }
119 />
124 - <WorkspaceSidebarToolbar
125 - afterSidebarButton={
120 + {Platform.OS === "ios" ? (
121 + <NativeHeaderToolbar placement="left">
122 <NativeHeaderToolbar.Button
123 accessibilityLabel="New task"
124 icon="square.and.pencil"
125 onPress={() => navigation.navigate("NewTaskSheet", { screen: "NewTask" })}
126 />
131 - }
132 - />
133 - {Platform.OS === "android" ? (
134 - <AndroidScreenHeader title="Threads" leading={<AndroidWorkspaceSidebarButton />} />
127 + </NativeHeaderToolbar>
128 ) : null}
129 + {Platform.OS === "android" ? <AndroidScreenHeader title="Threads" /> : null}
130 <WorkspaceEmptyDetail
131 onAddConnection={
132 Platform.OS === "android" && !catalogState.hasConnections
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+14 -14
@@ -238,6 +238,7 @@ function AdaptiveWorkspaceLayoutContent(
238 const navigation = useNavigation();
239 const activeRoleOwner = useRef<symbol | null>(null);
240 const [primarySidebarPreferredVisible, setPrimarySidebarPreferredVisible] = useState(true);
241 + const showPrimarySidebar = pathname === "/" || primarySidebarPreferredVisible;
242 const [supplementaryPanePreferredVisible, setSupplementaryPanePreferredVisible] = useState(true);
243 const [supplementaryPanePreferredWidth, setSupplementaryPanePreferredWidth] = useState<
244 number | null
@@ -262,17 +263,9 @@ function AdaptiveWorkspaceLayoutContent(
263 viewportWidth: width,
264 preferredWidth: fileInspectorPreferredWidth ?? undefined,
265 reservedLeadingWidth:
265 - shouldRenderPrimarySidebar && primarySidebarPreferredVisible
266 - ? (layout.listPaneWidth ?? 0)
267 - : 0,
266 + shouldRenderPrimarySidebar && showPrimarySidebar ? (layout.listPaneWidth ?? 0) : 0,
267 }),
269 - [
270 - fileInspectorPreferredWidth,
271 - layout,
272 - primarySidebarPreferredVisible,
273 - shouldRenderPrimarySidebar,
274 - width,
275 - ],
268 + [fileInspectorPreferredWidth, layout, showPrimarySidebar, shouldRenderPrimarySidebar, width],
269 );
270 const auxiliaryPaneRole: WorkspaceAuxiliaryPaneRole =
271 focusedAuxiliaryPaneRole ?? (/\/files(?:\/|$)/.test(pathname) ? "inspector" : "supplementary");
@@ -289,7 +282,7 @@ function AdaptiveWorkspaceLayoutContent(
282 deriveWorkspacePaneLayout({
283 layout,
284 viewportWidth: width,
292 - primarySidebarPreferredVisible,
285 + primarySidebarPreferredVisible: showPrimarySidebar,
286 auxiliaryPanePreferredVisible,
287 auxiliaryPaneRole,
288 auxiliaryPanePreferredWidth: auxiliaryPanePreferredWidth ?? undefined,
@@ -299,7 +292,7 @@ function AdaptiveWorkspaceLayoutContent(
292 auxiliaryPaneRole,
293 auxiliaryPanePreferredWidth,
294 layout,
302 - primarySidebarPreferredVisible,
295 + showPrimarySidebar,
296 width,
297 ],
298 );
@@ -357,13 +350,16 @@ function AdaptiveWorkspaceLayoutContent(
350 };
351 }, []);
352 const togglePrimarySidebar = useCallback(() => {
353 + if (pathname === "/") {
354 + return;
355 + }
356 if (!panes.primarySidebarVisible && panes.primarySidebarSuppressedByAuxiliary) {
357 setFileInspectorPreferredVisible(false);
358 setPrimarySidebarPreferredVisible(true);
359 return;
360 }
361 setPrimarySidebarPreferredVisible((current) => !current);
366 - }, [panes.primarySidebarSuppressedByAuxiliary, panes.primarySidebarVisible]);
362 + }, [panes.primarySidebarSuppressedByAuxiliary, panes.primarySidebarVisible, pathname]);
363 const revealPrimarySidebar = useCallback(() => {
364 if (panes.primarySidebarSuppressedByAuxiliary) {
365 setFileInspectorPreferredVisible(false);
@@ -374,7 +370,11 @@ function AdaptiveWorkspaceLayoutContent(
370 togglePrimarySidebar();
371 return true;
372 }, [togglePrimarySidebar]);
377 - useHardwareKeyboardCommand("toggleSidebar", handleToggleSidebarCommand);
373 + const sidebarCommands = useMemo(
374 + () => (pathname === "/" ? [] : (["toggleSidebar"] as const)),
375 + [pathname],
376 + );
377 + useHardwareKeyboardCommand(sidebarCommands, handleToggleSidebarCommand);
378 const showAuxiliaryPane = useCallback((role: WorkspaceAuxiliaryPaneRole) => {
379 if (role === "inspector") {
380 setFocusedAuxiliaryPaneRole("inspector");
apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx
+2 -34
@@ -1,5 +1,3 @@
1 -import { NativeHeaderToolbar } from "../../native/StackHeader";
2 -import type { ReactNode } from "react";
1 import { Platform } from "react-native";
2
3 import { AndroidHeaderIconButton } from "../../components/AndroidScreenHeader";
@@ -12,39 +10,9 @@ export function AndroidWorkspaceSidebarButton() {
10
11 return (
12 <AndroidHeaderIconButton
15 - accessibilityLabel={
16 - panes.primarySidebarVisible ? "Hide thread sidebar" : "Show thread sidebar"
17 - }
18 - icon="sidebar.left"
19 - selected={panes.primarySidebarVisible}
13 + accessibilityLabel={panes.primarySidebarVisible ? "Maximize content" : "Show thread sidebar"}
14 + icon={panes.primarySidebarVisible ? "arrow.up.left.and.arrow.down.right" : "sidebar.left"}
15 onPress={togglePrimarySidebar}
16 />
17 );
18 }
24 -
25 -export function WorkspaceSidebarToolbar(
26 - props: {
27 - readonly children?: ReactNode;
28 - readonly afterSidebarButton?: ReactNode;
29 - } = {},
30 -) {
31 - const { layout, panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
32 -
33 - if (Platform.OS === "android" || !layout.usesSplitView) {
34 - return null;
35 - }
36 -
37 - return (
38 - <NativeHeaderToolbar placement="left">
39 - {props.children}
40 - <NativeHeaderToolbar.Button
41 - accessibilityLabel={
42 - panes.primarySidebarVisible ? "Maximize content" : "Show thread sidebar"
43 - }
44 - icon={panes.primarySidebarVisible ? "arrow.up.left.and.arrow.down.right" : "sidebar.left"}
45 - onPress={togglePrimarySidebar}
46 - />
47 - {props.afterSidebarButton}
48 - </NativeHeaderToolbar>
49 - );
50 -}
apps/mobile/src/features/settings/SettingsRouteScreen.tsx
+13 -2
@@ -6,7 +6,8 @@ import { deriveProjectGroupLabel } from "@t3tools/client-runtime/state/project-g
6 import { useSafeAreaInsets } from "react-native-safe-area-context";
7
8 import { hasCloudPublicConfig } from "../cloud/publicConfig";
9 -import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar";
9 +import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
10 +import { NativeHeaderToolbar } from "../../native/StackHeader";
11 import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
12 import { SettingsRow } from "./components/SettingsRow";
13 import { SettingsSection } from "./components/SettingsSection";
@@ -18,6 +19,8 @@ import {
19 import { useSettingsEnvironmentFilter } from "./settings-environment-filter";
20
21 export function SettingsRouteScreen() {
22 + const navigation = useNavigation();
23 + const { layout } = useAdaptiveWorkspaceLayout();
24 const content = hasCloudPublicConfig() ? (
25 <ConfiguredSettingsRouteScreen />
26 ) : (
@@ -26,7 +29,15 @@ export function SettingsRouteScreen() {
29
30 return (
31 <>
29 - <WorkspaceSidebarToolbar />
32 + {Platform.OS === "ios" && layout.usesSplitView ? (
33 + <NativeHeaderToolbar placement="left">
34 + <NativeHeaderToolbar.Button
35 + accessibilityLabel="Go back"
36 + icon="chevron.left"
37 + onPress={() => navigation.goBack()}
38 + />
39 + </NativeHeaderToolbar>
40 + ) : null}
41 <SettingsEnvironmentFilterHeader closeSettings />
42 {Platform.OS === "android" ? (
43 <SettingsScreen title="Settings" trailing={<AndroidSettingsEnvironmentFilter />}>
apps/mobile/src/features/settings/components/SettingsEnvironmentFilterHeader.tsx
+5 -1
@@ -5,10 +5,13 @@ import { ControlPillMenu } from "../../../components/ControlPill";
5 import { SymbolView } from "../../../components/AppSymbol";
6 import { NativeStackScreenOptions } from "../../../native/StackHeader";
7 import { withNativeGlassHeaderItem } from "../../layout/native-glass-header-items";
8 +import { useAdaptiveWorkspaceLayout } from "../../layout/AdaptiveWorkspaceLayout";
9 import { useSettingsEnvironmentFilter } from "../settings-environment-filter";
10
11 export function SettingsEnvironmentFilterHeader(props: { readonly closeSettings?: boolean }) {
12 const navigation = useNavigation();
13 + const { layout } = useAdaptiveWorkspaceLayout();
14 + const closeSettings = props.closeSettings === true && !layout.usesSplitView;
15 const {
16 availableTargets,
17 selectedTargets,
@@ -26,6 +29,7 @@ export function SettingsEnvironmentFilterHeader(props: { readonly closeSettings?
29 ? "line.3.horizontal.decrease"
30 : "line.3.horizontal.decrease.circle.fill";
31 const filterVersion = JSON.stringify({
32 + closeSettings,
33 selection: selectedIds === null ? null : [...selectedIds].sort(),
34 targets: availableTargets.map((entry) => [entry.environmentId, entry.label, entry.displayUrl]),
35 project: selectedProjectKey,
@@ -94,7 +98,7 @@ export function SettingsEnvironmentFilterHeader(props: { readonly closeSettings?
98 ],
99 },
100 }),
97 - ...(props.closeSettings
101 + ...(closeSettings
102 ? [
103 withNativeGlassHeaderItem({
104 accessibilityLabel: "Close settings",
apps/mobile/src/features/settings/components/SettingsScreen.tsx
+1 -1
@@ -23,7 +23,7 @@ export function SettingsScreen(
23 title={props.title}
24 actions={props.actions}
25 trailing={Platform.OS === "android" ? props.trailing : undefined}
26 - sidebar={Platform.OS === "android" && !props.formSheet}
26 + sidebar={false}
27 onBack={() => navigation.goBack()}
28 hideBottomBorder={!props.formSheet}
29 />
apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
+2 -3
@@ -100,9 +100,8 @@ function TerminalHeader(props: {
100 subtitle={props.subtitle}
101 onBack={props.onCloseTerminal}
102 backInSplitView={{
103 - accessibilityLabel: "Close terminal",
104 - icon: "xmark",
105 - separateBackground: true,
103 + accessibilityLabel: "Back to chat",
104 + icon: "chevron.left",
105 }}
106 menus={
107 props.isEnvironmentReady
apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+10 -14
@@ -98,28 +98,24 @@ function NewTaskHeader(props: {
98 title={props.title}
99 subtitle={props.subtitle ?? undefined}
100 sidebar={false}
101 + backInSplitView={{
102 + accessibilityLabel: "Go back",
103 + icon: "chevron.left",
104 + }}
105 + options={{ headerBackVisible: !layout.usesSplitView }}
106 hideBottomBorder
107 onBack={() => navigation.goBack()}
103 - actions={[
104 - ...(Platform.OS === "ios" && layout.usesSplitView
105 - ? [
106 - {
107 - accessibilityLabel: "Close new task",
108 - icon: "xmark" as const,
109 - onPress: () => navigation.goBack(),
110 - },
111 - ]
112 - : []),
113 - ...(props.canAddProject
108 + actions={
109 + props.canAddProject
110 ? [
111 {
112 accessibilityLabel: "Add project",
117 - icon: "plus" as const,
113 + icon: "plus",
114 onPress: () => navigation.dispatch(StackActions.push("AddProject")),
115 },
116 ]
121 - : []),
122 - ]}
117 + : []
118 + }
119 search={{
120 value: props.searchText,
121 onChangeText: props.onSearchTextChange,