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

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

refactor(mobile): the workspace shell lives in layout and draws the list header

The workspace shell (tabs, dock, toolbars, root screens) sat in features/workspace, so its legitimate platform branches looked like feature code. Home's thread list and the iPad sidebar each built the same brand, search and filter header from raw native options. - features/workspace moves to features/layout/workspace, with the Android pull request app bar. - WorkspaceListHeader draws the list header from typed data on both platforms; brand-title options, sidebar header items and the split empty detail move into the shell. Home and the sidebar share one filter menu definition. - docs/internals/mobile-layout.md describes route presets, the shell's location and the AppBar/inset contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 5, 2026 at 11:07 UTC faf9d7354ce78523e3844d341319d0ebe5a5799d
115 files changed +735 -855
apps/mobile/src/App.tsx
+2 -2
@@ -82,8 +82,8 @@ import {
82 launchWorkspaceURL,
83 recordWorkspaceSelections,
84 settingsLinkPage,
85 -} from "./features/workspace/workspace-selection-store";
86 -import { workspaceDetailLinkAction } from "./features/workspace/workspace-detail-selection";
85 +} from "./features/layout/workspace/workspace-selection-store";
86 +import { workspaceDetailLinkAction } from "./features/layout/workspace/workspace-detail-selection";
87 import { NativeLayoutMetricsProvider } from "./native/native-layout-metrics";
88 import {
89 attachRootNavigation,
apps/mobile/src/Stack.tsx
+5 -5
@@ -18,15 +18,15 @@ import { useResolveClassNames } from "uniwind";
18
19 import { AppText as Text } from "./components/ui/AppText";
20 import { androidWorkspaceDestinationAnimation } from "./lib/android-workspace-navigation";
21 -import { getCompactBrandHeaderOptions } from "./components/CompactBrandTitle";
21 +import { getCompactBrandHeaderOptions } from "./features/layout/workspace/brand-header-options";
22 import { WorkspaceConnectionStatusProvider } from "./features/home/WorkspaceConnectionTitle";
23 -import { WorkspaceRootScreen } from "./features/workspace/WorkspaceRootScreen";
23 +import { WorkspaceRootScreen } from "./features/layout/workspace/WorkspaceRootScreen";
24 import {
25 recordHomeFocus,
26 recordHomeTransitionEnd,
27 recordHomeTransitionStart,
28 } from "./features/home/home-route-visibility";
29 -import { AndroidWorkspaceTabsProvider } from "./features/workspace/AndroidWorkspaceTabsProvider";
29 +import { AndroidWorkspaceTabsProvider } from "./features/layout/workspace/AndroidWorkspaceTabsProvider";
30 import {
31 PullRequestRouteScreen,
32 PullRequestFileRouteScreen,
@@ -128,7 +128,7 @@ import { SettingsRouteScreen } from "./features/settings/SettingsRouteScreen";
128 import { SettingsLabsRouteScreen } from "./features/settings/ThreadSettingsSections";
129 import { SettingsEnvironmentFilterProvider } from "./features/settings/settings-environment-filter";
130 import { openSettings, settingsOpenIn } from "./features/settings/settings-navigation";
131 -import { DEFAULT_SETTINGS_PAGE } from "./features/workspace/workspace-tab-navigation";
131 +import { DEFAULT_SETTINGS_PAGE } from "./features/layout/workspace/workspace-tab-navigation";
132 import {
133 isWorkspaceOverlayRoute,
134 registerPresentedRoutes,
@@ -138,7 +138,7 @@ import { immersiveRoute, modalRoute, pageRoute, sheetRoute } from "./features/la
138 import { deriveLayout } from "./lib/layout";
139 import { useNativeLayoutMetrics } from "./native/native-layout-metrics";
140 import { isPresentedRoute } from "./native/workspace-stack-projection";
141 -import { workspaceDetailRouter } from "./features/workspace/workspace-detail-selection";
141 +import { workspaceDetailRouter } from "./features/layout/workspace/workspace-detail-selection";
142
143 const settingsPage = (title: string) => pageRoute({ title, itemStyle: "standard" });
144
apps/mobile/src/components/CompactBrandTitle.tsx
-16
@@ -1,6 +1,5 @@
1 import { NATIVE_WORKSPACE_COLUMNS_SUPPORTED } from "../native/NativeWorkspaceColumns";
2 import Constants from "expo-constants";
3 -import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
3 import { useState } from "react";
4 import { Platform, View } from "react-native";
5
@@ -93,18 +92,3 @@ export function CompactBrandTitle(
92 title
93 );
94 }
96 -
97 -function renderCompactBrandTitle() {
98 - return <CompactBrandTitle allowFontScaling={Platform.OS === "ios"} />;
99 -}
100 -
101 -export function getCompactBrandHeaderOptions(
102 - fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"],
103 -): NativeStackNavigationOptions {
104 - return {
105 - headerTitle: renderCompactBrandTitle,
106 - headerTitleStyle: fallbackTitleStyle,
107 - title: "Threads",
108 - unstable_headerLeftItems: undefined,
109 - };
110 -}
apps/mobile/src/features/connection/ConnectionsNewRouteScreen.test.tsx
+3 -1
@@ -60,7 +60,9 @@ vi.mock("../settings/settings-navigation", () => ({
60 leaveSettingsPage: vi.fn(),
61 openSettings: vi.fn(),
62 }));
63 -vi.mock("../workspace/workspace-selection-store", () => ({ workspaceHasColumns: () => false }));
63 +vi.mock("../layout/workspace/workspace-selection-store", () => ({
64 + workspaceHasColumns: () => false,
65 +}));
66 vi.mock("../cloud/publicConfig", () => ({ hasCloudPublicConfig: () => false }));
67 vi.mock("./CloudEnvironmentRows", () => ({ CloudEnvironmentRows: () => null }));
68 vi.mock("./environmentSections", () => ({
apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
+1 -1
@@ -30,7 +30,7 @@ import { CloudEnvironmentRows } from "./CloudEnvironmentRows";
30 import { autoConnectReport, devAutoConnectAttemptAtom } from "./devAutoConnect";
31 import { splitEnvironmentSections } from "./environmentSections";
32 import { leaveSettingsPage } from "../settings/settings-navigation";
33 -import { workspaceHasColumns } from "../workspace/workspace-selection-store";
33 +import { workspaceHasColumns } from "../layout/workspace/workspace-selection-store";
34
35 type ConnectionsNewRouteParams = {
36 readonly mode?: string;
apps/mobile/src/features/connection/devAutoConnect.test.ts
+1 -1
@@ -44,7 +44,7 @@ vi.mock("@react-navigation/native", () => ({
44 vi.mock("../../state/use-remote-environment-registry", () => ({
45 pairEnvironment: harness.pair,
46 }));
47 -vi.mock("../workspace/workspace-selection-store", () => ({
47 +vi.mock("../layout/workspace/workspace-selection-store", () => ({
48 workspaceHasColumns: () => harness.columns,
49 }));
50 vi.mock("../../lib/rootNavigation", () => ({
apps/mobile/src/features/connection/devAutoConnect.ts
+1 -1
@@ -6,7 +6,7 @@ import { findLinkedRoute, updateLinkedRoute } from "../../lib/appLinking";
6 import { rootNavigationRef, whenRootNavigationReady } from "../../lib/rootNavigation";
7 import { appAtomRegistry } from "../../state/atom-registry";
8 import { leaveSettingsPage } from "../settings/settings-navigation";
9 -import { workspaceHasColumns } from "../workspace/workspace-selection-store";
9 +import { workspaceHasColumns } from "../layout/workspace/workspace-selection-store";
10 import { pairEnvironment } from "../../state/use-remote-environment-registry";
11
12 export type DevAutoConnectAttempt =
apps/mobile/src/features/development/behavior-probe.ts
+1 -1
@@ -165,7 +165,7 @@ function route() {
165 require("../../lib/rootNavigation") as typeof import("../../lib/rootNavigation");
166 if (!rootNavigationRef.isReady()) return null;
167 const current = rootNavigationRef.getCurrentRoute();
168 - const { workspaceHasColumns } = require("../workspace/workspace-selection-store") as {
168 + const { workspaceHasColumns } = require("../layout/workspace/workspace-selection-store") as {
169 workspaceHasColumns: () => boolean;
170 };
171 return {
apps/mobile/src/features/home/AndroidHomeFab.android.tsx
+3 -3
@@ -15,9 +15,9 @@ import { useWorkspaceState } from "../../state/workspace";
15 import { FabScrollContext } from "./FabScrollContext";
16 import { updateFabScroll } from "./fab-scroll";
17 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
18 -import { WorkspaceTabsContext, useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
19 -import { FLOATING_TABS, floatingTabsMetrics } from "../workspace/floating-workspace-tabs";
20 -import { useEnabledNavigationTabs } from "../workspace/navigation-tabs";
18 +import { WorkspaceTabsContext, useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
19 +import { FLOATING_TABS, floatingTabsMetrics } from "../layout/workspace/floating-workspace-tabs";
20 +import { useEnabledNavigationTabs } from "../layout/workspace/navigation-tabs";
21 import {
22 useAppearancePreferences,
23 useAndroidFloatingTabs,
apps/mobile/src/features/home/HomeHeader.android.tsx deleted
-94
@@ -1,94 +0,0 @@
1 -import type { MenuAction } from "@react-native-menu/menu";
2 -import { ThreadListToolbar } from "./ThreadListToolbar";
3 -import type { HomeHeaderProps } from "./HomeHeader.types";
4 -
5 -export type { HomeHeaderEnvironment } from "./HomeHeader.types";
6 -
7 -function checkedMenuState(checked: boolean) {
8 - return checked ? ("on" as const) : undefined;
9 -}
10 -
11 -export function HomeHeader(props: HomeHeaderProps) {
12 - const hasCustomListOptions =
13 - props.selectedEnvironmentId !== null || props.selectedProjectKey !== null;
14 - const menuActions: MenuAction[] = [
15 - {
16 - id: "environment",
17 - title: "Environment",
18 - subactions: [
19 - {
20 - id: "environment:all",
21 - title: "All environments",
22 - state: checkedMenuState(props.selectedEnvironmentId === null),
23 - },
24 - ...props.environments.map((environment) => ({
25 - id: `environment:${environment.environmentId}`,
26 - title: environment.label,
27 - state: checkedMenuState(props.selectedEnvironmentId === environment.environmentId),
28 - })),
29 - ],
30 - },
31 - ...(props.projects.length === 0
32 - ? []
33 - : ([
34 - {
35 - id: "project",
36 - title: "Project",
37 - subactions: [
38 - {
39 - id: "project:all",
40 - title: "All projects",
41 - state: checkedMenuState(props.selectedProjectKey === null),
42 - },
43 - ...props.projects.map((project) => ({
44 - id: `project:${project.key}`,
45 - title: project.label,
46 - state: checkedMenuState(props.selectedProjectKey === project.key),
47 - })),
48 - ],
49 - },
50 - ] satisfies MenuAction[])),
51 - ];
52 - const handleMenuAction = (event: { nativeEvent: { event: string } }) => {
53 - const id = event.nativeEvent.event;
54 - if (id === "environment:all") {
55 - props.onEnvironmentChange(null);
56 - return;
57 - }
58 -
59 - if (id.startsWith("environment:")) {
60 - const environmentId = id.slice("environment:".length);
61 - const environment = props.environments.find(
62 - (candidate) => candidate.environmentId === environmentId,
63 - );
64 - if (environment) {
65 - props.onEnvironmentChange(environment.environmentId);
66 - }
67 - return;
68 - }
69 -
70 - if (id === "project:all") {
71 - props.onProjectChange(null);
72 - return;
73 - }
74 -
75 - if (id.startsWith("project:")) {
76 - const projectKey = id.slice("project:".length);
77 - if (props.projects.some((project) => project.key === projectKey)) {
78 - props.onProjectChange(projectKey);
79 - }
80 - return;
81 - }
82 - };
83 -
84 - return (
85 - <ThreadListToolbar
86 - searchQuery={props.searchQuery}
87 - onSearchQueryChange={props.onSearchQueryChange}
88 - filterActions={menuActions}
89 - filterCustomized={hasCustomListOptions}
90 - onFilterSelect={(event) => handleMenuAction({ nativeEvent: { event } })}
91 - onOpenEnvironments={props.onOpenEnvironments}
92 - />
93 - );
94 -}
apps/mobile/src/features/home/HomeHeader.tsx deleted
-8
@@ -1,8 +0,0 @@
1 -import type { HomeHeaderProps } from "./HomeHeader.types";
2 -
3 -export type { HomeHeaderEnvironment } from "./HomeHeader.types";
4 -
5 -/** The iOS thread list lives in the workspace, whose WorkspaceToolbar owns its header and search. */
6 -export function HomeHeader(_props: HomeHeaderProps) {
7 - return null;
8 -}
apps/mobile/src/features/home/HomeHeader.types.ts deleted
-21
@@ -1,21 +0,0 @@
1 -import type { EnvironmentId } from "@t3tools/contracts";
2 -import type {
3 - HomeListFilterMenuEnvironment,
4 - HomeListFilterMenuProject,
5 -} from "./home-list-filter-menu";
6 -
7 -export type HomeHeaderEnvironment = HomeListFilterMenuEnvironment;
8 -
9 -export interface HomeHeaderProps {
10 - readonly environments: ReadonlyArray<HomeHeaderEnvironment>;
11 - readonly projects: ReadonlyArray<HomeListFilterMenuProject>;
12 - readonly searchQuery: string;
13 - readonly selectedEnvironmentId: EnvironmentId | null;
14 - readonly selectedProjectKey: string | null;
15 - readonly onSearchQueryChange: (query: string) => void;
16 - readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
17 - readonly onProjectChange: (projectKey: string | null) => void;
18 - readonly onOpenEnvironments: () => void;
19 - readonly onOpenSettings: () => void;
20 - readonly onStartNewTask: () => void;
21 -}
apps/mobile/src/features/home/HomeRouteScreen.tsx
+33 -72
@@ -1,13 +1,12 @@
1 import { uuidv4 } from "../../lib/uuid";
2 import { ThreadUndoNotice } from "./ThreadUndoNotice";
3 -import { Toolbar } from "../../components/ui/Toolbar";
3 import { use } from "react";
4 import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
5 import * as Arr from "effect/Array";
6 import * as Order from "effect/Order";
7 import { useNavigation } from "@react-navigation/native";
8 import { useMemo, useState } from "react";
10 -import { Platform, useWindowDimensions } from "react-native";
9 +import { Platform } from "react-native";
10
11 import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
12 import {
@@ -15,37 +14,30 @@ import {
14 resolveScratchProjectScopeKey,
15 } from "@t3tools/client-runtime/state/project-grouping";
16
18 -import { NativeStackScreenOptions } from "../../native/StackHeader";
17 import { useProjects } from "../../state/entities";
18 import { environmentThreadShells } from "../../state/threads";
19 import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
20 import { useWorkspaceState } from "../../state/workspace";
21 import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
22 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
25 -import { useDeviceType, useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
26 -import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail";
27 -import { AppBar } from "../../components/ui/AppBar";
23 import { AndroidHomeFabLayout } from "./AndroidHomeFab";
24 import { HomeScreen } from "./HomeScreen";
30 -import { HomeHeader } from "./HomeHeader";
25 import { useHomeListOptions } from "./home-list-options";
26 import { useAtomValueWhileVisible, useHomeRouteVisible } from "./home-route-visibility";
27 import { buildHomeProjectScopes } from "./homeThreadList";
28 import { usePendingTaskListActions } from "./usePendingTaskListActions";
29 import { useThreadListActions } from "./useThreadListActions";
36 -import { getConnectionAwareBrandHeaderOptions } from "./WorkspaceConnectionTitle";
37 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
30 +import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
31 import { openSettings } from "../settings/settings-navigation";
39 -import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab";
40 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
32 +import { useSelectWorkspaceTab } from "../layout/workspace/useSelectWorkspaceTab";
33 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
34 +import { WorkspaceListEmptyDetail } from "../layout/workspace/WorkspaceListEmptyDetail";
35 +import { WorkspaceListHeader } from "../layout/workspace/WorkspaceListHeader";
36 +import { buildHomeListFilterMenuItems } from "./home-list-filter-menu";
37
38 export function HomeRouteScreen() {
43 - const { width: windowWidth } = useWindowDimensions();
39 const nativePrimaryColumn = use(NativePrimaryColumnContext);
45 - const columnMetrics = useNativeColumnLayoutMetrics();
46 - const deviceType = useDeviceType();
47 - const headerWidth = nativePrimaryColumn ? (columnMetrics?.width ?? windowWidth) : windowWidth;
48 - const { layout, panes, primarySidebarSearchQuery, setPrimarySidebarSearchQuery, startNewTask } =
40 + const { layout, primarySidebarSearchQuery, setPrimarySidebarSearchQuery, startNewTask } =
41 useAdaptiveWorkspaceLayout();
42 const selectDetail = useSelectWorkspaceDetail();
43 const projects = useProjects();
@@ -161,68 +153,37 @@ export function HomeRouteScreen() {
153
154 if (layout.usesSplitView && !nativePrimaryColumn) {
155 return (
164 - <>
165 - <NativeStackScreenOptions
166 - options={{
167 - title: "",
168 - headerTitle: "",
169 - unstable_headerLeftItems: () => [],
170 - headerSearchBarOptions: undefined,
171 - unstable_headerRightItems: () => [],
172 - unstable_headerToolbarItems: () => [],
173 - }}
174 - />
175 - <Toolbar placement="left">
176 - <Toolbar.Button
177 - accessibilityLabel="New task"
178 - icon="square.and.pencil"
179 - onPress={startNewTask}
180 - />
181 - </Toolbar>
182 - <AppBar embedded title="Threads" />
183 - <WorkspaceEmptyDetail
184 - onAddConnection={
185 - Platform.OS === "android" && !catalogState.hasConnections
186 - ? () => openSettings(navigation, "SettingsEnvironmentNew")
187 - : undefined
188 - }
189 - onStartNewTask={
190 - Platform.OS === "android" && panes.primarySidebarVisible ? undefined : startNewTask
191 - }
192 - />
193 - </>
156 + <WorkspaceListEmptyDetail
157 + hasConnections={catalogState.hasConnections}
158 + onAddConnection={() => openSettings(navigation, "SettingsEnvironmentNew")}
159 + onStartNewTask={startNewTask}
160 + />
161 );
162 }
163
164 return (
198 - <AndroidHomeFabLayout
199 - disabled={workspace !== null && Platform.OS !== "android"}
200 - onStartNewTask={startNewTask}
201 - >
165 + <AndroidHomeFabLayout onStartNewTask={startNewTask}>
166 <>
203 - {/* Screen options merge shallowly; restore the header after split view. */}
204 - {workspace !== null ? null : (
205 - <NativeStackScreenOptions
206 - optionsVersion={headerWidth}
207 - options={getConnectionAwareBrandHeaderOptions({
208 - headerWidth,
209 - trailingItemCount: nativePrimaryColumn && deviceType === "pad" ? 2 : 1,
210 - onOpenEnvironments: () => openSettings(navigation, "SettingsEnvironments"),
211 - })}
212 - />
213 - )}
214 - <HomeHeader
215 - environments={environments}
216 - projects={projectFilterOptions}
217 - searchQuery={searchQuery}
218 - selectedEnvironmentId={selectedEnvironmentId}
219 - selectedProjectKey={selectedProjectKey}
220 - onEnvironmentChange={setSelectedEnvironmentId}
221 - onProjectChange={setSelectedProjectKey}
167 + <WorkspaceListHeader
168 + accessibilityLabel="T3 Code, Threads"
169 onOpenEnvironments={() => openSettings(navigation, "SettingsEnvironments")}
223 - onOpenSettings={() => selectTab("settings")}
224 - onSearchQueryChange={setSearchQuery}
225 - onStartNewTask={startNewTask}
170 + search={{
171 + value: searchQuery,
172 + onChangeText: setSearchQuery,
173 + placeholder: "Search",
174 + accessibilityLabel: "Search threads",
175 + }}
176 + filter={{
177 + customized: selectedEnvironmentId !== null || selectedProjectKey !== null,
178 + items: buildHomeListFilterMenuItems({
179 + environments,
180 + projects: projectFilterOptions,
181 + selectedEnvironmentId,
182 + selectedProjectKey,
183 + onEnvironmentChange: setSelectedEnvironmentId,
184 + onProjectChange: setSelectedProjectKey,
185 + }),
186 + }}
187 />
188
189 <HomeScreen
apps/mobile/src/features/home/HomeScreen.tsx
+5 -4
@@ -47,14 +47,14 @@ import {
47 useNativeColumnLayoutMetrics,
48 useNativeLayoutMetrics,
49 } from "../../native/native-layout-metrics";
50 -import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
50 +import { useWorkspaceListEmptyTopInset } from "../layout/workspace/workspace-list-insets";
51 import { useNativeWorkspaceColumnsSupported } from "../../native/NativeWorkspaceColumns";
52 import { useThreadSearch } from "../../state/queries";
53 import { requestThreadMessageJump } from "../threads/threadMessageJump";
54 import { useThreadListSearchMatches } from "../threads/useThreadListSearchMatches";
55 import { useThreadListV2 } from "../threads/useThreadListV2";
56 import { useThreadListNow } from "../threads/use-thread-list-now";
57 -import { useSearchScrollRestoration } from "../workspace/useSearchScrollRestoration";
57 +import { useSearchScrollRestoration } from "../layout/workspace/useSearchScrollRestoration";
58 import { useThreadJumpShortcuts } from "../keyboard/threadKeyboardShortcuts";
59 import { usePendingThreadOrder } from "../../state/thread-order";
60 import { threadListEnvironmentsAtom } from "../../state/presentation";
@@ -87,7 +87,7 @@ import {
87 import { createSwipeRowActivation } from "./swipe-row-activation";
88 import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "./thread-swipe-actions";
89 import { useFabScroll } from "./FabScrollContext";
90 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
90 +import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
91 import { ThreadListFilters } from "./ThreadListFilters";
92
93 interface HomeScreenProps {
@@ -262,6 +262,7 @@ export function HomeScreen(props: HomeScreenProps) {
262 const openSwipeableRef = useRef<SwipeableMethods | null>(null);
263 const homeScrollGesture = useNativeGesture();
264 const insets = useSafeAreaInsets();
265 + const emptyTopInset = useWorkspaceListEmptyTopInset();
266 const { fabClearance } = useAndroidControlSizing();
267 const screenMetrics = useNativeLayoutMetrics();
268 const contentSideInsets = usesNativeWorkspaceColumns
@@ -682,7 +683,7 @@ export function HomeScreen(props: HomeScreenProps) {
683 style={{
684 paddingBottom:
685 Platform.OS === "ios" ? iosBottomClearance : Math.max(insets.bottom, 24),
685 - paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
686 + paddingTop: emptyTopInset,
687 paddingLeft: 32 + (contentSideInsets?.left ?? 0),
688 paddingRight: 32 + (contentSideInsets?.right ?? 0),
689 }}
apps/mobile/src/features/home/ThreadListFilters.tsx
+16 -16
@@ -1,22 +1,22 @@
1 import { Pressable, ScrollView } from "react-native";
2 import { SymbolView } from "../../components/ui/AppSymbol";
3 -import { ListFilterMenu } from "../workspace/ListFilterMenu";
4 -import type { HomeHeaderProps } from "./HomeHeader.types";
3 +import { ListFilterMenu } from "../layout/workspace/ListFilterMenu";
4 +import type { EnvironmentId } from "@t3tools/contracts";
5 +import type {
6 + HomeListFilterMenuEnvironment,
7 + HomeListFilterMenuProject,
8 +} from "./home-list-filter-menu";
9
6 -export function ThreadListFilters(
7 - props: Pick<
8 - HomeHeaderProps,
9 - | "environments"
10 - | "projects"
11 - | "selectedEnvironmentId"
12 - | "selectedProjectKey"
13 - | "onEnvironmentChange"
14 - | "onProjectChange"
15 - > & {
16 - /** List padding the scroller bleeds through so pills start where row content does. */
17 - readonly gutter: number;
18 - },
19 -) {
10 +export function ThreadListFilters(props: {
11 + readonly environments: ReadonlyArray<HomeListFilterMenuEnvironment>;
12 + readonly projects: ReadonlyArray<HomeListFilterMenuProject>;
13 + readonly selectedEnvironmentId: EnvironmentId | null;
14 + readonly selectedProjectKey: string | null;
15 + readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
16 + readonly onProjectChange: (projectKey: string | null) => void;
17 + /** List padding the scroller bleeds through so pills start where row content does. */
18 + readonly gutter: number;
19 +}) {
20 const selectedEnvironment = props.environments.find(
21 (environment) => environment.environmentId === props.selectedEnvironmentId,
22 );
apps/mobile/src/features/home/ThreadListToolbar.tsx deleted
-6
@@ -1,6 +0,0 @@
1 -import type { ThreadListToolbarProps } from "./ThreadListToolbar.types";
2 -
3 -/** iOS lists use native header items; only Android draws this toolbar. */
4 -export function ThreadListToolbar(_props: ThreadListToolbarProps) {
5 - return null;
6 -}
apps/mobile/src/features/home/ThreadListToolbar.types.ts deleted
-11
@@ -1,11 +0,0 @@
1 -import type { MenuAction } from "@react-native-menu/menu";
2 -
3 -export interface ThreadListToolbarProps {
4 - readonly searchQuery: string;
5 - readonly onSearchQueryChange: (query: string) => void;
6 - readonly filterActions: MenuAction[];
7 - readonly filterCustomized: boolean;
8 - readonly onFilterSelect: (id: string) => void;
9 - readonly onOpenEnvironments: () => void;
10 - readonly onRequestVisibility?: () => void;
11 -}
apps/mobile/src/features/home/ThreadUndoNotice.tsx
+2 -2
@@ -10,8 +10,8 @@ import {
10 useNativeLayoutMetrics,
11 useNativeColumnLayoutMetrics,
12 } from "../../native/native-layout-metrics";
13 -import { workspaceSearchBottomClearance } from "../workspace/workspace-tabs-state";
14 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
13 +import { workspaceSearchBottomClearance } from "../layout/workspace/workspace-tabs-state";
14 +import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
15 import {
16 dismissThreadUndoNotice,
17 readThreadUndoNotice,
apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx
-27
@@ -1,4 +1,3 @@
1 -import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
1 import { createContext, use, useEffect, useState, type ReactNode } from "react";
2 import { Animated, Platform, Pressable, View } from "react-native";
3
@@ -6,11 +5,6 @@ import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
5 import { SymbolView } from "../../components/ui/AppSymbol";
6 import { AppText as Text } from "../../components/ui/AppText";
7 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
9 -import {
10 - brandTitleOffset,
11 - CompactBrandTitle,
12 - getCompactBrandHeaderOptions,
13 -} from "../../components/CompactBrandTitle";
8 import { useDeadlinePassed } from "../../lib/clock";
9 import { useWorkspaceState } from "../../state/workspace";
10 import {
@@ -159,24 +153,3 @@ export function WorkspaceConnectionTitle(props: {
153 </StatusFadeIn>
154 );
155 }
162 -
163 -export function getConnectionAwareBrandHeaderOptions(opts: {
164 - readonly headerWidth: number;
165 - readonly trailingItemCount?: number;
166 - readonly onOpenEnvironments: () => void;
167 - readonly fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"];
168 -}): NativeStackNavigationOptions {
169 - const maxWidth = Math.max(0, opts.headerWidth - 64 - 44 * (opts.trailingItemCount ?? 1));
170 -
171 - return {
172 - ...getCompactBrandHeaderOptions(opts.fallbackTitleStyle),
173 - headerTitle: () => (
174 - <WorkspaceConnectionTitle
175 - brand={<CompactBrandTitle />}
176 - maxWidth={maxWidth}
177 - onPress={opts.onOpenEnvironments}
178 - statusOffset={brandTitleOffset()}
179 - />
180 - ),
181 - };
182 -}
apps/mobile/src/features/home/home-list-filter-menu.ts
+31 -54
@@ -1,5 +1,7 @@
1 import type { EnvironmentId } from "@t3tools/contracts";
2
3 +import type { AppBarMenuItem } from "../../components/ui/AppBar.types";
4 +
5 export interface HomeListFilterMenuEnvironment {
6 readonly environmentId: EnvironmentId;
7 readonly label: string;
@@ -10,82 +12,57 @@ export interface HomeListFilterMenuProject {
12 readonly label: string;
13 }
14
13 -type HomeListFilterMenuAction = {
14 - readonly type: "action";
15 - readonly title: string;
16 - readonly subtitle?: string;
17 - readonly state?: "on" | "off";
18 - readonly onPress: () => void;
19 -};
20 -
21 -type HomeListFilterMenuSubmenu = {
22 - readonly type: "submenu";
23 - readonly title: string;
24 - readonly items: HomeListFilterMenuAction[];
25 -};
26 -
27 -export interface HomeListFilterMenu {
28 - readonly title: string;
29 - readonly items: Array<HomeListFilterMenuAction | HomeListFilterMenuSubmenu>;
30 -}
31 -
32 -export function buildHomeListFilterMenu(props: {
15 +export function buildHomeListFilterMenuItems(props: {
16 readonly environments: ReadonlyArray<HomeListFilterMenuEnvironment>;
17 readonly projects: ReadonlyArray<HomeListFilterMenuProject>;
18 readonly selectedEnvironmentId: EnvironmentId | null;
19 readonly selectedProjectKey: string | null;
20 readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
21 readonly onProjectChange: (projectKey: string | null) => void;
39 -}): HomeListFilterMenu {
40 - const items: Array<HomeListFilterMenuAction | HomeListFilterMenuSubmenu> = [];
41 -
42 - items.push({
43 - type: "submenu",
44 - title: "Environment",
45 - items: [
46 - {
47 - type: "action",
48 - title: "All environments",
49 - subtitle: "Show threads from every environment",
50 - state: props.selectedEnvironmentId === null ? "on" : "off",
51 - onPress: () => props.onEnvironmentChange(null),
52 - },
53 - ...props.environments.map((environment) => ({
54 - type: "action" as const,
55 - title: environment.label,
56 - state:
57 - props.selectedEnvironmentId === environment.environmentId
58 - ? ("on" as const)
59 - : ("off" as const),
60 - onPress: () => props.onEnvironmentChange(environment.environmentId),
61 - })),
62 - ],
63 - });
22 +}): AppBarMenuItem[] {
23 + const items: AppBarMenuItem[] = [
24 + {
25 + id: "environment",
26 + title: "Environment",
27 + items: [
28 + {
29 + id: "environment:all",
30 + title: "All environments",
31 + subtitle: "Show threads from every environment",
32 + selected: props.selectedEnvironmentId === null,
33 + onPress: () => props.onEnvironmentChange(null),
34 + },
35 + ...props.environments.map((environment) => ({
36 + id: `environment:${environment.environmentId}`,
37 + title: environment.label,
38 + selected: props.selectedEnvironmentId === environment.environmentId,
39 + onPress: () => props.onEnvironmentChange(environment.environmentId),
40 + })),
41 + ],
42 + },
43 + ];
44
45 if (props.projects.length > 0) {
46 items.push({
67 - type: "submenu",
47 + id: "project",
48 title: "Project",
49 items: [
50 {
71 - type: "action",
51 + id: "project:all",
52 title: "All projects",
53 subtitle: "Show threads from every project",
74 - state: props.selectedProjectKey === null ? "on" : "off",
54 + selected: props.selectedProjectKey === null,
55 onPress: () => props.onProjectChange(null),
56 },
57 ...props.projects.map((project) => ({
78 - type: "action" as const,
58 + id: `project:${project.key}`,
59 title: project.label,
80 - state: props.selectedProjectKey === project.key ? ("on" as const) : ("off" as const),
60 + selected: props.selectedProjectKey === project.key,
61 onPress: () => props.onProjectChange(project.key),
62 })),
63 ],
64 });
65 }
66
87 - return {
88 - title: "Thread list options",
89 - items,
90 - };
67 + return items;
68 }
apps/mobile/src/features/keyboard/CommandPalette.tsx
+2 -2
@@ -71,8 +71,8 @@ import { parseActiveThreadPath, type HardwareKeyboardCommand } from "./hardwareK
71 import { threadJumpIndex } from "./threadKeyboardShortcuts";
72 import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
73 import { openSettings } from "../settings/settings-navigation";
74 -import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab";
75 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
74 +import { useSelectWorkspaceTab } from "../layout/workspace/useSelectWorkspaceTab";
75 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
76
77 const PALETTE_COMMANDS: ReadonlyArray<HardwareKeyboardCommand> = [
78 "commandPalette",
apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx
+2 -2
@@ -18,7 +18,7 @@ import { copyThreadReference } from "../../lib/copyThreadReference";
18 import {
19 firstWorkspaceDetailOpen,
20 workspaceHasColumns,
21 -} from "../workspace/workspace-selection-store";
21 +} from "../layout/workspace/workspace-selection-store";
22 import { T3KeyboardCommands } from "../../native/T3KeyboardCommands";
23 import { useThreadShell } from "../../state/entities";
24 import type { GitActionProgress } from "../../state/use-vcs-action-state";
@@ -32,7 +32,7 @@ import {
32 subscribeToHardwareKeyboardCommandRegistrations,
33 type HardwareKeyboardCommand,
34 } from "./hardwareKeyboardCommands";
35 -import { selectWorkspaceDetail } from "../workspace/workspace-detail-selection";
35 +import { selectWorkspaceDetail } from "../layout/workspace/workspace-detail-selection";
36
37 const EMPTY_COPY_FEEDBACK: GitActionProgress = {
38 phase: "idle",
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+11 -11
@@ -69,20 +69,20 @@ import {
69 useHardwareKeyboardCommand,
70 } from "../keyboard/hardwareKeyboardCommands";
71 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
72 -import { useEnabledNavigationTabs } from "../workspace/navigation-tabs";
73 -import { FLOATING_TABS, floatingTabsMetrics } from "../workspace/floating-workspace-tabs";
72 +import { useEnabledNavigationTabs } from "./workspace/navigation-tabs";
73 +import { FLOATING_TABS, floatingTabsMetrics } from "./workspace/floating-workspace-tabs";
74 import {
75 AndroidWorkspaceNavigation,
76 FloatingWorkspaceTabs,
77 ANDROID_WORKSPACE_RAIL_WIDTH,
78 -} from "../workspace/AndroidWorkspaceNavigation";
78 +} from "./workspace/AndroidWorkspaceNavigation";
79 import {
80 selectWorkspaceDetail,
81 type WorkspaceDetail,
82 type WorkspaceDetailSheet,
83 -} from "../workspace/workspace-detail-selection";
84 -import { startOpeningDetail } from "../workspace/useSelectWorkspaceDetail";
85 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
83 +} from "./workspace/workspace-detail-selection";
84 +import { startOpeningDetail } from "./workspace/useSelectWorkspaceDetail";
85 +import { useWorkspaceTabs } from "./workspace/WorkspaceTabsContext";
86 import { HomeListOptionsProvider } from "../home/home-list-options";
87 import { newTaskDestination } from "../threads/new-task-project-selection";
88 import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
@@ -103,20 +103,20 @@ import {
103 import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
104 import { AndroidHingeObserver } from "../../native/AndroidHingeObserver";
105 import { WindowHingeContext } from "../../native/window-hinge-context";
106 -import { useAndroidWorkspaceRoot } from "../workspace/AndroidWorkspaceTabsProvider";
106 +import { useAndroidWorkspaceRoot } from "./workspace/AndroidWorkspaceTabsProvider";
107 import { dispatchRootStackReset, rootStackState } from "../../lib/root-stack-reset";
108 import {
109 currentWorkspaceSelections,
110 workspaceSelectionCheck,
111 -} from "../workspace/workspace-selection-store";
111 +} from "./workspace/workspace-selection-store";
112 import {
113 workspaceTabColumns,
114 workspaceTabNavigationState,
115 -} from "../workspace/workspace-tab-navigation";
116 -import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
115 +} from "./workspace/workspace-tab-navigation";
116 +import type { WorkspaceTab } from "./workspace/workspace-tabs-state";
117 import { workspaceRoutesOf } from "./workspace-overlay-routes";
118 import { SettingsWorkspaceLayout } from "../settings/SettingsWorkspaceLayout";
119 -import { WorkspaceThreadSidebar } from "../workspace/WorkspaceThreadSidebar";
119 +import { WorkspaceThreadSidebar } from "./workspace/WorkspaceThreadSidebar";
120
121 export { useAdaptiveWorkspaceLayout };
122
apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
+1 -1
@@ -6,7 +6,7 @@ import { NewThreadButton } from "../../components/NewThreadButton";
6 import { FloatingActionButton } from "../../components/ui/FloatingActionButton";
7 import { EmptyState } from "../../components/ui/EmptyState";
8 import { ScreenContent } from "../../components/ui/ScreenContent";
9 -import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
9 +import type { WorkspaceTab } from "./workspace/workspace-tabs-state";
10
11 export function WorkspaceEmptyDetail(props: {
12 readonly tab?: WorkspaceTab | "settings";
apps/mobile/src/features/layout/adaptive-workspace-context.ts
+2 -5
@@ -1,10 +1,7 @@
1 -import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
1 +import type { WorkspaceTab } from "./workspace/workspace-tabs-state";
2 import { createContext, use } from "react";
3 import type { InspectorContent } from "./inspector-panes";
4 -import type {
5 - WorkspaceDetail,
6 - WorkspaceDetailSheet,
7 -} from "../workspace/workspace-detail-selection";
4 +import type { WorkspaceDetail, WorkspaceDetailSheet } from "./workspace/workspace-detail-selection";
5 import {
6 deriveFileInspectorPaneLayout,
7 deriveLayout,
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+4 -4
@@ -35,15 +35,15 @@ import { GestureHandlerRootView } from "react-native-gesture-handler";
35 import { EnvironmentId, ThreadId } from "@t3tools/contracts";
36 import { NATIVE_INSPECTOR_MIN_MAIN_WIDTH } from "../../lib/layout";
37 import { scopedThreadKey } from "../../lib/scopedEntities";
38 -import { WorkspaceTabsProvider, useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
38 +import { WorkspaceTabsProvider, useWorkspaceTabs } from "./workspace/WorkspaceTabsContext";
39 import {
40 WorkspaceNativeTabs,
41 WorkspaceSidebarTabsFooter,
42 -} from "../workspace/WorkspaceNativeTabs.ios";
43 -import { workspaceUsesColumns } from "../workspace/workspace-tabs-state";
42 +} from "./workspace/WorkspaceNativeTabs.ios";
43 +import { workspaceUsesColumns } from "./workspace/workspace-tabs-state";
44 import { isSettingsRoute, settingsOpenIn } from "../settings/settings-navigation";
45 import { workspaceRoutesOf } from "./workspace-overlay-routes";
46 -import { setNativelyPoppingWorkspaceRoute } from "../workspace/workspace-detail-selection";
46 +import { setNativelyPoppingWorkspaceRoute } from "./workspace/workspace-detail-selection";
47 import { useDeviceType, useNativeLayoutMetrics } from "../../native/native-layout-metrics";
48
49 import { useAdaptiveWorkspaceLayout } from "./AdaptiveWorkspaceLayout";
apps/mobile/src/features/layout/useOpenWorkspaceDetail.ts
+2 -5
@@ -1,11 +1,8 @@
1 import { StackActions, useNavigation } from "@react-navigation/native";
2 import { Platform } from "react-native";
3
4 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
5 -import type {
6 - WorkspaceDetail,
7 - WorkspaceDetailSheet,
8 -} from "../workspace/workspace-detail-selection";
4 +import { useSelectWorkspaceDetail } from "./workspace/useSelectWorkspaceDetail";
5 +import type { WorkspaceDetail, WorkspaceDetailSheet } from "./workspace/workspace-detail-selection";
6
7 /**
8 * Opens a thread or pull request from another page. Android shows one detail page at a time, so
apps/mobile/src/features/layout/workspace/AndroidWorkspaceNavigation.android.tsx renamed
+7 -7
@@ -11,18 +11,18 @@ import {
11 } from "react-native";
12 import { useSafeAreaInsets } from "react-native-safe-area-context";
13
14 -import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
15 -import { useToolbarLayout } from "../../components/ui/useToolbarLayout";
16 -import { rootNavigationRef } from "../../lib/rootNavigation";
17 -import { useWorkspaceConnectionState } from "../../state/workspace";
14 +import { useAndroidControlSizing } from "../../../components/ui/useAndroidControlSizing";
15 +import { useToolbarLayout } from "../../../components/ui/useToolbarLayout";
16 +import { rootNavigationRef } from "../../../lib/rootNavigation";
17 +import { useWorkspaceConnectionState } from "../../../state/workspace";
18 import { androidWorkspaceNavigationColors } from "./android-workspace-navigation-colors";
19 import {
20 androidWorkspaceTabNavigationState,
21 type AndroidWorkspaceNavigationTab,
22 } from "./android-workspace-tabs";
23 -import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
24 -import { useSoftKeyboardShowing } from "../keyboard/useSoftKeyboardShowing";
25 -import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
23 +import { useAppearancePreferences } from "../../settings/appearance/AppearancePreferencesProvider";
24 +import { useSoftKeyboardShowing } from "../../keyboard/useSoftKeyboardShowing";
25 +import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
26 import { useAndroidWorkspaceRoot } from "./AndroidWorkspaceTabsProvider";
27 import { useNavigationTabOrder, useHiddenNavigationTabs } from "./navigation-tabs";
28 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
apps/mobile/src/features/layout/workspace/AndroidWorkspaceNavigation.tsx renamed
apps/mobile/src/features/layout/workspace/AndroidWorkspaceSidebar.android.tsx renamed
+9 -9
@@ -1,23 +1,23 @@
1 -import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
1 +import { useAndroidFloatingTabs } from "../../settings/appearance/AppearancePreferencesProvider";
2 import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
3 import { useEnabledNavigationTabs } from "./navigation-tabs";
4 import { NAVIGATION_TAB_ORDER } from "./navigation-tab-order";
5 import { useNavigationState } from "@react-navigation/native";
6 import { useSafeAreaInsets } from "react-native-safe-area-context";
7 -import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
7 +import { useAndroidControlSizing } from "../../../components/ui/useAndroidControlSizing";
8 import { FLOATING_TABS } from "./floating-workspace-tabs";
9 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";
10 +import { ScreenContent } from "../../../components/ui/ScreenContent";
11 +import { PullRequestsScreen } from "../../pull-requests/PullRequestsScreen";
12 +import { PullRequestToolbar } from "./PullRequestToolbar.android";
13 +import { selectedPullRequestKey } from "../../pull-requests/pullRequestSelection";
14 +import { AndroidHomeFabLayout } from "../../home/AndroidHomeFab";
15 +import { useAdaptiveWorkspaceLayout } from "../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";
20 +import { WorkspaceAppBarScope } from "../../../components/ui/WorkspaceAppBar.android";
21
22 /** The Home route in the sidebar column: the selected tab's list. */
23 export function AndroidWorkspaceSidebar() {
apps/mobile/src/features/layout/workspace/AndroidWorkspaceTabsProvider.tsx renamed
apps/mobile/src/features/layout/workspace/ListFilterMenu.tsx renamed
+4 -4
@@ -1,8 +1,8 @@
1 import { Pressable } from "react-native";
2 -import { Chip } from "../../components/ui/Chip";
3 -import { Menu } from "../../components/ui/Menu";
4 -import type { MenuProps } from "../../components/ui/Menu.types";
5 -import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
2 +import { Chip } from "../../../components/ui/Chip";
3 +import { Menu } from "../../../components/ui/Menu";
4 +import type { MenuProps } from "../../../components/ui/Menu.types";
5 +import { useAppearancePreferences } from "../../settings/appearance/AppearancePreferencesProvider";
6
7 export function ListFilterMenu(props: {
8 readonly label: string;
apps/mobile/src/features/layout/workspace/PullRequestToolbar.android.tsx renamed
+7 -7
@@ -1,13 +1,13 @@
1 import { useNavigation } from "@react-navigation/native";
2 import { useEffect } from "react";
3 import { BackHandler, Keyboard } from "react-native";
4 -import { AppBar } from "../../components/ui/AppBar";
5 -import { appBarMenuItemsFromActions } from "../../components/ui/menuActionItems";
6 -import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
7 -import { WorkspaceBrandTitle } from "../workspace/WorkspaceBrandTitle";
8 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
9 -import type { PullRequestFilterMenu } from "./PullRequestListFilters";
10 -import { openSettings } from "../settings/settings-navigation";
4 +import { AppBar } from "../../../components/ui/AppBar";
5 +import { appBarMenuItemsFromActions } from "../../../components/ui/menuActionItems";
6 +import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
7 +import { WorkspaceBrandTitle } from "./WorkspaceBrandTitle";
8 +import { useWorkspaceTabs } from "./WorkspaceTabsContext";
9 +import type { PullRequestFilterMenu } from "../../pull-requests/PullRequestListFilters";
10 +import { openSettings } from "../../settings/settings-navigation";
11
12 /** PR search shares the thread list's Android header. */
13 export function PullRequestToolbar(props: {
apps/mobile/src/features/layout/workspace/WorkspaceBrandTitle.tsx renamed
+2 -2
@@ -1,5 +1,5 @@
1 -import { CompactBrandTitle } from "../../components/CompactBrandTitle";
2 -import { WorkspaceConnectionTitle } from "../home/WorkspaceConnectionTitle";
1 +import { CompactBrandTitle } from "../../../components/CompactBrandTitle";
2 +import { WorkspaceConnectionTitle } from "../../home/WorkspaceConnectionTitle";
3
4 /** The title of a workspace list tab: the brand and the connection status. */
5 export function WorkspaceBrandTitle(props: {
apps/mobile/src/features/layout/workspace/WorkspaceDock.tsx renamed
+3 -3
@@ -1,10 +1,10 @@
1 import { Keyboard, Pressable, View } from "react-native";
2
3 -import { SymbolView } from "../../components/ui/AppSymbol";
4 -import { GlassSurface } from "../../components/ui/GlassSurface";
3 +import { SymbolView } from "../../../components/ui/AppSymbol";
4 +import { GlassSurface } from "../../../components/ui/GlassSurface";
5 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
6 import { WORKSPACE_DOCK } from "./workspace-tabs-state";
7 -import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
7 +import { PullRequestGlyph } from "../../pull-requests/pullRequestGlyphs";
8
9 export function WorkspaceDock(props: { readonly onNewTask: () => void }) {
10 const workspace = useWorkspaceTabs()!;
apps/mobile/src/features/layout/workspace/WorkspaceExtraTab.tsx renamed
+2 -2
@@ -1,6 +1,6 @@
1 import { type NavigationTab } from "./navigation-tab-order";
2 -import { NativeStackScreenOptions } from "../../native/StackHeader";
3 -import { UsageRouteScreen } from "../usage/UsageRouteScreen";
2 +import { NativeStackScreenOptions } from "../../../native/StackHeader";
3 +import { UsageRouteScreen } from "../../usage/UsageRouteScreen";
4
5 export function WorkspaceExtraTab(_props: {
6 tab: Exclude<NavigationTab, "threads" | "pullRequests">;
apps/mobile/src/features/layout/workspace/WorkspaceListEmptyDetail.tsx new
+51
@@ -0,0 +1,51 @@
1 +import { Platform } from "react-native";
2 +
3 +import { AppBar } from "../../../components/ui/AppBar";
4 +import { Toolbar } from "../../../components/ui/Toolbar";
5 +import { NativeStackScreenOptions } from "../../../native/StackHeader";
6 +import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
7 +import { WorkspaceEmptyDetail } from "../WorkspaceEmptyDetail";
8 +
9 +/**
10 + * The thread list's route in split view, where the list is the sidebar beside it: an empty
11 + * detail. iOS clears the list's bar and keeps only New task.
12 + */
13 +export function WorkspaceListEmptyDetail(props: {
14 + readonly hasConnections: boolean;
15 + readonly onAddConnection: () => void;
16 + readonly onStartNewTask: () => void;
17 +}) {
18 + const { panes } = useAdaptiveWorkspaceLayout();
19 + return (
20 + <>
21 + <NativeStackScreenOptions
22 + options={{
23 + title: "",
24 + headerTitle: "",
25 + unstable_headerLeftItems: () => [],
26 + headerSearchBarOptions: undefined,
27 + unstable_headerRightItems: () => [],
28 + unstable_headerToolbarItems: () => [],
29 + }}
30 + />
31 + <Toolbar placement="left">
32 + <Toolbar.Button
33 + accessibilityLabel="New task"
34 + icon="square.and.pencil"
35 + onPress={props.onStartNewTask}
36 + />
37 + </Toolbar>
38 + <AppBar embedded title="Threads" />
39 + <WorkspaceEmptyDetail
40 + onAddConnection={
41 + Platform.OS === "android" && !props.hasConnections ? props.onAddConnection : undefined
42 + }
43 + onStartNewTask={
44 + Platform.OS === "android" && panes.primarySidebarVisible
45 + ? undefined
46 + : props.onStartNewTask
47 + }
48 + />
49 + </>
50 + );
51 +}
apps/mobile/src/features/layout/workspace/WorkspaceListHeader.android.tsx renamed
+20 -19
@@ -1,16 +1,18 @@
1 import { useEffect, useState } from "react";
2 import { useNavigation, useNavigationState } from "@react-navigation/native";
3 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
3 import { BackHandler, Keyboard } from "react-native";
4
6 -import { AppBar } from "../../components/ui/AppBar";
7 -import { appBarMenuItemsFromActions } from "../../components/ui/menuActionItems";
8 -import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
9 -import { WorkspaceBrandTitle } from "../workspace/WorkspaceBrandTitle";
10 -import { useWorkspaceConnectionState } from "../../state/workspace";
11 -import type { ThreadListToolbarProps } from "./ThreadListToolbar.types";
5 +import { AppBar } from "../../../components/ui/AppBar";
6 +import { useWorkspaceConnectionState } from "../../../state/workspace";
7 +import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
8 +import { WorkspaceBrandTitle } from "./WorkspaceBrandTitle";
9 +import { useWorkspaceTabs } from "./WorkspaceTabsContext";
10 +import {
11 + workspaceListFilterIcon,
12 + type WorkspaceListHeaderProps,
13 +} from "./WorkspaceListHeader.types";
14
13 -export function ThreadListToolbar(props: ThreadListToolbarProps) {
15 +export function WorkspaceListHeader(props: WorkspaceListHeaderProps) {
16 const navigation = useNavigation();
17 const workspace = useWorkspaceTabs();
18 const isTabActive = workspace?.isTabActive;
@@ -18,11 +20,12 @@ export function ThreadListToolbar(props: ThreadListToolbarProps) {
20 const listFocused =
21 homeFocused && (workspace === null || workspace.state.selectedTab === "threads");
22 const connectionState = useWorkspaceConnectionState();
21 - const { onRequestVisibility, onSearchQueryChange } = props;
23 + const { search, sidebar } = props;
24 + const onSearchQueryChange = search.onChangeText;
25 const [searchOpen, setSearchOpen] = useState(false);
23 - const searching = searchOpen || props.searchQuery.length > 0;
26 + const searching = searchOpen || search.value.length > 0;
27 const openSearch = () => {
25 - onRequestVisibility?.();
28 + sidebar?.onRequestVisibility();
29 setSearchOpen(true);
30 return true;
31 };
@@ -58,15 +61,15 @@ export function ThreadListToolbar(props: ThreadListToolbarProps) {
61 title="T3 Code"
62 titleContent={
63 <WorkspaceBrandTitle
61 - accessibilityLabel="T3 Code, Threads"
64 + accessibilityLabel={props.accessibilityLabel}
65 onOpenEnvironments={props.onOpenEnvironments}
66 />
67 }
68 search={{
66 - value: props.searchQuery,
69 + value: search.value,
70 onChangeText: onSearchQueryChange,
68 - placeholder: "Search",
69 - accessibilityLabel: "Search threads",
71 + placeholder: search.placeholder,
72 + accessibilityLabel: search.accessibilityLabel,
73 active: searching,
74 onOpen: openSearch,
75 onClose: closeSearch,
@@ -76,10 +79,8 @@ export function ThreadListToolbar(props: ThreadListToolbarProps) {
79 ? [
80 {
81 title: "Filter threads",
79 - icon: props.filterCustomized
80 - ? "line.3.horizontal.decrease.circle.fill"
81 - : "line.3.horizontal.decrease.circle",
82 - items: appBarMenuItemsFromActions(props.filterActions, props.onFilterSelect),
82 + icon: workspaceListFilterIcon(props.filter.customized),
83 + items: props.filter.items,
84 },
85 ]
86 : undefined
apps/mobile/src/features/layout/workspace/WorkspaceListHeader.tsx new
+70
@@ -0,0 +1,70 @@
1 +import { useRef } from "react";
2 +import type { SearchBarCommands } from "react-native-screens";
3 +
4 +import { NativeStackScreenOptions } from "../../../native/StackHeader";
5 +import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
6 +import { getConnectionAwareBrandHeaderOptions } from "./brand-header-options";
7 +import { createWorkspaceListHeaderItems } from "./workspace-list-header-items";
8 +import {
9 + workspaceListFilterIcon,
10 + type WorkspaceListHeaderProps,
11 +} from "./WorkspaceListHeader.types";
12 +
13 +export function WorkspaceListHeader(props: WorkspaceListHeaderProps) {
14 + return props.sidebar ? <SidebarColumnHeader {...props} sidebar={props.sidebar} /> : null;
15 +}
16 +
17 +function SidebarColumnHeader(
18 + props: WorkspaceListHeaderProps & {
19 + readonly sidebar: NonNullable<WorkspaceListHeaderProps["sidebar"]>;
20 + },
21 +) {
22 + const { search, sidebar } = props;
23 + const searchBarRef = useRef<SearchBarCommands>(null);
24 + useHardwareKeyboardCommand("focusSearch", () => {
25 + const focus = () => searchBarRef.current?.focus();
26 + if (!sidebar.visible) {
27 + sidebar.onRequestVisibility();
28 + // Focus once the revealed sidebar has slid in.
29 + setTimeout(focus, 240);
30 + } else {
31 + focus();
32 + }
33 + return true;
34 + });
35 + const items = createWorkspaceListHeaderItems({
36 + filter: {
37 + accessibilityLabel: "Filter threads",
38 + icon: workspaceListFilterIcon(props.filter.customized),
39 + title: "Thread list options",
40 + items: props.filter.items,
41 + },
42 + onOpenSettings: props.onOpenSettings,
43 + });
44 +
45 + return (
46 + <NativeStackScreenOptions
47 + optionsVersion={[items, sidebar.width]}
48 + options={{
49 + ...getConnectionAwareBrandHeaderOptions({
50 + headerWidth: sidebar.width,
51 + trailingItemCount: items.length,
52 + onOpenEnvironments: props.onOpenEnvironments,
53 + fallbackTitleStyle: { fontSize: 18, fontWeight: "800" },
54 + }),
55 + headerSearchBarOptions: {
56 + ref: searchBarRef,
57 + autoCapitalize: "none",
58 + hideNavigationBar: false,
59 + hideWhenScrolling: false,
60 + obscureBackground: false,
61 + placeholder: search.placeholder,
62 + placement: "stacked",
63 + onCancelButtonPress: () => search.onChangeText(""),
64 + onChangeText: (event) => search.onChangeText(event.nativeEvent.text),
65 + },
66 + unstable_headerRightItems: () => items,
67 + }}
68 + />
69 + );
70 +}
apps/mobile/src/features/layout/workspace/WorkspaceListHeader.types.ts new
+36
@@ -0,0 +1,36 @@
1 +import type { AppBarMenuItem } from "../../../components/ui/AppBar.types";
2 +
3 +/** The header of the workspace thread list, on Home and in the sidebar column. */
4 +export interface WorkspaceListHeaderProps {
5 + /** Spoken for the brand title, such as "T3 Code, Threads". */
6 + readonly accessibilityLabel: string;
7 + /** The connection status beside the brand opens environment settings. */
8 + readonly onOpenEnvironments: () => void;
9 + readonly search: {
10 + readonly value: string;
11 + readonly onChangeText: (value: string) => void;
12 + readonly placeholder: string;
13 + readonly accessibilityLabel: string;
14 + };
15 + readonly filter: {
16 + readonly customized: boolean;
17 + readonly items: ReadonlyArray<AppBarMenuItem>;
18 + };
19 + /** iOS: a settings button. Android reaches Settings from the workspace navigation. */
20 + readonly onOpenSettings?: () => void;
21 + /**
22 + * Set when the list is the workspace's sidebar column, which draws its own bar on iOS. Without
23 + * it the iOS workspace root's toolbar draws the list's bar and search.
24 + */
25 + readonly sidebar?: {
26 + readonly width: number;
27 + readonly visible: boolean;
28 + readonly onRequestVisibility: () => void;
29 + };
30 +}
31 +
32 +export function workspaceListFilterIcon(customized: boolean) {
33 + return customized
34 + ? "line.3.horizontal.decrease.circle.fill"
35 + : "line.3.horizontal.decrease.circle";
36 +}
apps/mobile/src/features/layout/workspace/WorkspaceNativeTabs.ios.tsx renamed
+5 -5
@@ -17,19 +17,19 @@ import {
17 import {
18 NativeWorkspaceTabActivityContext,
19 WorkspaceSlotOptionsContext,
20 -} from "../../native/v5-workspace-context";
20 +} from "../../../native/v5-workspace-context";
21 import {
22 useCompactWorkspaceTabs,
23 useFloatingWorkspaceTabs,
24 useSystemWorkspaceTabBar,
25 } from "./useSystemWorkspaceTabBar";
26 -import { useControlTheme } from "../../components/ui/useControlTheme";
27 -import { useDeviceType } from "../../native/native-layout-metrics";
26 +import { useControlTheme } from "../../../components/ui/useControlTheme";
27 +import { useDeviceType } from "../../../native/native-layout-metrics";
28 import { WorkspaceSidebarTabs } from "./WorkspaceSidebarTabs";
29 -import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
29 +import { useAdaptiveWorkspaceLayout } from "../AdaptiveWorkspaceLayout";
30 import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
31
32 -const PULL_REQUEST_ICON = require("../../../assets/icons/pull-request.png");
32 +const PULL_REQUEST_ICON = require("../../../../assets/icons/pull-request.png");
33
34 /** Retain each native controller tree; removing its root can leave RNS's stack empty. */
35 function RetainedWorkspaceTab(props: {
apps/mobile/src/features/layout/workspace/WorkspaceNoTabs.tsx renamed
+2 -2
@@ -1,7 +1,7 @@
1 import { useNavigation } from "@react-navigation/native";
2 import { View } from "react-native";
3 -import { EmptyState } from "../../components/ui/EmptyState";
4 -import { openSettings } from "../settings/settings-navigation";
3 +import { EmptyState } from "../../../components/ui/EmptyState";
4 +import { openSettings } from "../../settings/settings-navigation";
5
6 export function WorkspaceNoTabs() {
7 const navigation = useNavigation();
apps/mobile/src/features/layout/workspace/WorkspaceRootScreen.android.tsx renamed
+13 -13
@@ -1,4 +1,4 @@
1 -import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
1 +import { useAndroidFloatingTabs } from "../../settings/appearance/AppearancePreferencesProvider";
2 import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
3 import { useEnabledNavigationTabs } from "./navigation-tabs";
4 import { NAVIGATION_TAB_ORDER } from "./navigation-tab-order";
@@ -6,22 +6,22 @@ import { WorkspaceExtraTab } from "./WorkspaceExtraTab";
6 import type { ReactNode } from "react";
7 import { View } from "react-native";
8 import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
9 -import { NativeStackScreenOptions } from "../../native/StackHeader";
10 -import { AppBar } from "../../components/ui/AppBar";
11 -import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail";
12 -import { ScreenContent } from "../../components/ui/ScreenContent";
13 -import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
14 -import { HomeRouteScreen } from "../home/HomeRouteScreen";
15 -import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
16 -import { PullRequestToolbar } from "../pull-requests/PullRequestToolbar.android";
17 -import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
18 -import { WorkspaceSettledContentWidthContext } from "../layout/workspace-content-width";
9 +import { NativeStackScreenOptions } from "../../../native/StackHeader";
10 +import { AppBar } from "../../../components/ui/AppBar";
11 +import { WorkspaceEmptyDetail } from "../WorkspaceEmptyDetail";
12 +import { ScreenContent } from "../../../components/ui/ScreenContent";
13 +import { useAndroidControlSizing } from "../../../components/ui/useAndroidControlSizing";
14 +import { HomeRouteScreen } from "../../home/HomeRouteScreen";
15 +import { PullRequestsScreen } from "../../pull-requests/PullRequestsScreen";
16 +import { PullRequestToolbar } from "./PullRequestToolbar.android";
17 +import { useAdaptiveWorkspaceLayout } from "../AdaptiveWorkspaceLayout";
18 +import { WorkspaceSettledContentWidthContext } from "../workspace-content-width";
19 import { AndroidWorkspaceNavigation, FloatingWorkspaceTabs } from "./AndroidWorkspaceNavigation";
20 import { FLOATING_TABS } from "./floating-workspace-tabs";
21 import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
22 import { WorkspaceTabPanes } from "./WorkspaceTabPanes";
23 -import { WorkspaceAppBarScope } from "../../components/ui/WorkspaceAppBar.android";
24 -import { usePaneRole } from "../../components/ui/Pane";
23 +import { WorkspaceAppBarScope } from "../../../components/ui/WorkspaceAppBar.android";
24 +import { usePaneRole } from "../../../components/ui/Pane";
25 import { AndroidWorkspaceSidebar } from "./AndroidWorkspaceSidebar.android";
26 import type { WorkspaceTab } from "./workspace-tabs-state";
27
apps/mobile/src/features/layout/workspace/WorkspaceRootScreen.tsx renamed
+13 -13
@@ -1,7 +1,7 @@
1 import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
2 import { WORKSPACE_TAB_LABELS, useEnabledNavigationTabs } from "./navigation-tabs";
3 import { WorkspaceExtraTab } from "./WorkspaceExtraTab";
4 -import { WorkspaceSettingsList } from "../settings/SettingsRouteScreen";
4 +import { WorkspaceSettingsList } from "../../settings/SettingsRouteScreen";
5 import { WorkspaceSectionToolbar } from "./WorkspaceSectionToolbar";
6 import { useNavigation } from "@react-navigation/native";
7 import { use } from "react";
@@ -9,21 +9,21 @@ import { View, useWindowDimensions } from "react-native";
9 import { useKeyboardState } from "react-native-keyboard-controller";
10 import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
11
12 -import { CompactBrandTitle } from "../../components/CompactBrandTitle";
13 -import { HeaderItemsWidthContext } from "../../native/header-items-width";
14 -import { NativeStackScreenOptions } from "../../native/StackHeader";
15 -import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
16 -import { isDuoDevice } from "../../lib/device-type";
17 -import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
12 +import { CompactBrandTitle } from "../../../components/CompactBrandTitle";
13 +import { HeaderItemsWidthContext } from "../../../native/header-items-width";
14 +import { NativeStackScreenOptions } from "../../../native/StackHeader";
15 +import { NativePrimaryColumnContext } from "../../../native/v5-workspace-context";
16 +import { isDuoDevice } from "../../../lib/device-type";
17 +import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
18 import {
19 useDeviceType,
20 useNativeColumnLayoutMetrics,
21 useNativeLayoutMetrics,
22 -} from "../../native/native-layout-metrics";
23 -import { HomeRouteScreen } from "../home/HomeRouteScreen";
24 -import { WorkspaceConnectionTitle } from "../home/WorkspaceConnectionTitle";
25 -import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
26 -import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
22 +} from "../../../native/native-layout-metrics";
23 +import { HomeRouteScreen } from "../../home/HomeRouteScreen";
24 +import { WorkspaceConnectionTitle } from "../../home/WorkspaceConnectionTitle";
25 +import { useAdaptiveWorkspaceLayout } from "../AdaptiveWorkspaceLayout";
26 +import { PullRequestsScreen } from "../../pull-requests/PullRequestsScreen";
27 import {
28 WorkspaceTabsContext,
29 WorkspaceTabsProvider,
@@ -37,7 +37,7 @@ import {
37 useSidebarWorkspaceTabs,
38 useSystemWorkspaceTabBar,
39 } from "./useSystemWorkspaceTabBar";
40 -import { openSettings } from "../settings/settings-navigation";
40 +import { openSettings } from "../../settings/settings-navigation";
41
42 const TAB_TITLES = WORKSPACE_TAB_LABELS;
43
apps/mobile/src/features/layout/workspace/WorkspaceSearchField.tsx renamed
+2 -2
@@ -2,8 +2,8 @@ import type { Ref } from "react";
2 import { Keyboard, Pressable, TextInput, View, type TextInputInstance } from "react-native";
3 import { useResolveClassNames } from "uniwind";
4
5 -import { SymbolView } from "../../components/ui/AppSymbol";
6 -import { GlassSurface } from "../../components/ui/GlassSurface";
5 +import { SymbolView } from "../../../components/ui/AppSymbol";
6 +import { GlassSurface } from "../../../components/ui/GlassSurface";
7 import { WORKSPACE_TOOLBAR, type WorkspaceTab } from "./workspace-tabs-state";
8
9 export function WorkspaceSearchField({
apps/mobile/src/features/layout/workspace/WorkspaceSectionToolbar.tsx renamed
+4 -4
@@ -1,7 +1,7 @@
1 import { selectedNavigationTab, visibleNavigationTabs } from "./navigation-tab-order";
2 -import { Toolbar } from "../../components/ui/Toolbar";
3 -import { useControlTheme } from "../../components/ui/useControlTheme";
4 -import { useDeviceType } from "../../native/native-layout-metrics";
2 +import { Toolbar } from "../../../components/ui/Toolbar";
3 +import { useControlTheme } from "../../../components/ui/useControlTheme";
4 +import { useDeviceType } from "../../../native/native-layout-metrics";
5 import {
6 NAVIGATION_TAB_ICONS,
7 WORKSPACE_TAB_LABELS,
@@ -12,7 +12,7 @@ import { useWorkspaceTabs } from "./WorkspaceTabsContext";
12 import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
13 import { useCompactWorkspaceTabs, useSidebarWorkspaceTabs } from "./useSystemWorkspaceTabBar";
14
15 -const PULL_REQUEST_ICON = require("../../../assets/icons/pull-request.png");
15 +const PULL_REQUEST_ICON = require("../../../../assets/icons/pull-request.png");
16
17 export function WorkspaceTabToolbarButtons() {
18 const order = useNavigationTabOrder();
apps/mobile/src/features/layout/workspace/WorkspaceSidebarColumn.android.tsx new
+9
@@ -0,0 +1,9 @@
1 +import type { ReactNode } from "react";
2 +
3 +/** Android draws the sidebar's bar in-tree, so the column needs no stack of its own. */
4 +export function WorkspaceSidebarColumn(props: {
5 + readonly width: number;
6 + readonly children: ReactNode;
7 +}) {
8 + return <>{props.children}</>;
9 +}
apps/mobile/src/features/layout/workspace/WorkspaceSidebarColumn.tsx new
+29
@@ -0,0 +1,29 @@
1 +import type { ReactNode } from "react";
2 +import { StyleSheet, View } from "react-native";
3 +
4 +import { StandaloneStack } from "../nested-stacks";
5 +import { pageRoute } from "../route-options";
6 +import { getCompactBrandHeaderOptions } from "./brand-header-options";
7 +
8 +const SIDEBAR_COLUMN_OPTIONS = {
9 + ...pageRoute(),
10 + ...getCompactBrandHeaderOptions({ fontSize: 18, fontWeight: "800" }),
11 +};
12 +
13 +/** The iOS sidebar column hosts its own stack so it gets a native bar with the brand title. */
14 +export function WorkspaceSidebarColumn(props: {
15 + readonly width: number;
16 + readonly children: ReactNode;
17 +}) {
18 + return (
19 + <View
20 + testID="thread-navigation-sidebar"
21 + className="flex-1 border-border bg-drawer"
22 + style={{ borderRightWidth: StyleSheet.hairlineWidth, width: props.width }}
23 + >
24 + <StandaloneStack surface="sidebar" options={SIDEBAR_COLUMN_OPTIONS}>
25 + {props.children}
26 + </StandaloneStack>
27 + </View>
28 + );
29 +}
apps/mobile/src/features/layout/workspace/WorkspaceSidebarTabs.ios.tsx renamed
+1 -1
@@ -1,7 +1,7 @@
1 import { selectedNavigationTab, visibleNavigationTabs } from "./navigation-tab-order";
2 import { requireNativeView } from "expo";
3 import type { NativeSyntheticEvent, ViewProps } from "react-native";
4 -import { useControlTheme } from "../../components/ui/useControlTheme";
4 +import { useControlTheme } from "../../../components/ui/useControlTheme";
5 import { useNavigationTabOrder, useHiddenNavigationTabs } from "./navigation-tabs";
6 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
7 import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
apps/mobile/src/features/layout/workspace/WorkspaceSidebarTabs.tsx renamed
apps/mobile/src/features/layout/workspace/WorkspaceTabPanes.tsx renamed
apps/mobile/src/features/layout/workspace/WorkspaceTabsContext.tsx renamed
+1 -1
@@ -2,7 +2,7 @@ import { RegistryContext, useAtomValue } from "@effect/atom-react";
2 import { AsyncResult, Atom } from "effect/reactivity";
3 import { createContext, use, useState, type Dispatch, type ReactNode } from "react";
4
5 -import { mobilePreferencesAtom } from "../../state/preferences";
5 +import { mobilePreferencesAtom } from "../../../state/preferences";
6 import {
7 navigationCustomizationAvailable,
8 resolveHiddenNavigationTabs,
apps/mobile/src/features/layout/workspace/WorkspaceThreadSidebar.tsx renamed
+7 -7
@@ -5,13 +5,13 @@ import type {
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";
8 +import { scopedThreadKey } from "../../../lib/scopedEntities";
9 +import { uuidv4 } from "../../../lib/uuid";
10 +import { usePendingTaskListActions } from "../../home/usePendingTaskListActions";
11 +import { useAdaptiveWorkspaceLayout } from "../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 };
apps/mobile/src/features/layout/workspace/WorkspaceToolbar.ios.tsx renamed
+11 -11
@@ -1,21 +1,21 @@
1 -import { useActiveNewTask } from "../../state/active-new-task";
2 -import { Toolbar } from "../../components/ui/Toolbar";
1 +import { useActiveNewTask } from "../../../state/active-new-task";
2 +import { Toolbar } from "../../../components/ui/Toolbar";
3 import { useFocusEffect, useIsFocused } from "@react-navigation/native";
4 import { use, useCallback, useEffect, useRef } from "react";
5 -import { isDuoDevice } from "../../lib/device-type";
6 -import { useDeviceType } from "../../native/native-layout-metrics";
7 -import { createNativeHeaderMenu } from "../../components/ui/nativeHeaderMenu.ios";
8 -import { useSettingsEnvironmentMenu } from "../settings/components/SettingsEnvironmentFilterHeader";
5 +import { isDuoDevice } from "../../../lib/device-type";
6 +import { useDeviceType } from "../../../native/native-layout-metrics";
7 +import { createNativeHeaderMenu } from "../../../components/ui/nativeHeaderMenu.ios";
8 +import { useSettingsEnvironmentMenu } from "../../settings/components/SettingsEnvironmentFilterHeader";
9 import type { SearchBarCommands } from "react-native-screens";
10
11 -import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
12 -import { NativeStackScreenOptions } from "../../native/StackHeader";
11 +import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
12 +import { NativeStackScreenOptions } from "../../../native/StackHeader";
13 import {
14 NativePrimaryColumnContext,
15 NativeWorkspaceTabActivityContext,
16 -} from "../../native/v5-workspace-context";
17 -import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
18 -import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
16 +} from "../../../native/v5-workspace-context";
17 +import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
18 +import { useAdaptiveWorkspaceLayout } from "../AdaptiveWorkspaceLayout";
19 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
20 import { shouldRestoreNativeSearch } from "./workspace-tabs-state";
21 import { useFloatingWorkspaceTabs, useSidebarWorkspaceTabs } from "./useSystemWorkspaceTabBar";
apps/mobile/src/features/layout/workspace/WorkspaceToolbar.tsx renamed
+5 -5
@@ -10,15 +10,15 @@ import {
10 import { KeyboardStickyView, useKeyboardState } from "react-native-keyboard-controller";
11 import { useSafeAreaInsets } from "react-native-safe-area-context";
12
13 -import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
14 -import { GlassSurface } from "../../components/ui/GlassSurface";
15 -import { useHardwareBack } from "../../lib/backHandler";
16 -import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
13 +import { SymbolView, type AppSymbolName } from "../../../components/ui/AppSymbol";
14 +import { GlassSurface } from "../../../components/ui/GlassSurface";
15 +import { useHardwareBack } from "../../../lib/backHandler";
16 +import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
17 import { WorkspaceDock } from "./WorkspaceDock";
18 import { WorkspaceSearchField } from "./WorkspaceSearchField";
19 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
20 import { WORKSPACE_TOOLBAR, type WorkspaceTab } from "./workspace-tabs-state";
21 -import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
21 +import { PullRequestGlyph } from "../../pull-requests/pullRequestGlyphs";
22
23 const TABS: ReadonlyArray<{ id: WorkspaceTab; label: string; icon: AppSymbolName }> = [
24 { id: "threads", label: "Threads", icon: "text.bubble" },
apps/mobile/src/features/layout/workspace/android-workspace-navigation-colors.test.ts renamed
+4 -4
@@ -1,10 +1,10 @@
1 import { describe, expect, it } from "vite-plus/test";
2 import { Hct, SchemeTonalSpot, argbFromHex, hexFromArgb } from "@material/material-color-utilities";
3
4 -import { MOBILE_THEME_IDS } from "../../lib/mobileTheme";
5 -import { getMobileThemeRuntimeVariables } from "../../lib/mobileThemeVariables";
6 -import { materialYouPaletteToMobileThemeVariables } from "../../lib/materialYouTheme.android";
7 -import type { MaterialYouPalette } from "../../lib/materialYouPalette";
4 +import { MOBILE_THEME_IDS } from "../../../lib/mobileTheme";
5 +import { getMobileThemeRuntimeVariables } from "../../../lib/mobileThemeVariables";
6 +import { materialYouPaletteToMobileThemeVariables } from "../../../lib/materialYouTheme.android";
7 +import type { MaterialYouPalette } from "../../../lib/materialYouPalette";
8 import { androidWorkspaceNavigationColors } from "./android-workspace-navigation-colors";
9
10 function luminance(hex: string) {
apps/mobile/src/features/layout/workspace/android-workspace-navigation-colors.ts renamed
+1 -1
@@ -4,7 +4,7 @@ import {
4 themeColorWithAlpha,
5 themeColorWithContrast,
6 type MobileThemeVariables,
7 -} from "../../lib/mobileTheme";
7 +} from "../../../lib/mobileTheme";
8
9 // A dark page swallows the native shadow, so the fill alone has to lift the pill off the page
10 // and off the cards it floats over.
apps/mobile/src/features/layout/workspace/android-workspace-tabs.ts renamed
+2 -2
@@ -1,10 +1,10 @@
1 import type { NavigationState } from "@react-navigation/native";
2 -import { androidWorkspaceNavigationState } from "../../lib/android-workspace-navigation";
2 +import { androidWorkspaceNavigationState } from "../../../lib/android-workspace-navigation";
3 import {
4 isSettingsRoute,
5 settingsNavigationState,
6 settingsOpenIn,
7 -} from "../settings/settings-navigation";
7 +} from "../../settings/settings-navigation";
8 import type { WorkspaceTab } from "./workspace-tabs-state";
9 import { rememberedSettingsPage, workspaceSelectionsIn } from "./workspace-tab-navigation";
10
apps/mobile/src/features/layout/workspace/brand-header-options.tsx new
+41
@@ -0,0 +1,41 @@
1 +import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
2 +import { Platform } from "react-native";
3 +
4 +import { brandTitleOffset, CompactBrandTitle } from "../../../components/CompactBrandTitle";
5 +import { WorkspaceConnectionTitle } from "../../home/WorkspaceConnectionTitle";
6 +
7 +function renderCompactBrandTitle() {
8 + return <CompactBrandTitle allowFontScaling={Platform.OS === "ios"} />;
9 +}
10 +
11 +export function getCompactBrandHeaderOptions(
12 + fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"],
13 +): NativeStackNavigationOptions {
14 + return {
15 + headerTitle: renderCompactBrandTitle,
16 + headerTitleStyle: fallbackTitleStyle,
17 + title: "Threads",
18 + unstable_headerLeftItems: undefined,
19 + };
20 +}
21 +
22 +export function getConnectionAwareBrandHeaderOptions(opts: {
23 + readonly headerWidth: number;
24 + readonly trailingItemCount?: number;
25 + readonly onOpenEnvironments: () => void;
26 + readonly fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"];
27 +}): NativeStackNavigationOptions {
28 + const maxWidth = Math.max(0, opts.headerWidth - 64 - 44 * (opts.trailingItemCount ?? 1));
29 +
30 + return {
31 + ...getCompactBrandHeaderOptions(opts.fallbackTitleStyle),
32 + headerTitle: () => (
33 + <WorkspaceConnectionTitle
34 + brand={<CompactBrandTitle />}
35 + maxWidth={maxWidth}
36 + onPress={opts.onOpenEnvironments}
37 + statusOffset={brandTitleOffset()}
38 + />
39 + ),
40 + };
41 +}
apps/mobile/src/features/layout/workspace/floating-workspace-tabs.test.ts renamed
+1 -1
@@ -1,7 +1,7 @@
1 import { expect, it } from "vite-plus/test";
2
3 import { floatingTabsMetrics } from "./floating-workspace-tabs";
4 -import { resolveAndroidNavigationStyle } from "../../lib/androidNavigationStyle";
4 +import { resolveAndroidNavigationStyle } from "../../../lib/androidNavigationStyle";
5
6 it.each([
7 [undefined, "Samsung", false, "one-ui"],
apps/mobile/src/features/layout/workspace/floating-workspace-tabs.ts renamed
apps/mobile/src/features/layout/workspace/navigation-tab-order.test.ts renamed
apps/mobile/src/features/layout/workspace/navigation-tab-order.ts renamed
apps/mobile/src/features/layout/workspace/navigation-tabs.ts renamed
+3 -3
@@ -8,9 +8,9 @@ import {
8 enabledNavigationTabs,
9 type NavigationTab,
10 } from "./navigation-tab-order";
11 -import type { AppSymbolName } from "../../components/ui/AppSymbol";
12 -import { mobilePreferencesAtom } from "../../state/preferences";
13 -import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
11 +import type { AppSymbolName } from "../../../components/ui/AppSymbol";
12 +import { mobilePreferencesAtom } from "../../../state/preferences";
13 +import { PullRequestGlyph } from "../../pull-requests/pullRequestGlyphs";
14 import { resolveWorkspaceTabOrder } from "./workspace-tabs-state";
15
16 export const WORKSPACE_TAB_LABELS = {
apps/mobile/src/features/layout/workspace/useAndroidWorkspaceNavigation.ts renamed
+1 -1
@@ -4,7 +4,7 @@ import { BackHandler, Keyboard, Platform } from "react-native";
4 import {
5 resetAndroidWorkspace,
6 returnToAndroidWorkspaceList,
7 -} from "../../lib/android-workspace-navigation";
7 +} from "../../../lib/android-workspace-navigation";
8 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
9 import type { WorkspaceTab } from "./workspace-tabs-state";
10
apps/mobile/src/features/layout/workspace/useSearchScrollRestoration.test.tsx renamed
apps/mobile/src/features/layout/workspace/useSearchScrollRestoration.ts renamed
apps/mobile/src/features/layout/workspace/useSelectWorkspaceDetail.ts renamed
+2 -2
@@ -1,7 +1,7 @@
1 import { EnvironmentId, ThreadId } from "@t3tools/contracts";
2 import { useNavigation } from "@react-navigation/native";
3 -import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
4 -import { startOpeningEnvironmentThread } from "../../state/threads";
3 +import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
4 +import { startOpeningEnvironmentThread } from "../../../state/threads";
5 import {
6 selectWorkspaceDetail,
7 type WorkspaceDetail,
apps/mobile/src/features/layout/workspace/useSelectWorkspaceTab.ts renamed
+1 -1
@@ -1,6 +1,6 @@
1 import { Keyboard } from "react-native";
2
3 -import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
3 +import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
4 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
5 import type { WorkspaceTab } from "./workspace-tabs-state";
6
apps/mobile/src/features/layout/workspace/useSystemWorkspaceTabBar.ts renamed
+4 -4
@@ -1,8 +1,8 @@
1 -import { isDuoDevice } from "../../lib/device-type";
1 +import { isDuoDevice } from "../../../lib/device-type";
2 import { Platform } from "react-native";
3 -import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
4 -import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
5 -import { useDeviceType, useNativeLayoutMetrics } from "../../native/native-layout-metrics";
3 +import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
4 +import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
5 +import { useDeviceType, useNativeLayoutMetrics } from "../../../native/native-layout-metrics";
6 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
7 import { workspaceUsesColumns } from "./workspace-tabs-state";
8
apps/mobile/src/features/layout/workspace/workspace-detail-selection.test.ts renamed
apps/mobile/src/features/layout/workspace/workspace-detail-selection.ts renamed
+1 -1
@@ -6,7 +6,7 @@ import type {
6 Router,
7 StackNavigationState,
8 } from "@react-navigation/native";
9 -import { workspaceRoutesOf } from "../layout/workspace-overlay-routes";
9 +import { workspaceRoutesOf } from "../workspace-overlay-routes";
10
11 type RootParams = ReactNavigation.RootParamList;
12
apps/mobile/src/features/layout/workspace/workspace-list-header-items.ts new
+69
@@ -0,0 +1,69 @@
1 +import type {
2 + NativeStackHeaderItem,
3 + NativeStackHeaderItemMenu,
4 +} from "@react-navigation/native-stack";
5 +
6 +import type { AppBarMenuItem } from "../../../components/ui/AppBar.types";
7 +import { withNativeGlassHeaderItem } from "../native-glass-header-items";
8 +
9 +type NativeHeaderMenuItems = NativeStackHeaderItemMenu["menu"]["items"];
10 +type NativeHeaderIcon = NonNullable<Extract<NativeStackHeaderItem, { type: "button" }>["icon"]>;
11 +
12 +function sfSymbolIcon(name: string): NativeHeaderIcon {
13 + return { type: "sfSymbol", name: name as never };
14 +}
15 +
16 +function toNativeHeaderMenuItems(items: ReadonlyArray<AppBarMenuItem>): NativeHeaderMenuItems {
17 + return items.map((item) =>
18 + "items" in item
19 + ? {
20 + type: "submenu" as const,
21 + label: item.title ?? "",
22 + items: toNativeHeaderMenuItems(item.items),
23 + }
24 + : {
25 + type: "action" as const,
26 + label: item.title,
27 + description: item.subtitle,
28 + onPress: item.onPress,
29 + state: item.selected ? ("on" as const) : undefined,
30 + },
31 + );
32 +}
33 +
34 +/** The sidebar column's bar items, as native header items so the title can size around them. */
35 +export function createWorkspaceListHeaderItems(input: {
36 + readonly filter: {
37 + readonly accessibilityLabel: string;
38 + readonly icon: string;
39 + readonly title: string;
40 + readonly items: ReadonlyArray<AppBarMenuItem>;
41 + };
42 + readonly onOpenSettings?: () => void;
43 +}): NativeStackHeaderItem[] {
44 + return [
45 + withNativeGlassHeaderItem({
46 + type: "menu",
47 + axisBehavior: "horizontalOnly",
48 + label: "",
49 + accessibilityLabel: input.filter.accessibilityLabel,
50 + icon: sfSymbolIcon(input.filter.icon),
51 + menu: {
52 + title: input.filter.title,
53 + items: toNativeHeaderMenuItems(input.filter.items),
54 + },
55 + }),
56 + ...(input.onOpenSettings
57 + ? [
58 + withNativeGlassHeaderItem({
59 + type: "button",
60 + axisBehavior: "horizontalOnly",
61 + label: "Settings",
62 + accessibilityLabel: "Open settings",
63 + icon: sfSymbolIcon("gearshape"),
64 + onPress: input.onOpenSettings,
65 + }),
66 + ]
67 + : []),
68 + ];
69 +}
apps/mobile/src/features/layout/workspace/workspace-list-insets.ts new
+15
@@ -0,0 +1,15 @@
1 +import { useSafeAreaInsets } from "react-native-safe-area-context";
2 +
3 +import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
4 +
5 +/** A workspace list scrolls under its bar where the bar is glass; under a solid bar it starts below. */
6 +export const WORKSPACE_LIST_SCROLL_INSETS = {
7 + automaticallyAdjustsScrollIndicatorInsets: NATIVE_LIQUID_GLASS_SUPPORTED,
8 + contentInsetAdjustmentBehavior: NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never",
9 +} as const;
10 +
11 +/** How far an empty workspace list keeps its message below a glass bar and its search. */
12 +export function useWorkspaceListEmptyTopInset(): number {
13 + const insets = useSafeAreaInsets();
14 + return NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0;
15 +}
apps/mobile/src/features/layout/workspace/workspace-selection-store.ts renamed
+11 -11
@@ -3,27 +3,27 @@ import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
3 import * as Linking from "expo-linking";
4 import { AppState, Dimensions, Platform } from "react-native";
5
6 -import { environmentCatalog } from "../../connection/catalog";
7 -import { deriveLayout } from "../../lib/layout";
6 +import { environmentCatalog } from "../../../connection/catalog";
7 +import { deriveLayout } from "../../../lib/layout";
8 import {
9 NATIVE_METRICS_TIMEOUT_MS,
10 nativeWorkspaceColumnsSupportedFor,
11 -} from "../../native/NativeWorkspaceColumns";
11 +} from "../../../native/NativeWorkspaceColumns";
12 import {
13 currentNativeLayoutMetrics,
14 firstNativeLayoutMetrics,
15 -} from "../../native/native-layout-metrics";
16 -import { loadPreferences, savePreferencesPatch } from "../../persistence/imperative";
17 -import { rootStackState, type RootStackNavigation } from "../../lib/root-stack-reset";
18 -import { workspaceRoutesOf } from "../layout/workspace-overlay-routes";
19 -import type { WorkspaceSelections } from "../../persistence/mobile-preferences";
20 -import { appAtomRegistry } from "../../state/atom-registry";
21 -import { environmentPresentations } from "../../state/presentation";
15 +} from "../../../native/native-layout-metrics";
16 +import { loadPreferences, savePreferencesPatch } from "../../../persistence/imperative";
17 +import { rootStackState, type RootStackNavigation } from "../../../lib/root-stack-reset";
18 +import { workspaceRoutesOf } from "../workspace-overlay-routes";
19 +import type { WorkspaceSelections } from "../../../persistence/mobile-preferences";
20 +import { appAtomRegistry } from "../../../state/atom-registry";
21 +import { environmentPresentations } from "../../../state/presentation";
22 import {
23 environmentThreadShells,
24 startOpeningEnvironmentThread,
25 threadEnvironment,
26 -} from "../../state/threads";
26 +} from "../../../state/threads";
27 import {
28 rememberedSettingsPage,
29 workspaceSelectionsIn,
apps/mobile/src/features/layout/workspace/workspace-tab-navigation.test.ts renamed
+1 -1
@@ -1,6 +1,6 @@
1 import { describe, expect, it } from "vite-plus/test";
2
3 -import { restoreSettingsLinkState } from "../settings/settings-navigation";
3 +import { restoreSettingsLinkState } from "../../settings/settings-navigation";
4 import {
5 workspaceSelectionsIn,
6 workspaceTabColumns,
apps/mobile/src/features/layout/workspace/workspace-tab-navigation.ts renamed
+3 -3
@@ -1,9 +1,9 @@
1 -import type { WorkspaceSelections } from "../../persistence/mobile-preferences";
1 +import type { WorkspaceSelections } from "../../../persistence/mobile-preferences";
2 import {
3 SETTINGS_PAGE_TARGETS,
4 type SettingsPageTarget,
5 -} from "../settings/components/settings-page-targets";
6 -import { settingsNavigationState } from "../settings/settings-navigation";
5 +} from "../../settings/components/settings-page-targets";
6 +import { settingsNavigationState } from "../../settings/settings-navigation";
7 import type { WorkspaceTab } from "./workspace-tabs-state";
8
9 type RouteLike = {
apps/mobile/src/features/layout/workspace/workspace-tabs-state.test.ts renamed
+13 -13
@@ -181,7 +181,7 @@ describe("workspace root navigation", () => {
181
182 const mocks = vi.hoisted(() => ({ split: false, floating: false }));
183
184 -vi.mock("../settings/appearance/AppearancePreferencesProvider", () => ({
184 +vi.mock("../../settings/appearance/AppearancePreferencesProvider", () => ({
185 useAndroidFloatingTabs: () => mocks.floating,
186 }));
187 vi.mock("react-native", () => ({
@@ -192,7 +192,7 @@ vi.mock("react-native-safe-area-context", () => ({
192 SafeAreaInsetsContext: createContext({ top: 0, right: 0, bottom: 24, left: 0 }),
193 useSafeAreaInsets: () => ({ top: 0, right: 0, bottom: 24, left: 0 }),
194 }));
195 -vi.mock("../layout/AdaptiveWorkspaceLayout", () => ({
195 +vi.mock("../AdaptiveWorkspaceLayout", () => ({
196 useAdaptiveWorkspaceLayout: () => ({
197 layout: { usesSplitView: mocks.split },
198 startNewTask: () => undefined,
@@ -211,30 +211,30 @@ vi.mock("./WorkspaceExtraTab", () => ({
211 return createElement("button", { onClick: () => setTab("Usage") }, tab);
212 },
213 }));
214 -vi.mock("../../native/StackHeader", () => ({ NativeStackScreenOptions: () => null }));
215 -vi.mock("../../components/ui/AppBar", () => ({ AppBar: () => null }));
216 -vi.mock("../layout/WorkspaceEmptyDetail", () => ({ WorkspaceEmptyDetail: () => null }));
217 -vi.mock("../../components/ui/ScreenContent", () => ({
214 +vi.mock("../../../native/StackHeader", () => ({ NativeStackScreenOptions: () => null }));
215 +vi.mock("../../../components/ui/AppBar", () => ({ AppBar: () => null }));
216 +vi.mock("../WorkspaceEmptyDetail", () => ({ WorkspaceEmptyDetail: () => null }));
217 +vi.mock("../../../components/ui/ScreenContent", () => ({
218 ScreenContent: ({ children }: { children: ReactNode }) => createElement("div", null, children),
219 }));
220 -vi.mock("../../components/ui/useAndroidControlSizing", () => ({
220 +vi.mock("../../../components/ui/useAndroidControlSizing", () => ({
221 useAndroidControlSizing: () => ({ fabClearance: 64, scale: 1, fabSize: 56 }),
222 }));
223 -vi.mock("../home/HomeRouteScreen", () => ({ HomeRouteScreen: () => null }));
224 -vi.mock("../pull-requests/PullRequestFilterMenuContext", () => ({
223 +vi.mock("../../home/HomeRouteScreen", () => ({ HomeRouteScreen: () => null }));
224 +vi.mock("../../pull-requests/PullRequestFilterMenuContext", () => ({
225 PullRequestFilterMenuProvider: ({ children }: { children: ReactNode }) =>
226 createElement("div", null, children),
227 }));
228 -vi.mock("../pull-requests/PullRequestsScreen", () => ({ PullRequestsScreen: () => null }));
229 -vi.mock("../pull-requests/PullRequestToolbar.android", () => ({ PullRequestToolbar: () => null }));
228 +vi.mock("../../pull-requests/PullRequestsScreen", () => ({ PullRequestsScreen: () => null }));
229 +vi.mock("./PullRequestToolbar.android", () => ({ PullRequestToolbar: () => null }));
230 vi.mock("./AndroidWorkspaceNavigation", () => ({
231 AndroidWorkspaceNavigation: () => null,
232 FloatingWorkspaceTabs: () => null,
233 }));
234 vi.mock("./WorkspaceNoTabs", () => ({ WorkspaceNoTabs: () => null }));
235 -vi.mock("../../components/ui/Pane", () => ({ usePaneRole: () => "screen" }));
235 +vi.mock("../../../components/ui/Pane", () => ({ usePaneRole: () => "screen" }));
236 vi.mock("./AndroidWorkspaceSidebar.android", () => ({ AndroidWorkspaceSidebar: () => null }));
237 -vi.mock("../../components/ui/WorkspaceAppBar.android", () => ({
237 +vi.mock("../../../components/ui/WorkspaceAppBar.android", () => ({
238 WorkspaceAppBarScope: ({ children }: { children: ReactNode }) => children,
239 }));
240
apps/mobile/src/features/layout/workspace/workspace-tabs-state.ts renamed
apps/mobile/src/features/projects/AddProjectScreen.test.ts
+3 -3
@@ -4,7 +4,7 @@ import * as NodeOS from "node:os";
4 import * as NodePath from "node:path";
5 import * as NodeModule from "node:module";
6 import type { EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
7 -import { workspaceDetailRouter } from "../workspace/workspace-detail-selection";
7 +import { workspaceDetailRouter } from "../layout/workspace/workspace-detail-selection";
8 import type { NavigationState } from "@react-navigation/native";
9 import { AuthOrchestrationOperateScope, AuthSourceControlWriteScope } from "@t3tools/contracts";
10 import * as Cause from "effect/Cause";
@@ -46,8 +46,8 @@ function loadRouters() {
46 };
47 }
48
49 -vi.mock("../workspace/useSelectWorkspaceDetail", async () => {
50 - const { selectWorkspaceDetail } = await import("../workspace/workspace-detail-selection");
49 +vi.mock("../layout/workspace/useSelectWorkspaceDetail", async () => {
50 + const { selectWorkspaceDetail } = await import("../layout/workspace/workspace-detail-selection");
51 return {
52 useSelectWorkspaceDetail: () => (detail: Parameters<typeof selectWorkspaceDetail>[0]) =>
53 state.dispatch(selectWorkspaceDetail(detail)),
apps/mobile/src/features/projects/AddProjectScreen.tsx
+1 -1
@@ -1,5 +1,5 @@
1 import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
2 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
2 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
3 import * as Dialog from "../../components/ui/Dialog";
4 import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
5 import { NavigationRow } from "../../components/ui/NavigationRow";
apps/mobile/src/features/pull-requests/PullRequestListFilters.tsx
+1 -1
@@ -4,7 +4,7 @@ import type { ScopedProjectRef, SidebarProjectGroupingMode } from "@t3tools/cont
4 import { Atom } from "effect/reactivity";
5 import { Platform, ScrollView } from "react-native";
6 import type { MenuProps } from "../../components/ui/Menu.types";
7 -import { ListFilterMenu } from "../workspace/ListFilterMenu";
7 +import { ListFilterMenu } from "../layout/workspace/ListFilterMenu";
8 import { environmentProjects } from "../../state/projects";
9 import { environmentThreadShells } from "../../state/threads";
10 import { useMobileProjectGroupingSettings } from "../../state/project-grouping";
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+1 -1
@@ -62,7 +62,7 @@ import { AppBar } from "../../components/ui/AppBar";
62 import { useContentTopInset } from "../../components/ui/useBarInset";
63 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
64 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
65 -import { useAndroidWorkspaceBack } from "../workspace/useAndroidWorkspaceNavigation";
65 +import { useAndroidWorkspaceBack } from "../layout/workspace/useAndroidWorkspaceNavigation";
66 import { EmptyState } from "../../components/ui/EmptyState";
67 import { SegmentedControl } from "../../components/ui/SegmentedControl";
68 import { SymbolView } from "../../components/ui/AppSymbol";
apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
+3 -3
@@ -42,9 +42,9 @@ import {
42 pullRequestProjectChoices,
43 } from "./pullRequestList";
44 import { useDebouncedValue } from "../../state/queries";
45 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
46 -import { useSearchScrollRestoration } from "../workspace/useSearchScrollRestoration";
47 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
45 +import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
46 +import { useSearchScrollRestoration } from "../layout/workspace/useSearchScrollRestoration";
47 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
48
49 function PullRequestListError(props: { readonly message: string }) {
50 const [expanded, setExpanded] = useState(false);
apps/mobile/src/features/pull-requests/usePullRequestListActions.ts
+1 -1
@@ -21,7 +21,7 @@ import { sourceControlClients } from "@t3tools/client-runtime/source-control-cli
21 import { scopedPullRequestListKey, type EnvironmentPullRequestListEntry } from "./pullRequestList";
22 import { copyPullRequestLink, sharePullRequestLink } from "./pullRequestLink";
23 import { pullRequestTarget } from "./usePullRequestDiff";
24 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
24 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
25 import { useOpenWorkspaceDetail } from "../layout/useOpenWorkspaceDetail";
26
27 export function usePullRequestListActions(
apps/mobile/src/features/review/ReviewSheet.tsx
+1 -1
@@ -55,7 +55,7 @@ import { resolveReviewAvailability } from "./reviewAvailability";
55 import { resolveSelectedReviewFileId } from "./reviewPaneSelection";
56 import { buildReviewSectionMenu } from "./review-section-menu";
57 import { reportShowcaseSceneRendered } from "../showcase/showcaseRenderSignal";
58 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
58 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
59
60 function ReviewHeader(
61 props: Parameters<typeof useReviewHeaderPresentation>[0] & {
apps/mobile/src/features/settings/SettingsNavigationRouteScreen.tsx
+3 -3
@@ -7,7 +7,7 @@ import {
7 moveNavigationTab,
8 navigationCustomizationAvailable,
9 toggleNavigationTabVisibility,
10 -} from "../workspace/navigation-tab-order";
10 +} from "../layout/workspace/navigation-tab-order";
11 import { AppText as Text } from "../../components/ui/AppText";
12 import { IconButton } from "../../components/ui/IconButton";
13 import { Button } from "../../components/ui/Button";
@@ -20,10 +20,10 @@ import {
20 useNavigationTabOrder,
21 useHiddenNavigationTabs,
22 useEnabledNavigationTabs,
23 -} from "../workspace/navigation-tabs";
23 +} from "../layout/workspace/navigation-tabs";
24 import { SettingsScreen } from "./components/SettingsScreen";
25 import { SettingsSection } from "./components/SettingsSection";
26 -import { resolveWorkspaceTabOrder } from "../workspace/workspace-tabs-state";
26 +import { resolveWorkspaceTabOrder } from "../layout/workspace/workspace-tabs-state";
27
28 export function SettingsNavigationRouteScreen() {
29 const insets = useSafeAreaInsets();
apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx
+2 -2
@@ -41,8 +41,8 @@ import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
41 import { useSettingsEnvironmentMenu } from "./components/SettingsEnvironmentFilterHeader";
42 import { useSettingsEnvironmentFilter, type SettingsTarget } from "./settings-environment-filter";
43 import { leaveSettingsPage } from "./settings-navigation";
44 -import { workspaceHasColumns } from "../workspace/workspace-selection-store";
45 -import { DEFAULT_SETTINGS_PAGE } from "../workspace/workspace-tab-navigation";
44 +import { workspaceHasColumns } from "../layout/workspace/workspace-selection-store";
45 +import { DEFAULT_SETTINGS_PAGE } from "../layout/workspace/workspace-tab-navigation";
46 import { readUnloadedThreadCount } from "../../state/olderSettledShelf";
47
48 export function SettingsProjectOverviewRouteScreen() {
apps/mobile/src/features/settings/SettingsRouteScreen.tsx
+6 -6
@@ -1,17 +1,17 @@
1 import {
2 navigationCustomizationAvailable,
3 overflowNavigationTabs,
4 -} from "../workspace/navigation-tab-order";
4 +} from "../layout/workspace/navigation-tab-order";
5 import {
6 NAVIGATION_TAB_ICONS,
7 WORKSPACE_TAB_LABELS,
8 useNavigationTabOrder,
9 useHiddenNavigationTabs,
10 -} from "../workspace/navigation-tabs";
11 -import { currentWorkspaceSelections } from "../workspace/workspace-selection-store";
12 -import { rememberedSettingsPage } from "../workspace/workspace-tab-navigation";
13 -import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab";
14 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
10 +} from "../layout/workspace/navigation-tabs";
11 +import { currentWorkspaceSelections } from "../layout/workspace/workspace-selection-store";
12 +import { rememberedSettingsPage } from "../layout/workspace/workspace-tab-navigation";
13 +import { useSelectWorkspaceTab } from "../layout/workspace/useSelectWorkspaceTab";
14 +import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
15 import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
16 import { EmptyState } from "../../components/ui/EmptyState";
17 import { useAuth, useUser } from "@clerk/expo";
apps/mobile/src/features/settings/SettingsWorkspaceLayout.android.tsx
+1 -1
@@ -5,7 +5,7 @@ import { View } from "react-native";
5 import { AppText } from "../../components/ui/AppText";
6 import { PaneContext } from "../../components/ui/Pane";
7 import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
8 -import { useAndroidWorkspaceRoot } from "../workspace/AndroidWorkspaceTabsProvider";
8 +import { useAndroidWorkspaceRoot } from "../layout/workspace/AndroidWorkspaceTabsProvider";
9 import { SettingsListScreen } from "./SettingsRouteScreen";
10 import { SettingsScreen } from "./components/SettingsScreen";
11
apps/mobile/src/features/settings/components/SettingsScreen.tsx
+2 -2
@@ -5,9 +5,9 @@ import { View } from "react-native";
5 import type { AppBarProps } from "../../../components/ui/AppBar.types";
6 import { AppBar } from "../../../components/ui/AppBar";
7 import { ScreenContent as SettingsScreenContent } from "../../../components/ui/ScreenContent";
8 -import { useWorkspaceTabs } from "../../workspace/WorkspaceTabsContext";
8 +import { useWorkspaceTabs } from "../../layout/workspace/WorkspaceTabsContext";
9 import { useDeviceType } from "../../../native/native-layout-metrics";
10 -import { useCompactWorkspaceTabs } from "../../workspace/useSystemWorkspaceTabBar";
10 +import { useCompactWorkspaceTabs } from "../../layout/workspace/useSystemWorkspaceTabBar";
11 import { useSettingsPageBack } from "../useSettingsPageBack";
12 import {
13 ScreenScrollViewBottomInset,
apps/mobile/src/features/sharing/IncomingShareProvider.tsx
+1 -1
@@ -26,7 +26,7 @@ import { persistComposerAttachmentFile } from "../../lib/composerImages";
26 import { subscribeAppActive } from "../../lib/appState";
27 import { coalescedRun } from "../../lib/coalescedRun";
28 import { rootNavigationRef } from "../../lib/rootNavigation";
29 -import { selectWorkspaceDetail } from "../workspace/workspace-detail-selection";
29 +import { selectWorkspaceDetail } from "../layout/workspace/workspace-detail-selection";
30 import { isDraftThreadRoute } from "../threads/thread-route-state";
31 import { makeIncomingShareImports } from "../threads/incomingShareImport";
32 import { liveNewTaskFlowKeys } from "../threads/new-task-flow-state";
apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx
+1 -1
@@ -55,7 +55,7 @@ import {
55 import { retryShowcaseOperation } from "./showcaseRetry";
56 import { stageShowcaseAgentActivity } from "./stageShowcaseAgentActivity";
57 import { settingsNavigationState } from "../settings/settings-navigation";
58 -import { selectWorkspaceDetail } from "../workspace/workspace-detail-selection";
58 +import { selectWorkspaceDetail } from "../layout/workspace/workspace-detail-selection";
59
60 const SHOWCASE_ENABLED = process.env.EXPO_PUBLIC_SHOWCASE === "1";
61 // Native launch requests (pairing links, scene switches) have no change event.
apps/mobile/src/features/threads/NewTaskDraftRouteScreen.test.tsx
+1 -1
@@ -55,7 +55,7 @@ vi.mock("../../components/ui/AppText", () => ({
55 }));
56 vi.mock("../../components/ui/Dialog", () => ({ alert: vi.fn() }));
57 vi.mock("../../components/ui/AppBar", () => ({ AppBar: () => null }));
58 -vi.mock("../workspace/useAndroidWorkspaceNavigation", () => ({
58 +vi.mock("../layout/workspace/useAndroidWorkspaceNavigation", () => ({
59 useWorkspaceBackNavigation: () => () => undefined,
60 }));
61 vi.mock("./ThreadScreenHost", () => ({
apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
+1 -1
@@ -31,7 +31,7 @@ import {
31 } from "./new-task-branch-checkout";
32 import { liveNewTaskFlowKeys, newTaskFlowKey } from "./new-task-flow-state";
33 import { AppBar } from "../../components/ui/AppBar";
34 -import { useWorkspaceBackNavigation } from "../workspace/useAndroidWorkspaceNavigation";
34 +import { useWorkspaceBackNavigation } from "../layout/workspace/useAndroidWorkspaceNavigation";
35
36 import { ThreadScreenFallback } from "./ThreadScreenHost";
37 import { NewTaskDraftScreen } from "./NewTaskDraftScreen";
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+1 -1
@@ -2,7 +2,7 @@ import { DraftEnvironmentControl } from "./DraftEnvironmentControl";
2 import { NativeScrollEdgeEffectsContext } from "../../native/NativeScrollViewMarker";
3 import { DraftThreadHeader } from "./DraftThreadHeader";
4 import { useComposerAttachmentActions } from "../../state/use-composer-attachment-actions";
5 -import { useWorkspaceBackNavigation } from "../workspace/useAndroidWorkspaceNavigation";
5 +import { useWorkspaceBackNavigation } from "../layout/workspace/useAndroidWorkspaceNavigation";
6 import { submittedThreadParams } from "./thread-route-state";
7 import { ThreadScreenBinding, ThreadScreenFallback } from "./ThreadScreenHost";
8 import { draftThreadShell } from "./draft-thread-shell";
apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+1 -1
@@ -40,7 +40,7 @@ import {
40 getProjectScopeSelectionTarget,
41 resolveNewTaskScratchOption,
42 } from "./new-task-project-selection";
43 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
43 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
44
45 type NewTaskRouteParams = {
46 readonly incomingShareId?: string | string[];
apps/mobile/src/features/threads/ThreadComposer.tsx
+1 -1
@@ -1,4 +1,4 @@
1 -import { useSidebarWorkspaceTabs } from "../workspace/useSystemWorkspaceTabBar";
1 +import { useSidebarWorkspaceTabs } from "../layout/workspace/useSystemWorkspaceTabBar";
2 import { Button } from "../../components/ui/Button";
3 import * as Dialog from "../../components/ui/Dialog";
4 import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+2 -2
@@ -1,7 +1,7 @@
1 import { ChildThreadApprovals } from "./ChildThreadApprovals";
2 import { useOpenThreadInspector } from "./thread-inspector-navigation";
3 -import { useSidebarWorkspaceTabs } from "../workspace/useSystemWorkspaceTabBar";
4 -import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
3 +import { useSidebarWorkspaceTabs } from "../layout/workspace/useSystemWorkspaceTabBar";
4 +import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
5 import {
6 isAtomCommandInterrupted,
7 settlePromise,
apps/mobile/src/features/threads/ThreadFeed.tsx
+1 -1
@@ -285,7 +285,7 @@ import {
285 ThreadMarkdownImageView,
286 } from "./ThreadMarkdownImage";
287 import { openSettings } from "../settings/settings-navigation";
288 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
288 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
289
290 const WIDE_MARKDOWN_BLOCK_OPTIONS = {
291 // iOS blockquotes and selectable text measure separately; definite bubble width matches UIKit's drawing width.
apps/mobile/src/features/threads/ThreadHeader.tsx
+1 -1
@@ -3,7 +3,7 @@ import { ScreenHeaderButton } from "../../components/ui/ScreenHeaderButton";
3 import type { AppBarAction, AppBarMenu } from "../../components/ui/AppBar.types";
4 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
5 import type { ThreadInspectorMode } from "./thread-inspector-navigation";
6 -import { useWorkspaceBackNavigation } from "../workspace/useAndroidWorkspaceNavigation";
6 +import { useWorkspaceBackNavigation } from "../layout/workspace/useAndroidWorkspaceNavigation";
7 import {
8 threadTerminalMenu,
9 useThreadGitMenuDefinition,
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+44 -186
@@ -16,19 +16,15 @@ import type {
16 import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
17 import { AnimatedLegendList } from "@legendapp/list/reanimated";
18 import { THREAD_SIDEBAR_ROW_LAYOUT } from "./threadListAnimations";
19 -import type { MenuAction } from "@react-native-menu/menu";
19 import { useAtomValue } from "@effect/atom-react";
20 import { useMemo, useRef, useState } from "react";
21 import { Platform, StyleSheet, View } from "react-native";
22 import { GestureDetector, useNativeGesture } from "react-native-gesture-handler";
23 import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
25 -import { FLOATING_TABS } from "../workspace/floating-workspace-tabs";
24 +import { FLOATING_TABS } from "../layout/workspace/floating-workspace-tabs";
25 import { useSafeAreaInsets } from "react-native-safe-area-context";
27 -import type { SearchBarCommands } from "react-native-screens";
26
27 import { AppText as Text } from "../../components/ui/AppText";
30 -import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
31 -import { NativeStackScreenOptions } from "../../native/StackHeader";
28 import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
29 import { useProjects, useNavigationThreadShells } from "../../state/entities";
30 import { useThreadSearch } from "../../state/queries";
@@ -40,24 +36,20 @@ import { usePendingNewTasks, type PendingNewTask } from "../../state/use-pending
36 import { useQueuedThreadKeys } from "../../state/use-thread-outbox";
37 import { useWorkspaceState } from "../../state/workspace";
38 import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
43 -import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
39 import { useThreadListV2 } from "./useThreadListV2";
40 import { useThreadJumpShortcuts } from "../keyboard/threadKeyboardShortcuts";
41 import { requestThreadMessageJump } from "./threadMessageJump";
42 import { useThreadListSearchMatches } from "./useThreadListSearchMatches";
43 import { useHomeListOptions } from "../home/home-list-options";
49 -import { buildHomeListFilterMenu } from "../home/home-list-filter-menu";
44 +import { buildHomeListFilterMenuItems } from "../home/home-list-filter-menu";
45 import { buildHomeProjectScopes } from "../home/homeThreadList";
46 import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "../home/thread-swipe-actions";
47 import { usePendingTaskListActions } from "../home/usePendingTaskListActions";
48 import { useThreadListActions } from "../home/useThreadListActions";
54 -import { getConnectionAwareBrandHeaderOptions } from "../home/WorkspaceConnectionTitle";
55 -import { ThreadListToolbar } from "../home/ThreadListToolbar";
49 import { useFabScroll } from "../home/FabScrollContext";
57 -import { createSidebarHeaderItems } from "./sidebar-native-header-items";
58 -import { getCompactBrandHeaderOptions } from "../../components/CompactBrandTitle";
59 -import { StandaloneStack } from "../layout/nested-stacks";
60 -import { pageRoute } from "../layout/route-options";
50 +import { WorkspaceListHeader } from "../layout/workspace/WorkspaceListHeader";
51 +import { WORKSPACE_LIST_SCROLL_INSETS } from "../layout/workspace/workspace-list-insets";
52 +import { WorkspaceSidebarColumn } from "../layout/workspace/WorkspaceSidebarColumn";
53 import {
54 ThreadListV2PendingRow,
55 ThreadListV2Row,
@@ -76,7 +68,7 @@ import {
68 THREAD_LIST_V2_SETTLED_PAGE_COUNT,
69 type ThreadListV2ListItem,
70 } from "./threadListV2";
79 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
71 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
72 import { NativeScrollView } from "../../native/NativeScrollViewMarker";
73
74 type SidebarListItem =
@@ -107,41 +99,17 @@ interface ThreadNavigationSidebarProps {
99 readonly searchQuery: string;
100 }
101
110 -// The iOS sidebar column hosts its own stack so it gets a native bar with the brand title.
111 -const SIDEBAR_COLUMN_OPTIONS = {
112 - ...pageRoute(),
113 - ...getCompactBrandHeaderOptions({ fontSize: 18, fontWeight: "800" }),
114 -};
115 -
102 export function ThreadNavigationSidebar(props: ThreadNavigationSidebarProps) {
103 return (
104 <ThreadPrDemandProvider visible={props.visible}>
119 - {Platform.OS !== "ios" ? (
120 - <ThreadNavigationSidebarPane {...props} nativeChrome={false} />
121 - ) : (
122 - <NativeSidebarContainer {...props} />
123 - )}
105 + <WorkspaceSidebarColumn width={props.width}>
106 + <ThreadNavigationSidebarPane {...props} />
107 + </WorkspaceSidebarColumn>
108 </ThreadPrDemandProvider>
109 );
110 }
111
128 -function NativeSidebarContainer(props: ThreadNavigationSidebarProps) {
129 - return (
130 - <View
131 - testID="thread-navigation-sidebar"
132 - className="flex-1 border-border bg-drawer"
133 - style={{ borderRightWidth: StyleSheet.hairlineWidth, width: props.width }}
134 - >
135 - <StandaloneStack surface="sidebar" options={SIDEBAR_COLUMN_OPTIONS}>
136 - <ThreadNavigationSidebarPane {...props} nativeChrome />
137 - </StandaloneStack>
138 - </View>
139 - );
140 -}
141 -
142 -function ThreadNavigationSidebarPane(
143 - props: ThreadNavigationSidebarProps & { readonly nativeChrome: boolean },
144 -) {
112 +function ThreadNavigationSidebarPane(props: ThreadNavigationSidebarProps) {
113 const floatingTabsEnabled = useAndroidFloatingTabs();
114 const { themeVariables: materialTheme } = useAppearancePreferences();
115 const drawerColor = materialTheme["--color-drawer"];
@@ -152,7 +120,6 @@ function ThreadNavigationSidebarPane(
120 const threads = useNavigationThreadShells();
121 const { environments: workspaceEnvironments, state: catalogState } = useWorkspaceState();
122 const { savedConnectionsById } = useSavedRemoteConnections();
155 - const searchBarRef = useRef<SearchBarCommands>(null);
123 const openSwipeableRef = useRef<SwipeableMethods | null>(null);
124 const sidebarScrollGesture = useNativeGesture();
125 const {
@@ -335,78 +302,6 @@ function ThreadNavigationSidebarPane(
302 },
303 ]
304 : threadListV2Items;
338 - const listMenuActions = [
339 - {
340 - id: "environment",
341 - title: "Environment",
342 - subactions: [
343 - {
344 - id: "environment:all",
345 - title: "All environments",
346 - subtitle: "Show threads from every environment",
347 - state: options.selectedEnvironmentId === null ? "on" : "off",
348 - },
349 - ...environments.map((environment) => ({
350 - id: `environment:${environment.environmentId}`,
351 - title: environment.label,
352 - state:
353 - options.selectedEnvironmentId === environment.environmentId
354 - ? ("on" as const)
355 - : ("off" as const),
356 - })),
357 - ],
358 - },
359 - ...(projectFilterOptions.length === 0
360 - ? []
361 - : ([
362 - {
363 - id: "project",
364 - title: "Project",
365 - subactions: [
366 - {
367 - id: "project:all",
368 - title: "All projects",
369 - subtitle: "Show threads from every project",
370 - state: selectedProjectKey === null ? "on" : "off",
371 - },
372 - ...projectFilterOptions.map((project) => ({
373 - id: `project:${project.key}`,
374 - title: project.label,
375 - state: selectedProjectKey === project.key ? ("on" as const) : ("off" as const),
376 - })),
377 - ],
378 - },
379 - ] satisfies MenuAction[])),
380 - ] satisfies MenuAction[];
381 - const handleListMenuAction = ({
382 - nativeEvent,
383 - }: {
384 - readonly nativeEvent: { readonly event: string };
385 - }) => {
386 - const event = nativeEvent.event;
387 - if (event === "environment:all") {
388 - setSelectedEnvironmentId(null);
389 - return;
390 - }
391 - if (event.startsWith("environment:")) {
392 - const environment = environments.find(
393 - (candidate) => String(candidate.environmentId) === event.slice("environment:".length),
394 - );
395 - if (environment) setSelectedEnvironmentId(environment.environmentId);
396 - return;
397 - }
398 - if (event === "project:all") {
399 - setSelectedProjectKey(null);
400 - return;
401 - }
402 - if (event.startsWith("project:")) {
403 - const projectKey = event.slice("project:".length);
404 - if (projectFilterOptions.some((project) => project.key === projectKey)) {
405 - setSelectedProjectKey(projectKey);
406 - }
407 - return;
408 - }
409 - };
305
306 const handleSwipeableWillOpen = (methods: SwipeableMethods) => {
307 if (openSwipeableRef.current !== methods) {
@@ -470,18 +365,6 @@ function ThreadNavigationSidebarPane(
365 }
366 return false;
367 };
473 - const focusSearch = () => {
474 - if (!props.nativeChrome) return false;
475 - const focus = () => searchBarRef.current?.focus();
476 - if (!props.visible) {
477 - props.onRequestVisibility();
478 - setTimeout(focus, 240);
479 - } else {
480 - focus();
481 - }
482 - return true;
483 - };
484 - useHardwareKeyboardCommand("focusSearch", focusSearch);
368 const renderListItem = ({ item }: { readonly item: SidebarListItem }) => {
369 switch (item.type) {
370 case "v2-pending": {
@@ -640,23 +523,35 @@ function ThreadNavigationSidebarPane(
523 );
524 }
525 };
643 - const filterCustomized = options.selectedEnvironmentId !== null || selectedProjectKey !== null;
644 - const filterIcon = filterCustomized
645 - ? "line.3.horizontal.decrease.circle.fill"
646 - : "line.3.horizontal.decrease.circle";
647 - const filterMenu = buildHomeListFilterMenu({
648 - environments,
649 - projects: projectFilterOptions,
650 - selectedEnvironmentId: options.selectedEnvironmentId,
651 - selectedProjectKey,
652 - onEnvironmentChange: setSelectedEnvironmentId,
653 - onProjectChange: setSelectedProjectKey,
654 - });
655 - const nativeHeaderItems = createSidebarHeaderItems({
656 - filterIcon,
657 - filterMenu,
658 - onOpenSettings: props.onOpenSettings,
659 - });
526 + const header = (
527 + <WorkspaceListHeader
528 + accessibilityLabel="T3 Code, Threads"
529 + onOpenEnvironments={props.onOpenEnvironmentSettings}
530 + onOpenSettings={props.onOpenSettings}
531 + search={{
532 + value: props.searchQuery,
533 + onChangeText: props.onSearchQueryChange,
534 + placeholder: "Search",
535 + accessibilityLabel: "Search threads",
536 + }}
537 + filter={{
538 + customized: options.selectedEnvironmentId !== null || selectedProjectKey !== null,
539 + items: buildHomeListFilterMenuItems({
540 + environments,
541 + projects: projectFilterOptions,
542 + selectedEnvironmentId: options.selectedEnvironmentId,
543 + selectedProjectKey,
544 + onEnvironmentChange: setSelectedEnvironmentId,
545 + onProjectChange: setSelectedProjectKey,
546 + }),
547 + }}
548 + sidebar={{
549 + width: props.width,
550 + visible: props.visible,
551 + onRequestVisibility: props.onRequestVisibility,
552 + }}
553 + />
554 + );
555 const listEmpty = (
556 <Text
557 className={
@@ -679,36 +574,10 @@ function ThreadNavigationSidebarPane(
574 </Text>
575 );
576
682 - if (props.nativeChrome) {
577 + if (Platform.OS === "ios") {
578 return (
579 <>
685 - <NativeStackScreenOptions
686 - optionsVersion={[nativeHeaderItems, props.width]}
687 - options={{
688 - ...getConnectionAwareBrandHeaderOptions({
689 - headerWidth: props.width,
690 - trailingItemCount: nativeHeaderItems.length,
691 - onOpenEnvironments: props.onOpenEnvironmentSettings,
692 - fallbackTitleStyle: { fontSize: 18, fontWeight: "800" },
693 - }),
694 - headerSearchBarOptions: {
695 - ref: searchBarRef,
696 - autoCapitalize: "none",
697 - hideNavigationBar: false,
698 - hideWhenScrolling: false,
699 - obscureBackground: false,
700 - placeholder: "Search",
701 - placement: "stacked",
702 - onCancelButtonPress: () => {
703 - props.onSearchQueryChange("");
704 - },
705 - onChangeText: (event) => {
706 - props.onSearchQueryChange(event.nativeEvent.text);
707 - },
708 - },
709 - unstable_headerRightItems: () => nativeHeaderItems,
710 - }}
711 - />
580 + {header}
581 <View className="flex-1">
582 <SwipeableScrollGateProvider enabled={swipeEnabled}>
583 <GestureDetector gesture={sidebarScrollGesture}>
@@ -723,10 +592,7 @@ function ThreadNavigationSidebarPane(
592 itemsAreEqual={sidebarItemsAreEqual}
593 keyExtractor={(item) => item.key}
594 renderItem={renderListItem}
726 - automaticallyAdjustsScrollIndicatorInsets={NATIVE_LIQUID_GLASS_SUPPORTED}
727 - contentInsetAdjustmentBehavior={
728 - NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never"
729 - }
595 + {...WORKSPACE_LIST_SCROLL_INSETS}
596 contentContainerStyle={[
597 styles.threadListContent,
598 {
@@ -751,7 +617,7 @@ function ThreadNavigationSidebarPane(
617 );
618 }
619
754 - // Android: the bar is the floating ThreadListToolbar below the list.
620 + // Android: the bar floats below the list.
621 return (
622 <View testID="thread-navigation-sidebar" className="flex-1 bg-header">
623 <View
@@ -800,15 +666,7 @@ function ThreadNavigationSidebarPane(
666 </SwipeableScrollGateProvider>
667 )}
668 </View>
803 - <ThreadListToolbar
804 - searchQuery={props.searchQuery}
805 - onSearchQueryChange={props.onSearchQueryChange}
806 - filterActions={listMenuActions}
807 - filterCustomized={filterCustomized}
808 - onFilterSelect={(event) => handleListMenuAction({ nativeEvent: { event } })}
809 - onOpenEnvironments={props.onOpenEnvironmentSettings}
810 - onRequestVisibility={props.onRequestVisibility}
811 - />
669 + {header}
670 <ThreadUndoNotice visible={props.visible} />
671 </View>
672 );
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+2 -2
@@ -109,7 +109,7 @@ import { resumeThread } from "./resume-thread";
109 import {
110 useAndroidWorkspaceBack,
111 useWorkspaceBackNavigation,
112 -} from "../workspace/useAndroidWorkspaceNavigation";
112 +} from "../layout/workspace/useAndroidWorkspaceNavigation";
113 import { openSettings } from "../settings/settings-navigation";
114 import {
115 InspectorContentScope,
@@ -119,7 +119,7 @@ import {
119 } from "./thread-inspector-preview";
120 import { useStartSideChat } from "./useStartSideChat";
121 import type { ThreadInspectorMode, ThreadInspectorTarget } from "./thread-inspector-navigation";
122 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
122 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
123
124 function firstRouteParam(value: string | string[] | undefined): string | null {
125 const first = Array.isArray(value) ? value[0] : value;
apps/mobile/src/features/threads/sidebar-native-header-items.ts deleted
-60
@@ -1,60 +0,0 @@
1 -import type {
2 - NativeStackHeaderItem,
3 - NativeStackHeaderItemMenu,
4 -} from "@react-navigation/native-stack";
5 -
6 -import type { HomeListFilterMenu } from "../home/home-list-filter-menu";
7 -import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items";
8 -
9 -type NativeHeaderMenuItems = NativeStackHeaderItemMenu["menu"]["items"];
10 -type NativeHeaderIcon = NonNullable<Extract<NativeStackHeaderItem, { type: "button" }>["icon"]>;
11 -
12 -function sfSymbolIcon(name: string): NativeHeaderIcon {
13 - return { type: "sfSymbol", name: name as never };
14 -}
15 -
16 -function toNativeHeaderMenuItems(items: HomeListFilterMenu["items"]): NativeHeaderMenuItems {
17 - return items.map((item) =>
18 - item.type === "action"
19 - ? {
20 - type: "action" as const,
21 - label: item.title,
22 - description: item.subtitle,
23 - onPress: item.onPress,
24 - state: item.state === "on" ? ("on" as const) : undefined,
25 - }
26 - : {
27 - type: "submenu" as const,
28 - label: item.title,
29 - items: toNativeHeaderMenuItems(item.items),
30 - },
31 - );
32 -}
33 -
34 -export function createSidebarHeaderItems(input: {
35 - readonly filterIcon: string;
36 - readonly filterMenu: HomeListFilterMenu;
37 - readonly onOpenSettings: () => void;
38 -}): NativeStackHeaderItem[] {
39 - return [
40 - withNativeGlassHeaderItem({
41 - type: "menu",
42 - axisBehavior: "horizontalOnly",
43 - label: "",
44 - accessibilityLabel: "Filter threads",
45 - icon: sfSymbolIcon(input.filterIcon),
46 - menu: {
47 - title: input.filterMenu.title,
48 - items: toNativeHeaderMenuItems(input.filterMenu.items),
49 - },
50 - }),
51 - withNativeGlassHeaderItem({
52 - type: "button",
53 - axisBehavior: "horizontalOnly",
54 - label: "Settings",
55 - accessibilityLabel: "Open settings",
56 - icon: sfSymbolIcon("gearshape"),
57 - onPress: input.onOpenSettings,
58 - }),
59 - ];
60 -}
apps/mobile/src/features/triage/useStartTriage.ts
+1 -1
@@ -18,7 +18,7 @@ import {
18 setComposerDraftText,
19 waitForComposerDraftsLoaded,
20 } from "../../state/use-composer-drafts";
21 -import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
21 +import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
22
23 const CLI_COMMAND = "npx t3 triage";
24
apps/mobile/src/lib/android-workspace-navigation.test.ts
+1 -1
@@ -3,7 +3,7 @@ import { describe, expect, it } from "vite-plus/test";
3 import {
4 androidWorkspaceTabNavigationState,
5 type AndroidWorkspaceNavigationTab,
6 -} from "../features/workspace/android-workspace-tabs";
6 +} from "../features/layout/workspace/android-workspace-tabs";
7 import {
8 linkedThreadStep,
9 parentThreadIsBelow,
apps/mobile/src/native/V5StackHeader.ios.tsx
+1 -1
@@ -8,7 +8,7 @@ import { StyleSheet } from "react-native";
8 import { KeyboardController, useKeyboardState } from "react-native-keyboard-controller";
9 import { isDuoDevice } from "../lib/device-type";
10 import { useMobileNavigationTheme } from "../lib/useMobileNavigationTheme";
11 -import { useDeviceType, useNativeLayoutMetrics } from "../native/native-layout-metrics";
11 +import { useDeviceType, useNativeLayoutMetrics } from "./native-layout-metrics";
12 import { HeaderItemsWidthContext } from "./header-items-width";
13 import {
14 SearchBar,
apps/mobile/src/native/useOpenPullRequest.ts
+1 -1
@@ -1,7 +1,7 @@
1 import { useNavigation, useRoute, StackActions } from "@react-navigation/native";
2 import { nativePullRequestDestination } from "../lib/pullRequestNavigation";
3 import { Platform } from "react-native";
4 -import { useSelectWorkspaceDetail } from "../features/workspace/useSelectWorkspaceDetail";
4 +import { useSelectWorkspaceDetail } from "../features/layout/workspace/useSelectWorkspaceDetail";
5 import { EnvironmentId, ThreadId } from "@t3tools/contracts";
6 import { useProjects, useThreadShell } from "../state/entities";
7 import { tryOpenExternalUrl } from "../lib/openExternalUrl";
apps/mobile/src/state/use-selected-thread-git-actions.ts
+3 -3
@@ -21,9 +21,9 @@ import {
21 import * as Cause from "effect/Cause";
22 import { AsyncResult } from "effect/reactivity";
23
24 -import { useBranches } from "../state/queries";
25 -import { threadEnvironment } from "../state/threads";
26 -import { vcsActionManager, vcsEnvironment } from "../state/vcs";
24 +import { useBranches } from "./queries";
25 +import { threadEnvironment } from "./threads";
26 +import { vcsActionManager, vcsEnvironment } from "./vcs";
27 import { uuidv4 } from "../lib/uuid";
28 import { appAtomRegistry } from "./atom-registry";
29 import { readEnvironmentScope, useEnvironmentScope } from "./session";
apps/mobile/src/state/use-selected-thread-requests.ts
+1 -1
@@ -36,7 +36,7 @@ import {
36 import { AuthOrchestrationOperateScope } from "@t3tools/contracts";
37 import { Atom } from "effect/reactivity";
38
39 -import { environmentThreadDetails, threadEnvironment } from "../state/threads";
39 +import { environmentThreadDetails, threadEnvironment } from "./threads";
40 import {
41 buildPendingUserInputAnswers,
42 setPendingUserInputCustomAnswer,
apps/mobile/src/state/use-thread-composer-state.ts
+5 -5
@@ -61,12 +61,12 @@ import {
61 selectPendingAcknowledgedMessages,
62 } from "../features/threads/pending-thread-feed";
63 import { threadAllowsProviderSwitch } from "./thread-provider-switching";
64 -import { appAtomRegistry } from "../state/atom-registry";
64 +import { appAtomRegistry } from "./atom-registry";
65 import { pendingThreadCreationMessage } from "./pending-thread-creation";
66 import {
67 composerAttachmentUploadBlockReason,
68 composerAttachmentUploadsAtom,
69 -} from "../state/composer-attachment-uploads";
69 +} from "./composer-attachment-uploads";
70 import {
71 appendComposerDraftAttachments,
72 insertComposerDraftContext,
@@ -105,13 +105,13 @@ import {
105 startQueuedRunEditSave,
106 useQueuedRunEdit,
107 } from "./queued-run-edit";
108 -import { setPendingConnectionError } from "../state/use-remote-environment-registry";
108 +import { setPendingConnectionError } from "./use-remote-environment-registry";
109 import { clearThreadComposerError, setThreadComposerError } from "./thread-composer-error";
110 import {
111 useSelectedThreadProjection,
112 useSelectedThreadVisibleTurnItems,
113 -} from "../state/use-thread-detail";
114 -import { useThreadSelection } from "../state/use-thread-selection";
113 +} from "./use-thread-detail";
114 +import { useThreadSelection } from "./use-thread-selection";
115 import { enqueueThreadOutboxMessage } from "./thread-outbox";
116 import { dispatchingQueuedMessageIdAtom, useThreadOutboxMessages } from "./use-thread-outbox";
117 import { threadEnvironment } from "./threads";
apps/mobile/src/state/use-thread-selection.ts
+2 -2
@@ -20,8 +20,8 @@ import {
20 import * as Option from "effect/Option";
21
22 import { scopedThreadKey } from "../lib/scopedEntities";
23 -import { useProject, useQuietThreadShell } from "../state/entities";
24 -import { useEnvironmentThread } from "../state/threads";
23 +import { useProject, useQuietThreadShell } from "./entities";
24 +import { useEnvironmentThread } from "./threads";
25 import {
26 resolvePendingThreadCreation,
27 pendingThreadCreationOutcomesAtom,
apps/mobile/vite.config.ts
+2 -2
@@ -6,7 +6,7 @@ import "vite-plus/test/config";
6 const reactTests = [
7 "src/features/threads/git/GitBranchesSheet.test.tsx",
8 "src/features/threads/new-task-flow-provider.test.tsx",
9 - "src/features/workspace/workspace-tabs-state.test.ts",
9 + "src/features/layout/workspace/workspace-tabs-state.test.ts",
10 "src/state/use-thread-pr.demand.test.tsx",
11 "src/features/threads/git/GitBranchesSheet.occupancy.test.tsx",
12 "src/features/files/useFileTreeEntries.test.tsx",
@@ -40,7 +40,7 @@ const reactTests = [
40 "src/features/threads/use-thread-list-now.test.tsx",
41 "src/features/threads/useThreadListV2.test.tsx",
42 "src/features/home/home-list-options.test.tsx",
43 - "src/features/workspace/useSearchScrollRestoration.test.tsx",
43 + "src/features/layout/workspace/useSearchScrollRestoration.test.tsx",
44 "src/features/connection/ConnectionsNewRouteScreen.test.tsx",
45 "src/features/devices/device-stream.browser.test.ts",
46 ];
docs/internals/mobile-layout.md
+21 -12
@@ -12,25 +12,34 @@ screen never asks which platform or window width it is on.
12
13 1. **Router.** The [root stack](../../apps/mobile/src/Stack.tsx) is the layout state: what is
14 selected, what is pushed, which sheet is open. Rotating, folding or resizing renders the same
15 - stack differently. Nothing remembers which column a page was in. See
16 - [Mobile navigation](./mobile-navigation.md).
17 -2. **Workspace shell.** The [adaptive layout](../../apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx)
18 - owns placement and widths, from the width class in [`layout.ts`](../../apps/mobile/src/lib/layout.ts):
15 + stack differently. Nothing remembers which column a page was in. Each route declares what it
16 + is with a [preset](../../apps/mobile/src/features/layout/route-options.ts) (`pageRoute`,
17 + `sheetRoute`, `modalRoute`, `immersiveRoute`); the preset owns detents, corner radius, header
18 + appearance and the Android fallback. See [Mobile navigation](./mobile-navigation.md).
19 +2. **Workspace shell.** [`features/layout`](../../apps/mobile/src/features/layout/) owns placement
20 + and widths, from the width class in [`layout.ts`](../../apps/mobile/src/lib/layout.ts):
21 - _Expanded_: sidebar, content and inspector columns.
22 - _Medium_ (600–720pt wide): the sidebar sits beside a list and floats over a page.
23 - _Compact_ (under 600pt either way): the sidebar is the root, and pages push.
24 - Where the inspector column does not fit, the inspector is a sheet.
23 -3. **Feature screens.** A screen places content by role. It renders its page and declares its
24 - inspector panes with `<Inspector>`, and asks for them with `showInspector()`. The shell decides
25 - between column and sheet. Choosing a route or a component by width or platform here is the bug
26 - this structure exists to prevent.
27 -4. **Design system.** Every pane has an `AppBar` with the same contract as a full screen.
25 +
26 + The workspace tabs, dock and toolbars live in `features/layout/workspace`. Stacks nested in a
27 + sheet or popover, and screens rendered under a route of their own, also come from here.
28 +
29 +3. **Feature screens.** A screen places content by role. It draws one `AppBar` (or `SheetHeader`
30 + for a form sheet), renders its page, declares its inspector panes with `<Inspector>`, and asks
31 + for them with `showInspector()`. The shell decides between column and sheet. Choosing a route,
32 + a component, header options or an inset by width or platform here is the bug this structure
33 + exists to prevent.
34 +4. **Design system.** Every pane, page, sheet and modal has an `AppBar` with the same contract on
35 + both platforms; a sheet or modal passes `onClose`.
36 [`PaneContext`](../../apps/mobile/src/components/ui/Pane.tsx) tells the bar which column it is
29 - in, so it adds that column's controls, such as the sidebar toggle. Chrome branches by platform
30 - only here.
37 + in, so it adds that column's controls, such as the sidebar toggle. Where content meets the bar
38 + comes from [`useBarInset`](../../apps/mobile/src/components/ui/useBarInset.ts). Chrome
39 + branches by platform only here.
40 5. **Native.** On iOS 26, the columns are `UISplitViewController` columns with a navigation bar
41 each. On Android and on iPadOS 18–25, the shell draws the same columns in JS from the window
33 - and hinge metrics.
42 + and hinge metrics. Android never shows the native stack header; every bar is drawn in-tree.
43
44 Platform splits live in layers 1, 2 and 4, as `.ios` and `.android` files.
45
docs/internals/mobile-navigation.md
+1 -1
@@ -13,7 +13,7 @@ Opening a page has two intents, and each has one action:
13 - **Select** shows a thread or pull request as the workspace's only page, the
14 way a list row does. Everything that selects (rows, the command palette,
15 compose, notifications, deep links) uses
16 - [`selectWorkspaceDetail`](../../apps/mobile/src/features/workspace/workspace-detail-selection.ts),
16 + [`selectWorkspaceDetail`](../../apps/mobile/src/features/layout/workspace/workspace-detail-selection.ts),
17 which the root stack's router handles. The resulting stack is the same on
18 phones, collapsed splits, and expanded splits. Only route keys differ: the
19 page already showing keeps its key, so the detail column updates in place