Skip to content
TypeScript

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

Julius Marmingefaf9d7354ce7
diff --git a/apps/mobile/src/App.tsx b/apps/mobile/src/App.tsx
index 43b1c089c0b..544092d744d 100644
--- a/apps/mobile/src/App.tsx
+++ b/apps/mobile/src/App.tsx
@@ -82,8 +82,8 @@ import {
launchWorkspaceURL,
recordWorkspaceSelections,
settingsLinkPage,
-} from "./features/workspace/workspace-selection-store";
-import { workspaceDetailLinkAction } from "./features/workspace/workspace-detail-selection";
+} from "./features/layout/workspace/workspace-selection-store";
+import { workspaceDetailLinkAction } from "./features/layout/workspace/workspace-detail-selection";
import { NativeLayoutMetricsProvider } from "./native/native-layout-metrics";
import {
attachRootNavigation,
diff --git a/apps/mobile/src/Stack.tsx b/apps/mobile/src/Stack.tsx
index 9977e733c8c..dfe81a7d308 100644
--- a/apps/mobile/src/Stack.tsx
+++ b/apps/mobile/src/Stack.tsx
@@ -18,15 +18,15 @@ import { useResolveClassNames } from "uniwind";
import { AppText as Text } from "./components/ui/AppText";
import { androidWorkspaceDestinationAnimation } from "./lib/android-workspace-navigation";
-import { getCompactBrandHeaderOptions } from "./components/CompactBrandTitle";
+import { getCompactBrandHeaderOptions } from "./features/layout/workspace/brand-header-options";
import { WorkspaceConnectionStatusProvider } from "./features/home/WorkspaceConnectionTitle";
-import { WorkspaceRootScreen } from "./features/workspace/WorkspaceRootScreen";
+import { WorkspaceRootScreen } from "./features/layout/workspace/WorkspaceRootScreen";
import {
recordHomeFocus,
recordHomeTransitionEnd,
recordHomeTransitionStart,
} from "./features/home/home-route-visibility";
-import { AndroidWorkspaceTabsProvider } from "./features/workspace/AndroidWorkspaceTabsProvider";
+import { AndroidWorkspaceTabsProvider } from "./features/layout/workspace/AndroidWorkspaceTabsProvider";
import {
PullRequestRouteScreen,
PullRequestFileRouteScreen,
@@ -128,7 +128,7 @@ import { SettingsRouteScreen } from "./features/settings/SettingsRouteScreen";
import { SettingsLabsRouteScreen } from "./features/settings/ThreadSettingsSections";
import { SettingsEnvironmentFilterProvider } from "./features/settings/settings-environment-filter";
import { openSettings, settingsOpenIn } from "./features/settings/settings-navigation";
-import { DEFAULT_SETTINGS_PAGE } from "./features/workspace/workspace-tab-navigation";
+import { DEFAULT_SETTINGS_PAGE } from "./features/layout/workspace/workspace-tab-navigation";
import {
isWorkspaceOverlayRoute,
registerPresentedRoutes,
@@ -138,7 +138,7 @@ import { immersiveRoute, modalRoute, pageRoute, sheetRoute } from "./features/la
import { deriveLayout } from "./lib/layout";
import { useNativeLayoutMetrics } from "./native/native-layout-metrics";
import { isPresentedRoute } from "./native/workspace-stack-projection";
-import { workspaceDetailRouter } from "./features/workspace/workspace-detail-selection";
+import { workspaceDetailRouter } from "./features/layout/workspace/workspace-detail-selection";
const settingsPage = (title: string) => pageRoute({ title, itemStyle: "standard" });
diff --git a/apps/mobile/src/components/CompactBrandTitle.tsx b/apps/mobile/src/components/CompactBrandTitle.tsx
index 7a251a2e57c..222e536cf4b 100644
--- a/apps/mobile/src/components/CompactBrandTitle.tsx
+++ b/apps/mobile/src/components/CompactBrandTitle.tsx
@@ -1,6 +1,5 @@
import { NATIVE_WORKSPACE_COLUMNS_SUPPORTED } from "../native/NativeWorkspaceColumns";
import Constants from "expo-constants";
-import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
import { useState } from "react";
import { Platform, View } from "react-native";
@@ -93,18 +92,3 @@ export function CompactBrandTitle(
title
);
}
-
-function renderCompactBrandTitle() {
- return <CompactBrandTitle allowFontScaling={Platform.OS === "ios"} />;
-}
-
-export function getCompactBrandHeaderOptions(
- fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"],
-): NativeStackNavigationOptions {
- return {
- headerTitle: renderCompactBrandTitle,
- headerTitleStyle: fallbackTitleStyle,
- title: "Threads",
- unstable_headerLeftItems: undefined,
- };
-}
diff --git a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.test.tsx b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.test.tsx
index e96d73766c1..22a266c8db9 100644
--- a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.test.tsx
+++ b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.test.tsx
@@ -60,7 +60,9 @@ vi.mock("../settings/settings-navigation", () => ({
leaveSettingsPage: vi.fn(),
openSettings: vi.fn(),
}));
-vi.mock("../workspace/workspace-selection-store", () => ({ workspaceHasColumns: () => false }));
+vi.mock("../layout/workspace/workspace-selection-store", () => ({
+ workspaceHasColumns: () => false,
+}));
vi.mock("../cloud/publicConfig", () => ({ hasCloudPublicConfig: () => false }));
vi.mock("./CloudEnvironmentRows", () => ({ CloudEnvironmentRows: () => null }));
vi.mock("./environmentSections", () => ({
diff --git a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
index f7e69cb881f..80f2ecc77c0 100644
--- a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
+++ b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
@@ -30,7 +30,7 @@ import { CloudEnvironmentRows } from "./CloudEnvironmentRows";
import { autoConnectReport, devAutoConnectAttemptAtom } from "./devAutoConnect";
import { splitEnvironmentSections } from "./environmentSections";
import { leaveSettingsPage } from "../settings/settings-navigation";
-import { workspaceHasColumns } from "../workspace/workspace-selection-store";
+import { workspaceHasColumns } from "../layout/workspace/workspace-selection-store";
type ConnectionsNewRouteParams = {
readonly mode?: string;
diff --git a/apps/mobile/src/features/connection/devAutoConnect.test.ts b/apps/mobile/src/features/connection/devAutoConnect.test.ts
index f4261a4eacd..54886437e32 100644
--- a/apps/mobile/src/features/connection/devAutoConnect.test.ts
+++ b/apps/mobile/src/features/connection/devAutoConnect.test.ts
@@ -44,7 +44,7 @@ vi.mock("@react-navigation/native", () => ({
vi.mock("../../state/use-remote-environment-registry", () => ({
pairEnvironment: harness.pair,
}));
-vi.mock("../workspace/workspace-selection-store", () => ({
+vi.mock("../layout/workspace/workspace-selection-store", () => ({
workspaceHasColumns: () => harness.columns,
}));
vi.mock("../../lib/rootNavigation", () => ({
diff --git a/apps/mobile/src/features/connection/devAutoConnect.ts b/apps/mobile/src/features/connection/devAutoConnect.ts
index 67f3ab1eee9..7f2b12a9d37 100644
--- a/apps/mobile/src/features/connection/devAutoConnect.ts
+++ b/apps/mobile/src/features/connection/devAutoConnect.ts
@@ -6,7 +6,7 @@ import { findLinkedRoute, updateLinkedRoute } from "../../lib/appLinking";
import { rootNavigationRef, whenRootNavigationReady } from "../../lib/rootNavigation";
import { appAtomRegistry } from "../../state/atom-registry";
import { leaveSettingsPage } from "../settings/settings-navigation";
-import { workspaceHasColumns } from "../workspace/workspace-selection-store";
+import { workspaceHasColumns } from "../layout/workspace/workspace-selection-store";
import { pairEnvironment } from "../../state/use-remote-environment-registry";
export type DevAutoConnectAttempt =
diff --git a/apps/mobile/src/features/development/behavior-probe.ts b/apps/mobile/src/features/development/behavior-probe.ts
index 03f9727602e..6da06f4289c 100644
--- a/apps/mobile/src/features/development/behavior-probe.ts
+++ b/apps/mobile/src/features/development/behavior-probe.ts
@@ -165,7 +165,7 @@ function route() {
require("../../lib/rootNavigation") as typeof import("../../lib/rootNavigation");
if (!rootNavigationRef.isReady()) return null;
const current = rootNavigationRef.getCurrentRoute();
- const { workspaceHasColumns } = require("../workspace/workspace-selection-store") as {
+ const { workspaceHasColumns } = require("../layout/workspace/workspace-selection-store") as {
workspaceHasColumns: () => boolean;
};
return {
diff --git a/apps/mobile/src/features/home/AndroidHomeFab.android.tsx b/apps/mobile/src/features/home/AndroidHomeFab.android.tsx
index bc1fe6af518..b5c86e3295c 100644
--- a/apps/mobile/src/features/home/AndroidHomeFab.android.tsx
+++ b/apps/mobile/src/features/home/AndroidHomeFab.android.tsx
@@ -15,9 +15,9 @@ import { useWorkspaceState } from "../../state/workspace";
import { FabScrollContext } from "./FabScrollContext";
import { updateFabScroll } from "./fab-scroll";
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
-import { WorkspaceTabsContext, useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
-import { FLOATING_TABS, floatingTabsMetrics } from "../workspace/floating-workspace-tabs";
-import { useEnabledNavigationTabs } from "../workspace/navigation-tabs";
+import { WorkspaceTabsContext, useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
+import { FLOATING_TABS, floatingTabsMetrics } from "../layout/workspace/floating-workspace-tabs";
+import { useEnabledNavigationTabs } from "../layout/workspace/navigation-tabs";
import {
useAppearancePreferences,
useAndroidFloatingTabs,
diff --git a/apps/mobile/src/features/home/HomeHeader.android.tsx b/apps/mobile/src/features/home/HomeHeader.android.tsx
deleted file mode 100644
index ed161ef9abf..00000000000
--- a/apps/mobile/src/features/home/HomeHeader.android.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import type { MenuAction } from "@react-native-menu/menu";
-import { ThreadListToolbar } from "./ThreadListToolbar";
-import type { HomeHeaderProps } from "./HomeHeader.types";
-
-export type { HomeHeaderEnvironment } from "./HomeHeader.types";
-
-function checkedMenuState(checked: boolean) {
- return checked ? ("on" as const) : undefined;
-}
-
-export function HomeHeader(props: HomeHeaderProps) {
- const hasCustomListOptions =
- props.selectedEnvironmentId !== null || props.selectedProjectKey !== null;
- const menuActions: MenuAction[] = [
- {
- id: "environment",
- title: "Environment",
- subactions: [
- {
- id: "environment:all",
- title: "All environments",
- state: checkedMenuState(props.selectedEnvironmentId === null),
- },
- ...props.environments.map((environment) => ({
- id: `environment:${environment.environmentId}`,
- title: environment.label,
- state: checkedMenuState(props.selectedEnvironmentId === environment.environmentId),
- })),
- ],
- },
- ...(props.projects.length === 0
- ? []
- : ([
- {
- id: "project",
- title: "Project",
- subactions: [
- {
- id: "project:all",
- title: "All projects",
- state: checkedMenuState(props.selectedProjectKey === null),
- },
- ...props.projects.map((project) => ({
- id: `project:${project.key}`,
- title: project.label,
- state: checkedMenuState(props.selectedProjectKey === project.key),
- })),
- ],
- },
- ] satisfies MenuAction[])),
- ];
- const handleMenuAction = (event: { nativeEvent: { event: string } }) => {
- const id = event.nativeEvent.event;
- if (id === "environment:all") {
- props.onEnvironmentChange(null);
- return;
- }
-
- if (id.startsWith("environment:")) {
- const environmentId = id.slice("environment:".length);
- const environment = props.environments.find(
- (candidate) => candidate.environmentId === environmentId,
- );
- if (environment) {
- props.onEnvironmentChange(environment.environmentId);
- }
- return;
- }
-
- if (id === "project:all") {
- props.onProjectChange(null);
- return;
- }
-
- if (id.startsWith("project:")) {
- const projectKey = id.slice("project:".length);
- if (props.projects.some((project) => project.key === projectKey)) {
- props.onProjectChange(projectKey);
- }
- return;
- }
- };
-
- return (
- <ThreadListToolbar
- searchQuery={props.searchQuery}
- onSearchQueryChange={props.onSearchQueryChange}
- filterActions={menuActions}
- filterCustomized={hasCustomListOptions}
- onFilterSelect={(event) => handleMenuAction({ nativeEvent: { event } })}
- onOpenEnvironments={props.onOpenEnvironments}
- />
- );
-}
diff --git a/apps/mobile/src/features/home/HomeHeader.tsx b/apps/mobile/src/features/home/HomeHeader.tsx
deleted file mode 100644
index 2062c518afe..00000000000
--- a/apps/mobile/src/features/home/HomeHeader.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import type { HomeHeaderProps } from "./HomeHeader.types";
-
-export type { HomeHeaderEnvironment } from "./HomeHeader.types";
-
-/** The iOS thread list lives in the workspace, whose WorkspaceToolbar owns its header and search. */
-export function HomeHeader(_props: HomeHeaderProps) {
- return null;
-}
diff --git a/apps/mobile/src/features/home/HomeHeader.types.ts b/apps/mobile/src/features/home/HomeHeader.types.ts
deleted file mode 100644
index 3c5f580f9ee..00000000000
--- a/apps/mobile/src/features/home/HomeHeader.types.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import type { EnvironmentId } from "@t3tools/contracts";
-import type {
- HomeListFilterMenuEnvironment,
- HomeListFilterMenuProject,
-} from "./home-list-filter-menu";
-
-export type HomeHeaderEnvironment = HomeListFilterMenuEnvironment;
-
-export interface HomeHeaderProps {
- readonly environments: ReadonlyArray<HomeHeaderEnvironment>;
- readonly projects: ReadonlyArray<HomeListFilterMenuProject>;
- readonly searchQuery: string;
- readonly selectedEnvironmentId: EnvironmentId | null;
- readonly selectedProjectKey: string | null;
- readonly onSearchQueryChange: (query: string) => void;
- readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
- readonly onProjectChange: (projectKey: string | null) => void;
- readonly onOpenEnvironments: () => void;
- readonly onOpenSettings: () => void;
- readonly onStartNewTask: () => void;
-}
diff --git a/apps/mobile/src/features/home/HomeRouteScreen.tsx b/apps/mobile/src/features/home/HomeRouteScreen.tsx
index b83e0178268..99ede8afe7c 100644
--- a/apps/mobile/src/features/home/HomeRouteScreen.tsx
+++ b/apps/mobile/src/features/home/HomeRouteScreen.tsx
@@ -1,13 +1,12 @@
import { uuidv4 } from "../../lib/uuid";
import { ThreadUndoNotice } from "./ThreadUndoNotice";
-import { Toolbar } from "../../components/ui/Toolbar";
import { use } from "react";
import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
import * as Arr from "effect/Array";
import * as Order from "effect/Order";
import { useNavigation } from "@react-navigation/native";
import { useMemo, useState } from "react";
-import { Platform, useWindowDimensions } from "react-native";
+import { Platform } from "react-native";
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import {
@@ -15,37 +14,30 @@ import {
resolveScratchProjectScopeKey,
} from "@t3tools/client-runtime/state/project-grouping";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
import { useProjects } from "../../state/entities";
import { environmentThreadShells } from "../../state/threads";
import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
import { useWorkspaceState } from "../../state/workspace";
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
-import { useDeviceType, useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
-import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail";
-import { AppBar } from "../../components/ui/AppBar";
import { AndroidHomeFabLayout } from "./AndroidHomeFab";
import { HomeScreen } from "./HomeScreen";
-import { HomeHeader } from "./HomeHeader";
import { useHomeListOptions } from "./home-list-options";
import { useAtomValueWhileVisible, useHomeRouteVisible } from "./home-route-visibility";
import { buildHomeProjectScopes } from "./homeThreadList";
import { usePendingTaskListActions } from "./usePendingTaskListActions";
import { useThreadListActions } from "./useThreadListActions";
-import { getConnectionAwareBrandHeaderOptions } from "./WorkspaceConnectionTitle";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
+import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
import { openSettings } from "../settings/settings-navigation";
-import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceTab } from "../layout/workspace/useSelectWorkspaceTab";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
+import { WorkspaceListEmptyDetail } from "../layout/workspace/WorkspaceListEmptyDetail";
+import { WorkspaceListHeader } from "../layout/workspace/WorkspaceListHeader";
+import { buildHomeListFilterMenuItems } from "./home-list-filter-menu";
export function HomeRouteScreen() {
- const { width: windowWidth } = useWindowDimensions();
const nativePrimaryColumn = use(NativePrimaryColumnContext);
- const columnMetrics = useNativeColumnLayoutMetrics();
- const deviceType = useDeviceType();
- const headerWidth = nativePrimaryColumn ? (columnMetrics?.width ?? windowWidth) : windowWidth;
- const { layout, panes, primarySidebarSearchQuery, setPrimarySidebarSearchQuery, startNewTask } =
+ const { layout, primarySidebarSearchQuery, setPrimarySidebarSearchQuery, startNewTask } =
useAdaptiveWorkspaceLayout();
const selectDetail = useSelectWorkspaceDetail();
const projects = useProjects();
@@ -161,68 +153,37 @@ export function HomeRouteScreen() {
if (layout.usesSplitView && !nativePrimaryColumn) {
return (
- <>
- <NativeStackScreenOptions
- options={{
- title: "",
- headerTitle: "",
- unstable_headerLeftItems: () => [],
- headerSearchBarOptions: undefined,
- unstable_headerRightItems: () => [],
- unstable_headerToolbarItems: () => [],
- }}
- />
- <Toolbar placement="left">
- <Toolbar.Button
- accessibilityLabel="New task"
- icon="square.and.pencil"
- onPress={startNewTask}
- />
- </Toolbar>
- <AppBar embedded title="Threads" />
- <WorkspaceEmptyDetail
- onAddConnection={
- Platform.OS === "android" && !catalogState.hasConnections
- ? () => openSettings(navigation, "SettingsEnvironmentNew")
- : undefined
- }
- onStartNewTask={
- Platform.OS === "android" && panes.primarySidebarVisible ? undefined : startNewTask
- }
- />
- </>
+ <WorkspaceListEmptyDetail
+ hasConnections={catalogState.hasConnections}
+ onAddConnection={() => openSettings(navigation, "SettingsEnvironmentNew")}
+ onStartNewTask={startNewTask}
+ />
);
}
return (
- <AndroidHomeFabLayout
- disabled={workspace !== null && Platform.OS !== "android"}
- onStartNewTask={startNewTask}
- >
+ <AndroidHomeFabLayout onStartNewTask={startNewTask}>
<>
- {/* Screen options merge shallowly; restore the header after split view. */}
- {workspace !== null ? null : (
- <NativeStackScreenOptions
- optionsVersion={headerWidth}
- options={getConnectionAwareBrandHeaderOptions({
- headerWidth,
- trailingItemCount: nativePrimaryColumn && deviceType === "pad" ? 2 : 1,
- onOpenEnvironments: () => openSettings(navigation, "SettingsEnvironments"),
- })}
- />
- )}
- <HomeHeader
- environments={environments}
- projects={projectFilterOptions}
- searchQuery={searchQuery}
- selectedEnvironmentId={selectedEnvironmentId}
- selectedProjectKey={selectedProjectKey}
- onEnvironmentChange={setSelectedEnvironmentId}
- onProjectChange={setSelectedProjectKey}
+ <WorkspaceListHeader
+ accessibilityLabel="T3 Code, Threads"
onOpenEnvironments={() => openSettings(navigation, "SettingsEnvironments")}
- onOpenSettings={() => selectTab("settings")}
- onSearchQueryChange={setSearchQuery}
- onStartNewTask={startNewTask}
+ search={{
+ value: searchQuery,
+ onChangeText: setSearchQuery,
+ placeholder: "Search",
+ accessibilityLabel: "Search threads",
+ }}
+ filter={{
+ customized: selectedEnvironmentId !== null || selectedProjectKey !== null,
+ items: buildHomeListFilterMenuItems({
+ environments,
+ projects: projectFilterOptions,
+ selectedEnvironmentId,
+ selectedProjectKey,
+ onEnvironmentChange: setSelectedEnvironmentId,
+ onProjectChange: setSelectedProjectKey,
+ }),
+ }}
/>
<HomeScreen
diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx
index 77d0cd2e66c..7463e325f73 100644
--- a/apps/mobile/src/features/home/HomeScreen.tsx
+++ b/apps/mobile/src/features/home/HomeScreen.tsx
@@ -47,14 +47,14 @@ import {
useNativeColumnLayoutMetrics,
useNativeLayoutMetrics,
} from "../../native/native-layout-metrics";
-import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
+import { useWorkspaceListEmptyTopInset } from "../layout/workspace/workspace-list-insets";
import { useNativeWorkspaceColumnsSupported } from "../../native/NativeWorkspaceColumns";
import { useThreadSearch } from "../../state/queries";
import { requestThreadMessageJump } from "../threads/threadMessageJump";
import { useThreadListSearchMatches } from "../threads/useThreadListSearchMatches";
import { useThreadListV2 } from "../threads/useThreadListV2";
import { useThreadListNow } from "../threads/use-thread-list-now";
-import { useSearchScrollRestoration } from "../workspace/useSearchScrollRestoration";
+import { useSearchScrollRestoration } from "../layout/workspace/useSearchScrollRestoration";
import { useThreadJumpShortcuts } from "../keyboard/threadKeyboardShortcuts";
import { usePendingThreadOrder } from "../../state/thread-order";
import { threadListEnvironmentsAtom } from "../../state/presentation";
@@ -87,7 +87,7 @@ import {
import { createSwipeRowActivation } from "./swipe-row-activation";
import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "./thread-swipe-actions";
import { useFabScroll } from "./FabScrollContext";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
+import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
import { ThreadListFilters } from "./ThreadListFilters";
interface HomeScreenProps {
@@ -262,6 +262,7 @@ export function HomeScreen(props: HomeScreenProps) {
const openSwipeableRef = useRef<SwipeableMethods | null>(null);
const homeScrollGesture = useNativeGesture();
const insets = useSafeAreaInsets();
+ const emptyTopInset = useWorkspaceListEmptyTopInset();
const { fabClearance } = useAndroidControlSizing();
const screenMetrics = useNativeLayoutMetrics();
const contentSideInsets = usesNativeWorkspaceColumns
@@ -682,7 +683,7 @@ export function HomeScreen(props: HomeScreenProps) {
style={{
paddingBottom:
Platform.OS === "ios" ? iosBottomClearance : Math.max(insets.bottom, 24),
- paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
+ paddingTop: emptyTopInset,
paddingLeft: 32 + (contentSideInsets?.left ?? 0),
paddingRight: 32 + (contentSideInsets?.right ?? 0),
}}
diff --git a/apps/mobile/src/features/home/ThreadListFilters.tsx b/apps/mobile/src/features/home/ThreadListFilters.tsx
index a7d6894c35d..c6165e649b4 100644
--- a/apps/mobile/src/features/home/ThreadListFilters.tsx
+++ b/apps/mobile/src/features/home/ThreadListFilters.tsx
@@ -1,22 +1,22 @@
import { Pressable, ScrollView } from "react-native";
import { SymbolView } from "../../components/ui/AppSymbol";
-import { ListFilterMenu } from "../workspace/ListFilterMenu";
-import type { HomeHeaderProps } from "./HomeHeader.types";
+import { ListFilterMenu } from "../layout/workspace/ListFilterMenu";
+import type { EnvironmentId } from "@t3tools/contracts";
+import type {
+ HomeListFilterMenuEnvironment,
+ HomeListFilterMenuProject,
+} from "./home-list-filter-menu";
-export function ThreadListFilters(
- props: Pick<
- HomeHeaderProps,
- | "environments"
- | "projects"
- | "selectedEnvironmentId"
- | "selectedProjectKey"
- | "onEnvironmentChange"
- | "onProjectChange"
- > & {
- /** List padding the scroller bleeds through so pills start where row content does. */
- readonly gutter: number;
- },
-) {
+export function ThreadListFilters(props: {
+ readonly environments: ReadonlyArray<HomeListFilterMenuEnvironment>;
+ readonly projects: ReadonlyArray<HomeListFilterMenuProject>;
+ readonly selectedEnvironmentId: EnvironmentId | null;
+ readonly selectedProjectKey: string | null;
+ readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
+ readonly onProjectChange: (projectKey: string | null) => void;
+ /** List padding the scroller bleeds through so pills start where row content does. */
+ readonly gutter: number;
+}) {
const selectedEnvironment = props.environments.find(
(environment) => environment.environmentId === props.selectedEnvironmentId,
);
diff --git a/apps/mobile/src/features/home/ThreadListToolbar.tsx b/apps/mobile/src/features/home/ThreadListToolbar.tsx
deleted file mode 100644
index 8ed77bbcaa8..00000000000
--- a/apps/mobile/src/features/home/ThreadListToolbar.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import type { ThreadListToolbarProps } from "./ThreadListToolbar.types";
-
-/** iOS lists use native header items; only Android draws this toolbar. */
-export function ThreadListToolbar(_props: ThreadListToolbarProps) {
- return null;
-}
diff --git a/apps/mobile/src/features/home/ThreadListToolbar.types.ts b/apps/mobile/src/features/home/ThreadListToolbar.types.ts
deleted file mode 100644
index 6dbf7133154..00000000000
--- a/apps/mobile/src/features/home/ThreadListToolbar.types.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import type { MenuAction } from "@react-native-menu/menu";
-
-export interface ThreadListToolbarProps {
- readonly searchQuery: string;
- readonly onSearchQueryChange: (query: string) => void;
- readonly filterActions: MenuAction[];
- readonly filterCustomized: boolean;
- readonly onFilterSelect: (id: string) => void;
- readonly onOpenEnvironments: () => void;
- readonly onRequestVisibility?: () => void;
-}
diff --git a/apps/mobile/src/features/home/ThreadUndoNotice.tsx b/apps/mobile/src/features/home/ThreadUndoNotice.tsx
index 364873a3ead..caeb47a3c21 100644
--- a/apps/mobile/src/features/home/ThreadUndoNotice.tsx
+++ b/apps/mobile/src/features/home/ThreadUndoNotice.tsx
@@ -10,8 +10,8 @@ import {
useNativeLayoutMetrics,
useNativeColumnLayoutMetrics,
} from "../../native/native-layout-metrics";
-import { workspaceSearchBottomClearance } from "../workspace/workspace-tabs-state";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
+import { workspaceSearchBottomClearance } from "../layout/workspace/workspace-tabs-state";
+import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
import {
dismissThreadUndoNotice,
readThreadUndoNotice,
diff --git a/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx b/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx
index 58cf4138483..540831ad18f 100644
--- a/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx
+++ b/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx
@@ -1,4 +1,3 @@
-import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
import { createContext, use, useEffect, useState, type ReactNode } from "react";
import { Animated, Platform, Pressable, View } from "react-native";
@@ -6,11 +5,6 @@ import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
import { SymbolView } from "../../components/ui/AppSymbol";
import { AppText as Text } from "../../components/ui/AppText";
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
-import {
- brandTitleOffset,
- CompactBrandTitle,
- getCompactBrandHeaderOptions,
-} from "../../components/CompactBrandTitle";
import { useDeadlinePassed } from "../../lib/clock";
import { useWorkspaceState } from "../../state/workspace";
import {
@@ -159,24 +153,3 @@ export function WorkspaceConnectionTitle(props: {
</StatusFadeIn>
);
}
-
-export function getConnectionAwareBrandHeaderOptions(opts: {
- readonly headerWidth: number;
- readonly trailingItemCount?: number;
- readonly onOpenEnvironments: () => void;
- readonly fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"];
-}): NativeStackNavigationOptions {
- const maxWidth = Math.max(0, opts.headerWidth - 64 - 44 * (opts.trailingItemCount ?? 1));
-
- return {
- ...getCompactBrandHeaderOptions(opts.fallbackTitleStyle),
- headerTitle: () => (
- <WorkspaceConnectionTitle
- brand={<CompactBrandTitle />}
- maxWidth={maxWidth}
- onPress={opts.onOpenEnvironments}
- statusOffset={brandTitleOffset()}
- />
- ),
- };
-}
diff --git a/apps/mobile/src/features/home/home-list-filter-menu.ts b/apps/mobile/src/features/home/home-list-filter-menu.ts
index ac53e427d21..617c3fa0988 100644
--- a/apps/mobile/src/features/home/home-list-filter-menu.ts
+++ b/apps/mobile/src/features/home/home-list-filter-menu.ts
@@ -1,5 +1,7 @@
import type { EnvironmentId } from "@t3tools/contracts";
+import type { AppBarMenuItem } from "../../components/ui/AppBar.types";
+
export interface HomeListFilterMenuEnvironment {
readonly environmentId: EnvironmentId;
readonly label: string;
@@ -10,82 +12,57 @@ export interface HomeListFilterMenuProject {
readonly label: string;
}
-type HomeListFilterMenuAction = {
- readonly type: "action";
- readonly title: string;
- readonly subtitle?: string;
- readonly state?: "on" | "off";
- readonly onPress: () => void;
-};
-
-type HomeListFilterMenuSubmenu = {
- readonly type: "submenu";
- readonly title: string;
- readonly items: HomeListFilterMenuAction[];
-};
-
-export interface HomeListFilterMenu {
- readonly title: string;
- readonly items: Array<HomeListFilterMenuAction | HomeListFilterMenuSubmenu>;
-}
-
-export function buildHomeListFilterMenu(props: {
+export function buildHomeListFilterMenuItems(props: {
readonly environments: ReadonlyArray<HomeListFilterMenuEnvironment>;
readonly projects: ReadonlyArray<HomeListFilterMenuProject>;
readonly selectedEnvironmentId: EnvironmentId | null;
readonly selectedProjectKey: string | null;
readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
readonly onProjectChange: (projectKey: string | null) => void;
-}): HomeListFilterMenu {
- const items: Array<HomeListFilterMenuAction | HomeListFilterMenuSubmenu> = [];
-
- items.push({
- type: "submenu",
- title: "Environment",
- items: [
- {
- type: "action",
- title: "All environments",
- subtitle: "Show threads from every environment",
- state: props.selectedEnvironmentId === null ? "on" : "off",
- onPress: () => props.onEnvironmentChange(null),
- },
- ...props.environments.map((environment) => ({
- type: "action" as const,
- title: environment.label,
- state:
- props.selectedEnvironmentId === environment.environmentId
- ? ("on" as const)
- : ("off" as const),
- onPress: () => props.onEnvironmentChange(environment.environmentId),
- })),
- ],
- });
+}): AppBarMenuItem[] {
+ const items: AppBarMenuItem[] = [
+ {
+ id: "environment",
+ title: "Environment",
+ items: [
+ {
+ id: "environment:all",
+ title: "All environments",
+ subtitle: "Show threads from every environment",
+ selected: props.selectedEnvironmentId === null,
+ onPress: () => props.onEnvironmentChange(null),
+ },
+ ...props.environments.map((environment) => ({
+ id: `environment:${environment.environmentId}`,
+ title: environment.label,
+ selected: props.selectedEnvironmentId === environment.environmentId,
+ onPress: () => props.onEnvironmentChange(environment.environmentId),
+ })),
+ ],
+ },
+ ];
if (props.projects.length > 0) {
items.push({
- type: "submenu",
+ id: "project",
title: "Project",
items: [
{
- type: "action",
+ id: "project:all",
title: "All projects",
subtitle: "Show threads from every project",
- state: props.selectedProjectKey === null ? "on" : "off",
+ selected: props.selectedProjectKey === null,
onPress: () => props.onProjectChange(null),
},
...props.projects.map((project) => ({
- type: "action" as const,
+ id: `project:${project.key}`,
title: project.label,
- state: props.selectedProjectKey === project.key ? ("on" as const) : ("off" as const),
+ selected: props.selectedProjectKey === project.key,
onPress: () => props.onProjectChange(project.key),
})),
],
});
}
- return {
- title: "Thread list options",
- items,
- };
+ return items;
}
diff --git a/apps/mobile/src/features/keyboard/CommandPalette.tsx b/apps/mobile/src/features/keyboard/CommandPalette.tsx
index e9e9e50d452..198ac724f52 100644
--- a/apps/mobile/src/features/keyboard/CommandPalette.tsx
+++ b/apps/mobile/src/features/keyboard/CommandPalette.tsx
@@ -71,8 +71,8 @@ import { parseActiveThreadPath, type HardwareKeyboardCommand } from "./hardwareK
import { threadJumpIndex } from "./threadKeyboardShortcuts";
import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
import { openSettings } from "../settings/settings-navigation";
-import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceTab } from "../layout/workspace/useSelectWorkspaceTab";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
const PALETTE_COMMANDS: ReadonlyArray<HardwareKeyboardCommand> = [
"commandPalette",
diff --git a/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx b/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx
index 135715f0649..98fba788bbd 100644
--- a/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx
+++ b/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx
@@ -18,7 +18,7 @@ import { copyThreadReference } from "../../lib/copyThreadReference";
import {
firstWorkspaceDetailOpen,
workspaceHasColumns,
-} from "../workspace/workspace-selection-store";
+} from "../layout/workspace/workspace-selection-store";
import { T3KeyboardCommands } from "../../native/T3KeyboardCommands";
import { useThreadShell } from "../../state/entities";
import type { GitActionProgress } from "../../state/use-vcs-action-state";
@@ -32,7 +32,7 @@ import {
subscribeToHardwareKeyboardCommandRegistrations,
type HardwareKeyboardCommand,
} from "./hardwareKeyboardCommands";
-import { selectWorkspaceDetail } from "../workspace/workspace-detail-selection";
+import { selectWorkspaceDetail } from "../layout/workspace/workspace-detail-selection";
const EMPTY_COPY_FEEDBACK: GitActionProgress = {
phase: "idle",
diff --git a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
index 02c18801445..bf8b3ad9b08 100644
--- a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+++ b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
@@ -69,20 +69,20 @@ import {
useHardwareKeyboardCommand,
} from "../keyboard/hardwareKeyboardCommands";
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
-import { useEnabledNavigationTabs } from "../workspace/navigation-tabs";
-import { FLOATING_TABS, floatingTabsMetrics } from "../workspace/floating-workspace-tabs";
+import { useEnabledNavigationTabs } from "./workspace/navigation-tabs";
+import { FLOATING_TABS, floatingTabsMetrics } from "./workspace/floating-workspace-tabs";
import {
AndroidWorkspaceNavigation,
FloatingWorkspaceTabs,
ANDROID_WORKSPACE_RAIL_WIDTH,
-} from "../workspace/AndroidWorkspaceNavigation";
+} from "./workspace/AndroidWorkspaceNavigation";
import {
selectWorkspaceDetail,
type WorkspaceDetail,
type WorkspaceDetailSheet,
-} from "../workspace/workspace-detail-selection";
-import { startOpeningDetail } from "../workspace/useSelectWorkspaceDetail";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
+} from "./workspace/workspace-detail-selection";
+import { startOpeningDetail } from "./workspace/useSelectWorkspaceDetail";
+import { useWorkspaceTabs } from "./workspace/WorkspaceTabsContext";
import { HomeListOptionsProvider } from "../home/home-list-options";
import { newTaskDestination } from "../threads/new-task-project-selection";
import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
@@ -103,20 +103,20 @@ import {
import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
import { AndroidHingeObserver } from "../../native/AndroidHingeObserver";
import { WindowHingeContext } from "../../native/window-hinge-context";
-import { useAndroidWorkspaceRoot } from "../workspace/AndroidWorkspaceTabsProvider";
+import { useAndroidWorkspaceRoot } from "./workspace/AndroidWorkspaceTabsProvider";
import { dispatchRootStackReset, rootStackState } from "../../lib/root-stack-reset";
import {
currentWorkspaceSelections,
workspaceSelectionCheck,
-} from "../workspace/workspace-selection-store";
+} from "./workspace/workspace-selection-store";
import {
workspaceTabColumns,
workspaceTabNavigationState,
-} from "../workspace/workspace-tab-navigation";
-import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
+} from "./workspace/workspace-tab-navigation";
+import type { WorkspaceTab } from "./workspace/workspace-tabs-state";
import { workspaceRoutesOf } from "./workspace-overlay-routes";
import { SettingsWorkspaceLayout } from "../settings/SettingsWorkspaceLayout";
-import { WorkspaceThreadSidebar } from "../workspace/WorkspaceThreadSidebar";
+import { WorkspaceThreadSidebar } from "./workspace/WorkspaceThreadSidebar";
export { useAdaptiveWorkspaceLayout };
diff --git a/apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx b/apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
index 7a7d717259c..e04b72cb968 100644
--- a/apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
+++ b/apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
@@ -6,7 +6,7 @@ import { NewThreadButton } from "../../components/NewThreadButton";
import { FloatingActionButton } from "../../components/ui/FloatingActionButton";
import { EmptyState } from "../../components/ui/EmptyState";
import { ScreenContent } from "../../components/ui/ScreenContent";
-import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
+import type { WorkspaceTab } from "./workspace/workspace-tabs-state";
export function WorkspaceEmptyDetail(props: {
readonly tab?: WorkspaceTab | "settings";
diff --git a/apps/mobile/src/features/layout/adaptive-workspace-context.ts b/apps/mobile/src/features/layout/adaptive-workspace-context.ts
index 10025141007..d82e6202c63 100644
--- a/apps/mobile/src/features/layout/adaptive-workspace-context.ts
+++ b/apps/mobile/src/features/layout/adaptive-workspace-context.ts
@@ -1,10 +1,7 @@
-import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
+import type { WorkspaceTab } from "./workspace/workspace-tabs-state";
import { createContext, use } from "react";
import type { InspectorContent } from "./inspector-panes";
-import type {
- WorkspaceDetail,
- WorkspaceDetailSheet,
-} from "../workspace/workspace-detail-selection";
+import type { WorkspaceDetail, WorkspaceDetailSheet } from "./workspace/workspace-detail-selection";
import {
deriveFileInspectorPaneLayout,
deriveLayout,
diff --git a/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx b/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
index 49569f9b8e6..14ffb11abf2 100644
--- a/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+++ b/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
@@ -35,15 +35,15 @@ import { GestureHandlerRootView } from "react-native-gesture-handler";
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { NATIVE_INSPECTOR_MIN_MAIN_WIDTH } from "../../lib/layout";
import { scopedThreadKey } from "../../lib/scopedEntities";
-import { WorkspaceTabsProvider, useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
+import { WorkspaceTabsProvider, useWorkspaceTabs } from "./workspace/WorkspaceTabsContext";
import {
WorkspaceNativeTabs,
WorkspaceSidebarTabsFooter,
-} from "../workspace/WorkspaceNativeTabs.ios";
-import { workspaceUsesColumns } from "../workspace/workspace-tabs-state";
+} from "./workspace/WorkspaceNativeTabs.ios";
+import { workspaceUsesColumns } from "./workspace/workspace-tabs-state";
import { isSettingsRoute, settingsOpenIn } from "../settings/settings-navigation";
import { workspaceRoutesOf } from "./workspace-overlay-routes";
-import { setNativelyPoppingWorkspaceRoute } from "../workspace/workspace-detail-selection";
+import { setNativelyPoppingWorkspaceRoute } from "./workspace/workspace-detail-selection";
import { useDeviceType, useNativeLayoutMetrics } from "../../native/native-layout-metrics";
import { useAdaptiveWorkspaceLayout } from "./AdaptiveWorkspaceLayout";
diff --git a/apps/mobile/src/features/layout/useOpenWorkspaceDetail.ts b/apps/mobile/src/features/layout/useOpenWorkspaceDetail.ts
index 994b1ecc0a4..64966c35844 100644
--- a/apps/mobile/src/features/layout/useOpenWorkspaceDetail.ts
+++ b/apps/mobile/src/features/layout/useOpenWorkspaceDetail.ts
@@ -1,11 +1,8 @@
import { StackActions, useNavigation } from "@react-navigation/native";
import { Platform } from "react-native";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
-import type {
- WorkspaceDetail,
- WorkspaceDetailSheet,
-} from "../workspace/workspace-detail-selection";
+import { useSelectWorkspaceDetail } from "./workspace/useSelectWorkspaceDetail";
+import type { WorkspaceDetail, WorkspaceDetailSheet } from "./workspace/workspace-detail-selection";
/**
* Opens a thread or pull request from another page. Android shows one detail page at a time, so
diff --git a/apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx b/apps/mobile/src/features/layout/workspace/AndroidWorkspaceNavigation.android.tsx
similarity index 92%
rename from apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
rename to apps/mobile/src/features/layout/workspace/AndroidWorkspaceNavigation.android.tsx
index 292a5465060..246a0c9d7cb 100644
--- a/apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
+++ b/apps/mobile/src/features/layout/workspace/AndroidWorkspaceNavigation.android.tsx
@@ -11,18 +11,18 @@ import {
} from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
-import { useToolbarLayout } from "../../components/ui/useToolbarLayout";
-import { rootNavigationRef } from "../../lib/rootNavigation";
-import { useWorkspaceConnectionState } from "../../state/workspace";
+import { useAndroidControlSizing } from "../../../components/ui/useAndroidControlSizing";
+import { useToolbarLayout } from "../../../components/ui/useToolbarLayout";
+import { rootNavigationRef } from "../../../lib/rootNavigation";
+import { useWorkspaceConnectionState } from "../../../state/workspace";
import { androidWorkspaceNavigationColors } from "./android-workspace-navigation-colors";
import {
androidWorkspaceTabNavigationState,
type AndroidWorkspaceNavigationTab,
} from "./android-workspace-tabs";
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
-import { useSoftKeyboardShowing } from "../keyboard/useSoftKeyboardShowing";
-import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
+import { useAppearancePreferences } from "../../settings/appearance/AppearancePreferencesProvider";
+import { useSoftKeyboardShowing } from "../../keyboard/useSoftKeyboardShowing";
+import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
import { useAndroidWorkspaceRoot } from "./AndroidWorkspaceTabsProvider";
import { useNavigationTabOrder, useHiddenNavigationTabs } from "./navigation-tabs";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
diff --git a/apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.tsx b/apps/mobile/src/features/layout/workspace/AndroidWorkspaceNavigation.tsx
similarity index 100%
rename from apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.tsx
rename to apps/mobile/src/features/layout/workspace/AndroidWorkspaceNavigation.tsx
diff --git a/apps/mobile/src/features/workspace/AndroidWorkspaceSidebar.android.tsx b/apps/mobile/src/features/layout/workspace/AndroidWorkspaceSidebar.android.tsx
similarity index 79%
rename from apps/mobile/src/features/workspace/AndroidWorkspaceSidebar.android.tsx
rename to apps/mobile/src/features/layout/workspace/AndroidWorkspaceSidebar.android.tsx
index 73cd078c9b8..5d784359d4f 100644
--- a/apps/mobile/src/features/workspace/AndroidWorkspaceSidebar.android.tsx
+++ b/apps/mobile/src/features/layout/workspace/AndroidWorkspaceSidebar.android.tsx
@@ -1,23 +1,23 @@
-import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
+import { useAndroidFloatingTabs } from "../../settings/appearance/AppearancePreferencesProvider";
import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
import { useEnabledNavigationTabs } from "./navigation-tabs";
import { NAVIGATION_TAB_ORDER } from "./navigation-tab-order";
import { useNavigationState } from "@react-navigation/native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
+import { useAndroidControlSizing } from "../../../components/ui/useAndroidControlSizing";
import { FLOATING_TABS } from "./floating-workspace-tabs";
import { View } from "react-native";
-import { ScreenContent } from "../../components/ui/ScreenContent";
-import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
-import { PullRequestToolbar } from "../pull-requests/PullRequestToolbar.android";
-import { selectedPullRequestKey } from "../pull-requests/pullRequestSelection";
-import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
-import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
+import { ScreenContent } from "../../../components/ui/ScreenContent";
+import { PullRequestsScreen } from "../../pull-requests/PullRequestsScreen";
+import { PullRequestToolbar } from "./PullRequestToolbar.android";
+import { selectedPullRequestKey } from "../../pull-requests/pullRequestSelection";
+import { AndroidHomeFabLayout } from "../../home/AndroidHomeFab";
+import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
import { useAndroidWorkspaceRoot } from "./AndroidWorkspaceTabsProvider";
import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
import { WorkspaceTabPanes } from "./WorkspaceTabPanes";
import { WorkspaceThreadSidebar } from "./WorkspaceThreadSidebar";
-import { WorkspaceAppBarScope } from "../../components/ui/WorkspaceAppBar.android";
+import { WorkspaceAppBarScope } from "../../../components/ui/WorkspaceAppBar.android";
/** The Home route in the sidebar column: the selected tab's list. */
export function AndroidWorkspaceSidebar() {
diff --git a/apps/mobile/src/features/workspace/AndroidWorkspaceTabsProvider.tsx b/apps/mobile/src/features/layout/workspace/AndroidWorkspaceTabsProvider.tsx
similarity index 100%
rename from apps/mobile/src/features/workspace/AndroidWorkspaceTabsProvider.tsx
rename to apps/mobile/src/features/layout/workspace/AndroidWorkspaceTabsProvider.tsx
diff --git a/apps/mobile/src/features/workspace/ListFilterMenu.tsx b/apps/mobile/src/features/layout/workspace/ListFilterMenu.tsx
similarity index 79%
rename from apps/mobile/src/features/workspace/ListFilterMenu.tsx
rename to apps/mobile/src/features/layout/workspace/ListFilterMenu.tsx
index dbba1aaba04..6905dee8bdd 100644
--- a/apps/mobile/src/features/workspace/ListFilterMenu.tsx
+++ b/apps/mobile/src/features/layout/workspace/ListFilterMenu.tsx
@@ -1,8 +1,8 @@
import { Pressable } from "react-native";
-import { Chip } from "../../components/ui/Chip";
-import { Menu } from "../../components/ui/Menu";
-import type { MenuProps } from "../../components/ui/Menu.types";
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
+import { Chip } from "../../../components/ui/Chip";
+import { Menu } from "../../../components/ui/Menu";
+import type { MenuProps } from "../../../components/ui/Menu.types";
+import { useAppearancePreferences } from "../../settings/appearance/AppearancePreferencesProvider";
export function ListFilterMenu(props: {
readonly label: string;
diff --git a/apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx b/apps/mobile/src/features/layout/workspace/PullRequestToolbar.android.tsx
similarity index 85%
rename from apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx
rename to apps/mobile/src/features/layout/workspace/PullRequestToolbar.android.tsx
index bf7eec3d366..332c1befe18 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx
+++ b/apps/mobile/src/features/layout/workspace/PullRequestToolbar.android.tsx
@@ -1,13 +1,13 @@
import { useNavigation } from "@react-navigation/native";
import { useEffect } from "react";
import { BackHandler, Keyboard } from "react-native";
-import { AppBar } from "../../components/ui/AppBar";
-import { appBarMenuItemsFromActions } from "../../components/ui/menuActionItems";
-import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
-import { WorkspaceBrandTitle } from "../workspace/WorkspaceBrandTitle";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
-import type { PullRequestFilterMenu } from "./PullRequestListFilters";
-import { openSettings } from "../settings/settings-navigation";
+import { AppBar } from "../../../components/ui/AppBar";
+import { appBarMenuItemsFromActions } from "../../../components/ui/menuActionItems";
+import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
+import { WorkspaceBrandTitle } from "./WorkspaceBrandTitle";
+import { useWorkspaceTabs } from "./WorkspaceTabsContext";
+import type { PullRequestFilterMenu } from "../../pull-requests/PullRequestListFilters";
+import { openSettings } from "../../settings/settings-navigation";
/** PR search shares the thread list's Android header. */
export function PullRequestToolbar(props: {
diff --git a/apps/mobile/src/features/workspace/WorkspaceBrandTitle.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceBrandTitle.tsx
similarity index 75%
rename from apps/mobile/src/features/workspace/WorkspaceBrandTitle.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceBrandTitle.tsx
index a1e2d4fc32a..c14fabc083f 100644
--- a/apps/mobile/src/features/workspace/WorkspaceBrandTitle.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceBrandTitle.tsx
@@ -1,5 +1,5 @@
-import { CompactBrandTitle } from "../../components/CompactBrandTitle";
-import { WorkspaceConnectionTitle } from "../home/WorkspaceConnectionTitle";
+import { CompactBrandTitle } from "../../../components/CompactBrandTitle";
+import { WorkspaceConnectionTitle } from "../../home/WorkspaceConnectionTitle";
/** The title of a workspace list tab: the brand and the connection status. */
export function WorkspaceBrandTitle(props: {
diff --git a/apps/mobile/src/features/workspace/WorkspaceDock.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceDock.tsx
similarity index 92%
rename from apps/mobile/src/features/workspace/WorkspaceDock.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceDock.tsx
index b4583cbb7d2..f6a9966f67a 100644
--- a/apps/mobile/src/features/workspace/WorkspaceDock.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceDock.tsx
@@ -1,10 +1,10 @@
import { Keyboard, Pressable, View } from "react-native";
-import { SymbolView } from "../../components/ui/AppSymbol";
-import { GlassSurface } from "../../components/ui/GlassSurface";
+import { SymbolView } from "../../../components/ui/AppSymbol";
+import { GlassSurface } from "../../../components/ui/GlassSurface";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import { WORKSPACE_DOCK } from "./workspace-tabs-state";
-import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
+import { PullRequestGlyph } from "../../pull-requests/pullRequestGlyphs";
export function WorkspaceDock(props: { readonly onNewTask: () => void }) {
const workspace = useWorkspaceTabs()!;
diff --git a/apps/mobile/src/features/workspace/WorkspaceExtraTab.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceExtraTab.tsx
similarity index 70%
rename from apps/mobile/src/features/workspace/WorkspaceExtraTab.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceExtraTab.tsx
index d24f7c1bb27..17fc0069eb8 100644
--- a/apps/mobile/src/features/workspace/WorkspaceExtraTab.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceExtraTab.tsx
@@ -1,6 +1,6 @@
import { type NavigationTab } from "./navigation-tab-order";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
-import { UsageRouteScreen } from "../usage/UsageRouteScreen";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
+import { UsageRouteScreen } from "../../usage/UsageRouteScreen";
export function WorkspaceExtraTab(_props: {
tab: Exclude<NavigationTab, "threads" | "pullRequests">;
diff --git a/apps/mobile/src/features/layout/workspace/WorkspaceListEmptyDetail.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceListEmptyDetail.tsx
new file mode 100644
index 00000000000..fb1d86ad127
--- /dev/null
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceListEmptyDetail.tsx
@@ -0,0 +1,51 @@
+import { Platform } from "react-native";
+
+import { AppBar } from "../../../components/ui/AppBar";
+import { Toolbar } from "../../../components/ui/Toolbar";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
+import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
+import { WorkspaceEmptyDetail } from "../WorkspaceEmptyDetail";
+
+/**
+ * The thread list's route in split view, where the list is the sidebar beside it: an empty
+ * detail. iOS clears the list's bar and keeps only New task.
+ */
+export function WorkspaceListEmptyDetail(props: {
+ readonly hasConnections: boolean;
+ readonly onAddConnection: () => void;
+ readonly onStartNewTask: () => void;
+}) {
+ const { panes } = useAdaptiveWorkspaceLayout();
+ return (
+ <>
+ <NativeStackScreenOptions
+ options={{
+ title: "",
+ headerTitle: "",
+ unstable_headerLeftItems: () => [],
+ headerSearchBarOptions: undefined,
+ unstable_headerRightItems: () => [],
+ unstable_headerToolbarItems: () => [],
+ }}
+ />
+ <Toolbar placement="left">
+ <Toolbar.Button
+ accessibilityLabel="New task"
+ icon="square.and.pencil"
+ onPress={props.onStartNewTask}
+ />
+ </Toolbar>
+ <AppBar embedded title="Threads" />
+ <WorkspaceEmptyDetail
+ onAddConnection={
+ Platform.OS === "android" && !props.hasConnections ? props.onAddConnection : undefined
+ }
+ onStartNewTask={
+ Platform.OS === "android" && panes.primarySidebarVisible
+ ? undefined
+ : props.onStartNewTask
+ }
+ />
+ </>
+ );
+}
diff --git a/apps/mobile/src/features/home/ThreadListToolbar.android.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceListHeader.android.tsx
similarity index 65%
rename from apps/mobile/src/features/home/ThreadListToolbar.android.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceListHeader.android.tsx
index babbf32859a..5c6f7935841 100644
--- a/apps/mobile/src/features/home/ThreadListToolbar.android.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceListHeader.android.tsx
@@ -1,16 +1,18 @@
import { useEffect, useState } from "react";
import { useNavigation, useNavigationState } from "@react-navigation/native";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
import { BackHandler, Keyboard } from "react-native";
-import { AppBar } from "../../components/ui/AppBar";
-import { appBarMenuItemsFromActions } from "../../components/ui/menuActionItems";
-import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
-import { WorkspaceBrandTitle } from "../workspace/WorkspaceBrandTitle";
-import { useWorkspaceConnectionState } from "../../state/workspace";
-import type { ThreadListToolbarProps } from "./ThreadListToolbar.types";
+import { AppBar } from "../../../components/ui/AppBar";
+import { useWorkspaceConnectionState } from "../../../state/workspace";
+import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
+import { WorkspaceBrandTitle } from "./WorkspaceBrandTitle";
+import { useWorkspaceTabs } from "./WorkspaceTabsContext";
+import {
+ workspaceListFilterIcon,
+ type WorkspaceListHeaderProps,
+} from "./WorkspaceListHeader.types";
-export function ThreadListToolbar(props: ThreadListToolbarProps) {
+export function WorkspaceListHeader(props: WorkspaceListHeaderProps) {
const navigation = useNavigation();
const workspace = useWorkspaceTabs();
const isTabActive = workspace?.isTabActive;
@@ -18,11 +20,12 @@ export function ThreadListToolbar(props: ThreadListToolbarProps) {
const listFocused =
homeFocused && (workspace === null || workspace.state.selectedTab === "threads");
const connectionState = useWorkspaceConnectionState();
- const { onRequestVisibility, onSearchQueryChange } = props;
+ const { search, sidebar } = props;
+ const onSearchQueryChange = search.onChangeText;
const [searchOpen, setSearchOpen] = useState(false);
- const searching = searchOpen || props.searchQuery.length > 0;
+ const searching = searchOpen || search.value.length > 0;
const openSearch = () => {
- onRequestVisibility?.();
+ sidebar?.onRequestVisibility();
setSearchOpen(true);
return true;
};
@@ -58,15 +61,15 @@ export function ThreadListToolbar(props: ThreadListToolbarProps) {
title="T3 Code"
titleContent={
<WorkspaceBrandTitle
- accessibilityLabel="T3 Code, Threads"
+ accessibilityLabel={props.accessibilityLabel}
onOpenEnvironments={props.onOpenEnvironments}
/>
}
search={{
- value: props.searchQuery,
+ value: search.value,
onChangeText: onSearchQueryChange,
- placeholder: "Search",
- accessibilityLabel: "Search threads",
+ placeholder: search.placeholder,
+ accessibilityLabel: search.accessibilityLabel,
active: searching,
onOpen: openSearch,
onClose: closeSearch,
@@ -76,10 +79,8 @@ export function ThreadListToolbar(props: ThreadListToolbarProps) {
? [
{
title: "Filter threads",
- icon: props.filterCustomized
- ? "line.3.horizontal.decrease.circle.fill"
- : "line.3.horizontal.decrease.circle",
- items: appBarMenuItemsFromActions(props.filterActions, props.onFilterSelect),
+ icon: workspaceListFilterIcon(props.filter.customized),
+ items: props.filter.items,
},
]
: undefined
diff --git a/apps/mobile/src/features/layout/workspace/WorkspaceListHeader.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceListHeader.tsx
new file mode 100644
index 00000000000..840c0c9144f
--- /dev/null
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceListHeader.tsx
@@ -0,0 +1,70 @@
+import { useRef } from "react";
+import type { SearchBarCommands } from "react-native-screens";
+
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
+import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
+import { getConnectionAwareBrandHeaderOptions } from "./brand-header-options";
+import { createWorkspaceListHeaderItems } from "./workspace-list-header-items";
+import {
+ workspaceListFilterIcon,
+ type WorkspaceListHeaderProps,
+} from "./WorkspaceListHeader.types";
+
+export function WorkspaceListHeader(props: WorkspaceListHeaderProps) {
+ return props.sidebar ? <SidebarColumnHeader {...props} sidebar={props.sidebar} /> : null;
+}
+
+function SidebarColumnHeader(
+ props: WorkspaceListHeaderProps & {
+ readonly sidebar: NonNullable<WorkspaceListHeaderProps["sidebar"]>;
+ },
+) {
+ const { search, sidebar } = props;
+ const searchBarRef = useRef<SearchBarCommands>(null);
+ useHardwareKeyboardCommand("focusSearch", () => {
+ const focus = () => searchBarRef.current?.focus();
+ if (!sidebar.visible) {
+ sidebar.onRequestVisibility();
+ // Focus once the revealed sidebar has slid in.
+ setTimeout(focus, 240);
+ } else {
+ focus();
+ }
+ return true;
+ });
+ const items = createWorkspaceListHeaderItems({
+ filter: {
+ accessibilityLabel: "Filter threads",
+ icon: workspaceListFilterIcon(props.filter.customized),
+ title: "Thread list options",
+ items: props.filter.items,
+ },
+ onOpenSettings: props.onOpenSettings,
+ });
+
+ return (
+ <NativeStackScreenOptions
+ optionsVersion={[items, sidebar.width]}
+ options={{
+ ...getConnectionAwareBrandHeaderOptions({
+ headerWidth: sidebar.width,
+ trailingItemCount: items.length,
+ onOpenEnvironments: props.onOpenEnvironments,
+ fallbackTitleStyle: { fontSize: 18, fontWeight: "800" },
+ }),
+ headerSearchBarOptions: {
+ ref: searchBarRef,
+ autoCapitalize: "none",
+ hideNavigationBar: false,
+ hideWhenScrolling: false,
+ obscureBackground: false,
+ placeholder: search.placeholder,
+ placement: "stacked",
+ onCancelButtonPress: () => search.onChangeText(""),
+ onChangeText: (event) => search.onChangeText(event.nativeEvent.text),
+ },
+ unstable_headerRightItems: () => items,
+ }}
+ />
+ );
+}
diff --git a/apps/mobile/src/features/layout/workspace/WorkspaceListHeader.types.ts b/apps/mobile/src/features/layout/workspace/WorkspaceListHeader.types.ts
new file mode 100644
index 00000000000..c367118cc93
--- /dev/null
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceListHeader.types.ts
@@ -0,0 +1,36 @@
+import type { AppBarMenuItem } from "../../../components/ui/AppBar.types";
+
+/** The header of the workspace thread list, on Home and in the sidebar column. */
+export interface WorkspaceListHeaderProps {
+ /** Spoken for the brand title, such as "T3 Code, Threads". */
+ readonly accessibilityLabel: string;
+ /** The connection status beside the brand opens environment settings. */
+ readonly onOpenEnvironments: () => void;
+ readonly search: {
+ readonly value: string;
+ readonly onChangeText: (value: string) => void;
+ readonly placeholder: string;
+ readonly accessibilityLabel: string;
+ };
+ readonly filter: {
+ readonly customized: boolean;
+ readonly items: ReadonlyArray<AppBarMenuItem>;
+ };
+ /** iOS: a settings button. Android reaches Settings from the workspace navigation. */
+ readonly onOpenSettings?: () => void;
+ /**
+ * Set when the list is the workspace's sidebar column, which draws its own bar on iOS. Without
+ * it the iOS workspace root's toolbar draws the list's bar and search.
+ */
+ readonly sidebar?: {
+ readonly width: number;
+ readonly visible: boolean;
+ readonly onRequestVisibility: () => void;
+ };
+}
+
+export function workspaceListFilterIcon(customized: boolean) {
+ return customized
+ ? "line.3.horizontal.decrease.circle.fill"
+ : "line.3.horizontal.decrease.circle";
+}
diff --git a/apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceNativeTabs.ios.tsx
similarity index 95%
rename from apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceNativeTabs.ios.tsx
index fbf99fb155f..2ede0bcddee 100644
--- a/apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceNativeTabs.ios.tsx
@@ -17,19 +17,19 @@ import {
import {
NativeWorkspaceTabActivityContext,
WorkspaceSlotOptionsContext,
-} from "../../native/v5-workspace-context";
+} from "../../../native/v5-workspace-context";
import {
useCompactWorkspaceTabs,
useFloatingWorkspaceTabs,
useSystemWorkspaceTabBar,
} from "./useSystemWorkspaceTabBar";
-import { useControlTheme } from "../../components/ui/useControlTheme";
-import { useDeviceType } from "../../native/native-layout-metrics";
+import { useControlTheme } from "../../../components/ui/useControlTheme";
+import { useDeviceType } from "../../../native/native-layout-metrics";
import { WorkspaceSidebarTabs } from "./WorkspaceSidebarTabs";
-import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
+import { useAdaptiveWorkspaceLayout } from "../AdaptiveWorkspaceLayout";
import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
-const PULL_REQUEST_ICON = require("../../../assets/icons/pull-request.png");
+const PULL_REQUEST_ICON = require("../../../../assets/icons/pull-request.png");
/** Retain each native controller tree; removing its root can leave RNS's stack empty. */
function RetainedWorkspaceTab(props: {
diff --git a/apps/mobile/src/features/workspace/WorkspaceNoTabs.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceNoTabs.tsx
similarity index 80%
rename from apps/mobile/src/features/workspace/WorkspaceNoTabs.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceNoTabs.tsx
index 1db0f2529de..561502dd540 100644
--- a/apps/mobile/src/features/workspace/WorkspaceNoTabs.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceNoTabs.tsx
@@ -1,7 +1,7 @@
import { useNavigation } from "@react-navigation/native";
import { View } from "react-native";
-import { EmptyState } from "../../components/ui/EmptyState";
-import { openSettings } from "../settings/settings-navigation";
+import { EmptyState } from "../../../components/ui/EmptyState";
+import { openSettings } from "../../settings/settings-navigation";
export function WorkspaceNoTabs() {
const navigation = useNavigation();
diff --git a/apps/mobile/src/features/workspace/WorkspaceRootScreen.android.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceRootScreen.android.tsx
similarity index 82%
rename from apps/mobile/src/features/workspace/WorkspaceRootScreen.android.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceRootScreen.android.tsx
index ec7a3bb8dcf..a03a36bc947 100644
--- a/apps/mobile/src/features/workspace/WorkspaceRootScreen.android.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceRootScreen.android.tsx
@@ -1,4 +1,4 @@
-import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
+import { useAndroidFloatingTabs } from "../../settings/appearance/AppearancePreferencesProvider";
import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
import { useEnabledNavigationTabs } from "./navigation-tabs";
import { NAVIGATION_TAB_ORDER } from "./navigation-tab-order";
@@ -6,22 +6,22 @@ import { WorkspaceExtraTab } from "./WorkspaceExtraTab";
import type { ReactNode } from "react";
import { View } from "react-native";
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
-import { AppBar } from "../../components/ui/AppBar";
-import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail";
-import { ScreenContent } from "../../components/ui/ScreenContent";
-import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
-import { HomeRouteScreen } from "../home/HomeRouteScreen";
-import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
-import { PullRequestToolbar } from "../pull-requests/PullRequestToolbar.android";
-import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
-import { WorkspaceSettledContentWidthContext } from "../layout/workspace-content-width";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
+import { AppBar } from "../../../components/ui/AppBar";
+import { WorkspaceEmptyDetail } from "../WorkspaceEmptyDetail";
+import { ScreenContent } from "../../../components/ui/ScreenContent";
+import { useAndroidControlSizing } from "../../../components/ui/useAndroidControlSizing";
+import { HomeRouteScreen } from "../../home/HomeRouteScreen";
+import { PullRequestsScreen } from "../../pull-requests/PullRequestsScreen";
+import { PullRequestToolbar } from "./PullRequestToolbar.android";
+import { useAdaptiveWorkspaceLayout } from "../AdaptiveWorkspaceLayout";
+import { WorkspaceSettledContentWidthContext } from "../workspace-content-width";
import { AndroidWorkspaceNavigation, FloatingWorkspaceTabs } from "./AndroidWorkspaceNavigation";
import { FLOATING_TABS } from "./floating-workspace-tabs";
import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
import { WorkspaceTabPanes } from "./WorkspaceTabPanes";
-import { WorkspaceAppBarScope } from "../../components/ui/WorkspaceAppBar.android";
-import { usePaneRole } from "../../components/ui/Pane";
+import { WorkspaceAppBarScope } from "../../../components/ui/WorkspaceAppBar.android";
+import { usePaneRole } from "../../../components/ui/Pane";
import { AndroidWorkspaceSidebar } from "./AndroidWorkspaceSidebar.android";
import type { WorkspaceTab } from "./workspace-tabs-state";
diff --git a/apps/mobile/src/features/workspace/WorkspaceRootScreen.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceRootScreen.tsx
similarity index 88%
rename from apps/mobile/src/features/workspace/WorkspaceRootScreen.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceRootScreen.tsx
index 20778dc657a..e8e7c0d3259 100644
--- a/apps/mobile/src/features/workspace/WorkspaceRootScreen.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceRootScreen.tsx
@@ -1,7 +1,7 @@
import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
import { WORKSPACE_TAB_LABELS, useEnabledNavigationTabs } from "./navigation-tabs";
import { WorkspaceExtraTab } from "./WorkspaceExtraTab";
-import { WorkspaceSettingsList } from "../settings/SettingsRouteScreen";
+import { WorkspaceSettingsList } from "../../settings/SettingsRouteScreen";
import { WorkspaceSectionToolbar } from "./WorkspaceSectionToolbar";
import { useNavigation } from "@react-navigation/native";
import { use } from "react";
@@ -9,21 +9,21 @@ import { View, useWindowDimensions } from "react-native";
import { useKeyboardState } from "react-native-keyboard-controller";
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
-import { CompactBrandTitle } from "../../components/CompactBrandTitle";
-import { HeaderItemsWidthContext } from "../../native/header-items-width";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
-import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
-import { isDuoDevice } from "../../lib/device-type";
-import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
+import { CompactBrandTitle } from "../../../components/CompactBrandTitle";
+import { HeaderItemsWidthContext } from "../../../native/header-items-width";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
+import { NativePrimaryColumnContext } from "../../../native/v5-workspace-context";
+import { isDuoDevice } from "../../../lib/device-type";
+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
import {
useDeviceType,
useNativeColumnLayoutMetrics,
useNativeLayoutMetrics,
-} from "../../native/native-layout-metrics";
-import { HomeRouteScreen } from "../home/HomeRouteScreen";
-import { WorkspaceConnectionTitle } from "../home/WorkspaceConnectionTitle";
-import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
-import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
+} from "../../../native/native-layout-metrics";
+import { HomeRouteScreen } from "../../home/HomeRouteScreen";
+import { WorkspaceConnectionTitle } from "../../home/WorkspaceConnectionTitle";
+import { useAdaptiveWorkspaceLayout } from "../AdaptiveWorkspaceLayout";
+import { PullRequestsScreen } from "../../pull-requests/PullRequestsScreen";
import {
WorkspaceTabsContext,
WorkspaceTabsProvider,
@@ -37,7 +37,7 @@ import {
useSidebarWorkspaceTabs,
useSystemWorkspaceTabBar,
} from "./useSystemWorkspaceTabBar";
-import { openSettings } from "../settings/settings-navigation";
+import { openSettings } from "../../settings/settings-navigation";
const TAB_TITLES = WORKSPACE_TAB_LABELS;
diff --git a/apps/mobile/src/features/workspace/WorkspaceSearchField.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceSearchField.tsx
similarity index 94%
rename from apps/mobile/src/features/workspace/WorkspaceSearchField.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceSearchField.tsx
index 98fb746e71d..c5667fd7308 100644
--- a/apps/mobile/src/features/workspace/WorkspaceSearchField.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceSearchField.tsx
@@ -2,8 +2,8 @@ import type { Ref } from "react";
import { Keyboard, Pressable, TextInput, View, type TextInputInstance } from "react-native";
import { useResolveClassNames } from "uniwind";
-import { SymbolView } from "../../components/ui/AppSymbol";
-import { GlassSurface } from "../../components/ui/GlassSurface";
+import { SymbolView } from "../../../components/ui/AppSymbol";
+import { GlassSurface } from "../../../components/ui/GlassSurface";
import { WORKSPACE_TOOLBAR, type WorkspaceTab } from "./workspace-tabs-state";
export function WorkspaceSearchField({
diff --git a/apps/mobile/src/features/workspace/WorkspaceSectionToolbar.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceSectionToolbar.tsx
similarity index 89%
rename from apps/mobile/src/features/workspace/WorkspaceSectionToolbar.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceSectionToolbar.tsx
index 611d6c8b2f2..1676a927ecc 100644
--- a/apps/mobile/src/features/workspace/WorkspaceSectionToolbar.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceSectionToolbar.tsx
@@ -1,7 +1,7 @@
import { selectedNavigationTab, visibleNavigationTabs } from "./navigation-tab-order";
-import { Toolbar } from "../../components/ui/Toolbar";
-import { useControlTheme } from "../../components/ui/useControlTheme";
-import { useDeviceType } from "../../native/native-layout-metrics";
+import { Toolbar } from "../../../components/ui/Toolbar";
+import { useControlTheme } from "../../../components/ui/useControlTheme";
+import { useDeviceType } from "../../../native/native-layout-metrics";
import {
NAVIGATION_TAB_ICONS,
WORKSPACE_TAB_LABELS,
@@ -12,7 +12,7 @@ import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
import { useCompactWorkspaceTabs, useSidebarWorkspaceTabs } from "./useSystemWorkspaceTabBar";
-const PULL_REQUEST_ICON = require("../../../assets/icons/pull-request.png");
+const PULL_REQUEST_ICON = require("../../../../assets/icons/pull-request.png");
export function WorkspaceTabToolbarButtons() {
const order = useNavigationTabOrder();
diff --git a/apps/mobile/src/features/layout/workspace/WorkspaceSidebarColumn.android.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceSidebarColumn.android.tsx
new file mode 100644
index 00000000000..2f13950ebb3
--- /dev/null
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceSidebarColumn.android.tsx
@@ -0,0 +1,9 @@
+import type { ReactNode } from "react";
+
+/** Android draws the sidebar's bar in-tree, so the column needs no stack of its own. */
+export function WorkspaceSidebarColumn(props: {
+ readonly width: number;
+ readonly children: ReactNode;
+}) {
+ return <>{props.children}</>;
+}
diff --git a/apps/mobile/src/features/layout/workspace/WorkspaceSidebarColumn.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceSidebarColumn.tsx
new file mode 100644
index 00000000000..743adc0d78a
--- /dev/null
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceSidebarColumn.tsx
@@ -0,0 +1,29 @@
+import type { ReactNode } from "react";
+import { StyleSheet, View } from "react-native";
+
+import { StandaloneStack } from "../nested-stacks";
+import { pageRoute } from "../route-options";
+import { getCompactBrandHeaderOptions } from "./brand-header-options";
+
+const SIDEBAR_COLUMN_OPTIONS = {
+ ...pageRoute(),
+ ...getCompactBrandHeaderOptions({ fontSize: 18, fontWeight: "800" }),
+};
+
+/** The iOS sidebar column hosts its own stack so it gets a native bar with the brand title. */
+export function WorkspaceSidebarColumn(props: {
+ readonly width: number;
+ readonly children: ReactNode;
+}) {
+ return (
+ <View
+ testID="thread-navigation-sidebar"
+ className="flex-1 border-border bg-drawer"
+ style={{ borderRightWidth: StyleSheet.hairlineWidth, width: props.width }}
+ >
+ <StandaloneStack surface="sidebar" options={SIDEBAR_COLUMN_OPTIONS}>
+ {props.children}
+ </StandaloneStack>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceSidebarTabs.ios.tsx
similarity index 97%
rename from apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceSidebarTabs.ios.tsx
index d46809c4bb1..0ebd5deb391 100644
--- a/apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceSidebarTabs.ios.tsx
@@ -1,7 +1,7 @@
import { selectedNavigationTab, visibleNavigationTabs } from "./navigation-tab-order";
import { requireNativeView } from "expo";
import type { NativeSyntheticEvent, ViewProps } from "react-native";
-import { useControlTheme } from "../../components/ui/useControlTheme";
+import { useControlTheme } from "../../../components/ui/useControlTheme";
import { useNavigationTabOrder, useHiddenNavigationTabs } from "./navigation-tabs";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
diff --git a/apps/mobile/src/features/workspace/WorkspaceSidebarTabs.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceSidebarTabs.tsx
similarity index 100%
rename from apps/mobile/src/features/workspace/WorkspaceSidebarTabs.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceSidebarTabs.tsx
diff --git a/apps/mobile/src/features/workspace/WorkspaceTabPanes.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceTabPanes.tsx
similarity index 100%
rename from apps/mobile/src/features/workspace/WorkspaceTabPanes.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceTabPanes.tsx
diff --git a/apps/mobile/src/features/workspace/WorkspaceTabsContext.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceTabsContext.tsx
similarity index 98%
rename from apps/mobile/src/features/workspace/WorkspaceTabsContext.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceTabsContext.tsx
index 6faa8c73d05..9ecb6fa933f 100644
--- a/apps/mobile/src/features/workspace/WorkspaceTabsContext.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceTabsContext.tsx
@@ -2,7 +2,7 @@ import { RegistryContext, useAtomValue } from "@effect/atom-react";
import { AsyncResult, Atom } from "effect/reactivity";
import { createContext, use, useState, type Dispatch, type ReactNode } from "react";
-import { mobilePreferencesAtom } from "../../state/preferences";
+import { mobilePreferencesAtom } from "../../../state/preferences";
import {
navigationCustomizationAvailable,
resolveHiddenNavigationTabs,
diff --git a/apps/mobile/src/features/workspace/WorkspaceThreadSidebar.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceThreadSidebar.tsx
similarity index 86%
rename from apps/mobile/src/features/workspace/WorkspaceThreadSidebar.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceThreadSidebar.tsx
index 9b968908094..f2602bd5960 100644
--- a/apps/mobile/src/features/workspace/WorkspaceThreadSidebar.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceThreadSidebar.tsx
@@ -5,13 +5,13 @@ import type {
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { useNavigation, useNavigationState } from "@react-navigation/native";
-import { scopedThreadKey } from "../../lib/scopedEntities";
-import { uuidv4 } from "../../lib/uuid";
-import { usePendingTaskListActions } from "../home/usePendingTaskListActions";
-import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
-import { openSettings } from "../settings/settings-navigation";
-import { ThreadNavigationSidebar } from "../threads/ThreadNavigationSidebar";
-import { useOpenThreadPullRequests } from "../threads/use-open-thread-pull-requests";
+import { scopedThreadKey } from "../../../lib/scopedEntities";
+import { uuidv4 } from "../../../lib/uuid";
+import { usePendingTaskListActions } from "../../home/usePendingTaskListActions";
+import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
+import { openSettings } from "../../settings/settings-navigation";
+import { ThreadNavigationSidebar } from "../../threads/ThreadNavigationSidebar";
+import { useOpenThreadPullRequests } from "../../threads/use-open-thread-pull-requests";
import { useSelectWorkspaceDetail } from "./useSelectWorkspaceDetail";
type Route = { readonly name: string; readonly params?: object };
diff --git a/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceToolbar.ios.tsx
similarity index 91%
rename from apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceToolbar.ios.tsx
index f2961b7904a..0734c1e8774 100644
--- a/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceToolbar.ios.tsx
@@ -1,21 +1,21 @@
-import { useActiveNewTask } from "../../state/active-new-task";
-import { Toolbar } from "../../components/ui/Toolbar";
+import { useActiveNewTask } from "../../../state/active-new-task";
+import { Toolbar } from "../../../components/ui/Toolbar";
import { useFocusEffect, useIsFocused } from "@react-navigation/native";
import { use, useCallback, useEffect, useRef } from "react";
-import { isDuoDevice } from "../../lib/device-type";
-import { useDeviceType } from "../../native/native-layout-metrics";
-import { createNativeHeaderMenu } from "../../components/ui/nativeHeaderMenu.ios";
-import { useSettingsEnvironmentMenu } from "../settings/components/SettingsEnvironmentFilterHeader";
+import { isDuoDevice } from "../../../lib/device-type";
+import { useDeviceType } from "../../../native/native-layout-metrics";
+import { createNativeHeaderMenu } from "../../../components/ui/nativeHeaderMenu.ios";
+import { useSettingsEnvironmentMenu } from "../../settings/components/SettingsEnvironmentFilterHeader";
import type { SearchBarCommands } from "react-native-screens";
-import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
import {
NativePrimaryColumnContext,
NativeWorkspaceTabActivityContext,
-} from "../../native/v5-workspace-context";
-import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
-import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
+} from "../../../native/v5-workspace-context";
+import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
+import { useAdaptiveWorkspaceLayout } from "../AdaptiveWorkspaceLayout";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import { shouldRestoreNativeSearch } from "./workspace-tabs-state";
import { useFloatingWorkspaceTabs, useSidebarWorkspaceTabs } from "./useSystemWorkspaceTabBar";
diff --git a/apps/mobile/src/features/workspace/WorkspaceToolbar.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceToolbar.tsx
similarity index 93%
rename from apps/mobile/src/features/workspace/WorkspaceToolbar.tsx
rename to apps/mobile/src/features/layout/workspace/WorkspaceToolbar.tsx
index b9b8c84734e..32f84d373d7 100644
--- a/apps/mobile/src/features/workspace/WorkspaceToolbar.tsx
+++ b/apps/mobile/src/features/layout/workspace/WorkspaceToolbar.tsx
@@ -10,15 +10,15 @@ import {
import { KeyboardStickyView, useKeyboardState } from "react-native-keyboard-controller";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
-import { GlassSurface } from "../../components/ui/GlassSurface";
-import { useHardwareBack } from "../../lib/backHandler";
-import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
+import { SymbolView, type AppSymbolName } from "../../../components/ui/AppSymbol";
+import { GlassSurface } from "../../../components/ui/GlassSurface";
+import { useHardwareBack } from "../../../lib/backHandler";
+import { useHardwareKeyboardCommand } from "../../keyboard/hardwareKeyboardCommands";
import { WorkspaceDock } from "./WorkspaceDock";
import { WorkspaceSearchField } from "./WorkspaceSearchField";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import { WORKSPACE_TOOLBAR, type WorkspaceTab } from "./workspace-tabs-state";
-import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
+import { PullRequestGlyph } from "../../pull-requests/pullRequestGlyphs";
const TABS: ReadonlyArray<{ id: WorkspaceTab; label: string; icon: AppSymbolName }> = [
{ id: "threads", label: "Threads", icon: "text.bubble" },
diff --git a/apps/mobile/src/features/workspace/android-workspace-navigation-colors.test.ts b/apps/mobile/src/features/layout/workspace/android-workspace-navigation-colors.test.ts
similarity index 94%
rename from apps/mobile/src/features/workspace/android-workspace-navigation-colors.test.ts
rename to apps/mobile/src/features/layout/workspace/android-workspace-navigation-colors.test.ts
index 35513187eab..e88bb83eecc 100644
--- a/apps/mobile/src/features/workspace/android-workspace-navigation-colors.test.ts
+++ b/apps/mobile/src/features/layout/workspace/android-workspace-navigation-colors.test.ts
@@ -1,10 +1,10 @@
import { describe, expect, it } from "vite-plus/test";
import { Hct, SchemeTonalSpot, argbFromHex, hexFromArgb } from "@material/material-color-utilities";
-import { MOBILE_THEME_IDS } from "../../lib/mobileTheme";
-import { getMobileThemeRuntimeVariables } from "../../lib/mobileThemeVariables";
-import { materialYouPaletteToMobileThemeVariables } from "../../lib/materialYouTheme.android";
-import type { MaterialYouPalette } from "../../lib/materialYouPalette";
+import { MOBILE_THEME_IDS } from "../../../lib/mobileTheme";
+import { getMobileThemeRuntimeVariables } from "../../../lib/mobileThemeVariables";
+import { materialYouPaletteToMobileThemeVariables } from "../../../lib/materialYouTheme.android";
+import type { MaterialYouPalette } from "../../../lib/materialYouPalette";
import { androidWorkspaceNavigationColors } from "./android-workspace-navigation-colors";
function luminance(hex: string) {
diff --git a/apps/mobile/src/features/workspace/android-workspace-navigation-colors.ts b/apps/mobile/src/features/layout/workspace/android-workspace-navigation-colors.ts
similarity index 98%
rename from apps/mobile/src/features/workspace/android-workspace-navigation-colors.ts
rename to apps/mobile/src/features/layout/workspace/android-workspace-navigation-colors.ts
index 48216bfec42..0e070f4bfae 100644
--- a/apps/mobile/src/features/workspace/android-workspace-navigation-colors.ts
+++ b/apps/mobile/src/features/layout/workspace/android-workspace-navigation-colors.ts
@@ -4,7 +4,7 @@ import {
themeColorWithAlpha,
themeColorWithContrast,
type MobileThemeVariables,
-} from "../../lib/mobileTheme";
+} from "../../../lib/mobileTheme";
// A dark page swallows the native shadow, so the fill alone has to lift the pill off the page
// and off the cards it floats over.
diff --git a/apps/mobile/src/features/workspace/android-workspace-tabs.ts b/apps/mobile/src/features/layout/workspace/android-workspace-tabs.ts
similarity index 91%
rename from apps/mobile/src/features/workspace/android-workspace-tabs.ts
rename to apps/mobile/src/features/layout/workspace/android-workspace-tabs.ts
index e4d50b47708..63fde490b6f 100644
--- a/apps/mobile/src/features/workspace/android-workspace-tabs.ts
+++ b/apps/mobile/src/features/layout/workspace/android-workspace-tabs.ts
@@ -1,10 +1,10 @@
import type { NavigationState } from "@react-navigation/native";
-import { androidWorkspaceNavigationState } from "../../lib/android-workspace-navigation";
+import { androidWorkspaceNavigationState } from "../../../lib/android-workspace-navigation";
import {
isSettingsRoute,
settingsNavigationState,
settingsOpenIn,
-} from "../settings/settings-navigation";
+} from "../../settings/settings-navigation";
import type { WorkspaceTab } from "./workspace-tabs-state";
import { rememberedSettingsPage, workspaceSelectionsIn } from "./workspace-tab-navigation";
diff --git a/apps/mobile/src/features/layout/workspace/brand-header-options.tsx b/apps/mobile/src/features/layout/workspace/brand-header-options.tsx
new file mode 100644
index 00000000000..d8330e4eb6e
--- /dev/null
+++ b/apps/mobile/src/features/layout/workspace/brand-header-options.tsx
@@ -0,0 +1,41 @@
+import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
+import { Platform } from "react-native";
+
+import { brandTitleOffset, CompactBrandTitle } from "../../../components/CompactBrandTitle";
+import { WorkspaceConnectionTitle } from "../../home/WorkspaceConnectionTitle";
+
+function renderCompactBrandTitle() {
+ return <CompactBrandTitle allowFontScaling={Platform.OS === "ios"} />;
+}
+
+export function getCompactBrandHeaderOptions(
+ fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"],
+): NativeStackNavigationOptions {
+ return {
+ headerTitle: renderCompactBrandTitle,
+ headerTitleStyle: fallbackTitleStyle,
+ title: "Threads",
+ unstable_headerLeftItems: undefined,
+ };
+}
+
+export function getConnectionAwareBrandHeaderOptions(opts: {
+ readonly headerWidth: number;
+ readonly trailingItemCount?: number;
+ readonly onOpenEnvironments: () => void;
+ readonly fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"];
+}): NativeStackNavigationOptions {
+ const maxWidth = Math.max(0, opts.headerWidth - 64 - 44 * (opts.trailingItemCount ?? 1));
+
+ return {
+ ...getCompactBrandHeaderOptions(opts.fallbackTitleStyle),
+ headerTitle: () => (
+ <WorkspaceConnectionTitle
+ brand={<CompactBrandTitle />}
+ maxWidth={maxWidth}
+ onPress={opts.onOpenEnvironments}
+ statusOffset={brandTitleOffset()}
+ />
+ ),
+ };
+}
diff --git a/apps/mobile/src/features/workspace/floating-workspace-tabs.test.ts b/apps/mobile/src/features/layout/workspace/floating-workspace-tabs.test.ts
similarity index 94%
rename from apps/mobile/src/features/workspace/floating-workspace-tabs.test.ts
rename to apps/mobile/src/features/layout/workspace/floating-workspace-tabs.test.ts
index 59dc131b1c8..bfb2feeb5be 100644
--- a/apps/mobile/src/features/workspace/floating-workspace-tabs.test.ts
+++ b/apps/mobile/src/features/layout/workspace/floating-workspace-tabs.test.ts
@@ -1,7 +1,7 @@
import { expect, it } from "vite-plus/test";
import { floatingTabsMetrics } from "./floating-workspace-tabs";
-import { resolveAndroidNavigationStyle } from "../../lib/androidNavigationStyle";
+import { resolveAndroidNavigationStyle } from "../../../lib/androidNavigationStyle";
it.each([
[undefined, "Samsung", false, "one-ui"],
diff --git a/apps/mobile/src/features/workspace/floating-workspace-tabs.ts b/apps/mobile/src/features/layout/workspace/floating-workspace-tabs.ts
similarity index 100%
rename from apps/mobile/src/features/workspace/floating-workspace-tabs.ts
rename to apps/mobile/src/features/layout/workspace/floating-workspace-tabs.ts
diff --git a/apps/mobile/src/features/workspace/navigation-tab-order.test.ts b/apps/mobile/src/features/layout/workspace/navigation-tab-order.test.ts
similarity index 100%
rename from apps/mobile/src/features/workspace/navigation-tab-order.test.ts
rename to apps/mobile/src/features/layout/workspace/navigation-tab-order.test.ts
diff --git a/apps/mobile/src/features/workspace/navigation-tab-order.ts b/apps/mobile/src/features/layout/workspace/navigation-tab-order.ts
similarity index 100%
rename from apps/mobile/src/features/workspace/navigation-tab-order.ts
rename to apps/mobile/src/features/layout/workspace/navigation-tab-order.ts
diff --git a/apps/mobile/src/features/workspace/navigation-tabs.ts b/apps/mobile/src/features/layout/workspace/navigation-tabs.ts
similarity index 87%
rename from apps/mobile/src/features/workspace/navigation-tabs.ts
rename to apps/mobile/src/features/layout/workspace/navigation-tabs.ts
index b7b9b73ae60..3472242dc4f 100644
--- a/apps/mobile/src/features/workspace/navigation-tabs.ts
+++ b/apps/mobile/src/features/layout/workspace/navigation-tabs.ts
@@ -8,9 +8,9 @@ import {
enabledNavigationTabs,
type NavigationTab,
} from "./navigation-tab-order";
-import type { AppSymbolName } from "../../components/ui/AppSymbol";
-import { mobilePreferencesAtom } from "../../state/preferences";
-import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
+import type { AppSymbolName } from "../../../components/ui/AppSymbol";
+import { mobilePreferencesAtom } from "../../../state/preferences";
+import { PullRequestGlyph } from "../../pull-requests/pullRequestGlyphs";
import { resolveWorkspaceTabOrder } from "./workspace-tabs-state";
export const WORKSPACE_TAB_LABELS = {
diff --git a/apps/mobile/src/features/workspace/useAndroidWorkspaceNavigation.ts b/apps/mobile/src/features/layout/workspace/useAndroidWorkspaceNavigation.ts
similarity index 97%
rename from apps/mobile/src/features/workspace/useAndroidWorkspaceNavigation.ts
rename to apps/mobile/src/features/layout/workspace/useAndroidWorkspaceNavigation.ts
index 92e157a45f0..dfc8e13d162 100644
--- a/apps/mobile/src/features/workspace/useAndroidWorkspaceNavigation.ts
+++ b/apps/mobile/src/features/layout/workspace/useAndroidWorkspaceNavigation.ts
@@ -4,7 +4,7 @@ import { BackHandler, Keyboard, Platform } from "react-native";
import {
resetAndroidWorkspace,
returnToAndroidWorkspaceList,
-} from "../../lib/android-workspace-navigation";
+} from "../../../lib/android-workspace-navigation";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import type { WorkspaceTab } from "./workspace-tabs-state";
diff --git a/apps/mobile/src/features/workspace/useSearchScrollRestoration.test.tsx b/apps/mobile/src/features/layout/workspace/useSearchScrollRestoration.test.tsx
similarity index 100%
rename from apps/mobile/src/features/workspace/useSearchScrollRestoration.test.tsx
rename to apps/mobile/src/features/layout/workspace/useSearchScrollRestoration.test.tsx
diff --git a/apps/mobile/src/features/workspace/useSearchScrollRestoration.ts b/apps/mobile/src/features/layout/workspace/useSearchScrollRestoration.ts
similarity index 100%
rename from apps/mobile/src/features/workspace/useSearchScrollRestoration.ts
rename to apps/mobile/src/features/layout/workspace/useSearchScrollRestoration.ts
diff --git a/apps/mobile/src/features/workspace/useSelectWorkspaceDetail.ts b/apps/mobile/src/features/layout/workspace/useSelectWorkspaceDetail.ts
similarity index 89%
rename from apps/mobile/src/features/workspace/useSelectWorkspaceDetail.ts
rename to apps/mobile/src/features/layout/workspace/useSelectWorkspaceDetail.ts
index 59d1ac1fd8d..e487d9af071 100644
--- a/apps/mobile/src/features/workspace/useSelectWorkspaceDetail.ts
+++ b/apps/mobile/src/features/layout/workspace/useSelectWorkspaceDetail.ts
@@ -1,7 +1,7 @@
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { useNavigation } from "@react-navigation/native";
-import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
-import { startOpeningEnvironmentThread } from "../../state/threads";
+import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
+import { startOpeningEnvironmentThread } from "../../../state/threads";
import {
selectWorkspaceDetail,
type WorkspaceDetail,
diff --git a/apps/mobile/src/features/workspace/useSelectWorkspaceTab.ts b/apps/mobile/src/features/layout/workspace/useSelectWorkspaceTab.ts
similarity index 87%
rename from apps/mobile/src/features/workspace/useSelectWorkspaceTab.ts
rename to apps/mobile/src/features/layout/workspace/useSelectWorkspaceTab.ts
index 8882a9f9d0b..25d227b2736 100644
--- a/apps/mobile/src/features/workspace/useSelectWorkspaceTab.ts
+++ b/apps/mobile/src/features/layout/workspace/useSelectWorkspaceTab.ts
@@ -1,6 +1,6 @@
import { Keyboard } from "react-native";
-import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
+import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import type { WorkspaceTab } from "./workspace-tabs-state";
diff --git a/apps/mobile/src/features/workspace/useSystemWorkspaceTabBar.ts b/apps/mobile/src/features/layout/workspace/useSystemWorkspaceTabBar.ts
similarity index 87%
rename from apps/mobile/src/features/workspace/useSystemWorkspaceTabBar.ts
rename to apps/mobile/src/features/layout/workspace/useSystemWorkspaceTabBar.ts
index f5a3f0af703..3cf78b71048 100644
--- a/apps/mobile/src/features/workspace/useSystemWorkspaceTabBar.ts
+++ b/apps/mobile/src/features/layout/workspace/useSystemWorkspaceTabBar.ts
@@ -1,8 +1,8 @@
-import { isDuoDevice } from "../../lib/device-type";
+import { isDuoDevice } from "../../../lib/device-type";
import { Platform } from "react-native";
-import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
-import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
-import { useDeviceType, useNativeLayoutMetrics } from "../../native/native-layout-metrics";
+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
+import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context";
+import { useDeviceType, useNativeLayoutMetrics } from "../../../native/native-layout-metrics";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import { workspaceUsesColumns } from "./workspace-tabs-state";
diff --git a/apps/mobile/src/features/workspace/workspace-detail-selection.test.ts b/apps/mobile/src/features/layout/workspace/workspace-detail-selection.test.ts
similarity index 100%
rename from apps/mobile/src/features/workspace/workspace-detail-selection.test.ts
rename to apps/mobile/src/features/layout/workspace/workspace-detail-selection.test.ts
diff --git a/apps/mobile/src/features/workspace/workspace-detail-selection.ts b/apps/mobile/src/features/layout/workspace/workspace-detail-selection.ts
similarity index 98%
rename from apps/mobile/src/features/workspace/workspace-detail-selection.ts
rename to apps/mobile/src/features/layout/workspace/workspace-detail-selection.ts
index fed18d6089f..ad7f37f1403 100644
--- a/apps/mobile/src/features/workspace/workspace-detail-selection.ts
+++ b/apps/mobile/src/features/layout/workspace/workspace-detail-selection.ts
@@ -6,7 +6,7 @@ import type {
Router,
StackNavigationState,
} from "@react-navigation/native";
-import { workspaceRoutesOf } from "../layout/workspace-overlay-routes";
+import { workspaceRoutesOf } from "../workspace-overlay-routes";
type RootParams = ReactNavigation.RootParamList;
diff --git a/apps/mobile/src/features/layout/workspace/workspace-list-header-items.ts b/apps/mobile/src/features/layout/workspace/workspace-list-header-items.ts
new file mode 100644
index 00000000000..4ee54230835
--- /dev/null
+++ b/apps/mobile/src/features/layout/workspace/workspace-list-header-items.ts
@@ -0,0 +1,69 @@
+import type {
+ NativeStackHeaderItem,
+ NativeStackHeaderItemMenu,
+} from "@react-navigation/native-stack";
+
+import type { AppBarMenuItem } from "../../../components/ui/AppBar.types";
+import { withNativeGlassHeaderItem } from "../native-glass-header-items";
+
+type NativeHeaderMenuItems = NativeStackHeaderItemMenu["menu"]["items"];
+type NativeHeaderIcon = NonNullable<Extract<NativeStackHeaderItem, { type: "button" }>["icon"]>;
+
+function sfSymbolIcon(name: string): NativeHeaderIcon {
+ return { type: "sfSymbol", name: name as never };
+}
+
+function toNativeHeaderMenuItems(items: ReadonlyArray<AppBarMenuItem>): NativeHeaderMenuItems {
+ return items.map((item) =>
+ "items" in item
+ ? {
+ type: "submenu" as const,
+ label: item.title ?? "",
+ items: toNativeHeaderMenuItems(item.items),
+ }
+ : {
+ type: "action" as const,
+ label: item.title,
+ description: item.subtitle,
+ onPress: item.onPress,
+ state: item.selected ? ("on" as const) : undefined,
+ },
+ );
+}
+
+/** The sidebar column's bar items, as native header items so the title can size around them. */
+export function createWorkspaceListHeaderItems(input: {
+ readonly filter: {
+ readonly accessibilityLabel: string;
+ readonly icon: string;
+ readonly title: string;
+ readonly items: ReadonlyArray<AppBarMenuItem>;
+ };
+ readonly onOpenSettings?: () => void;
+}): NativeStackHeaderItem[] {
+ return [
+ withNativeGlassHeaderItem({
+ type: "menu",
+ axisBehavior: "horizontalOnly",
+ label: "",
+ accessibilityLabel: input.filter.accessibilityLabel,
+ icon: sfSymbolIcon(input.filter.icon),
+ menu: {
+ title: input.filter.title,
+ items: toNativeHeaderMenuItems(input.filter.items),
+ },
+ }),
+ ...(input.onOpenSettings
+ ? [
+ withNativeGlassHeaderItem({
+ type: "button",
+ axisBehavior: "horizontalOnly",
+ label: "Settings",
+ accessibilityLabel: "Open settings",
+ icon: sfSymbolIcon("gearshape"),
+ onPress: input.onOpenSettings,
+ }),
+ ]
+ : []),
+ ];
+}
diff --git a/apps/mobile/src/features/layout/workspace/workspace-list-insets.ts b/apps/mobile/src/features/layout/workspace/workspace-list-insets.ts
new file mode 100644
index 00000000000..ae7048bcdba
--- /dev/null
+++ b/apps/mobile/src/features/layout/workspace/workspace-list-insets.ts
@@ -0,0 +1,15 @@
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+
+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
+
+/** A workspace list scrolls under its bar where the bar is glass; under a solid bar it starts below. */
+export const WORKSPACE_LIST_SCROLL_INSETS = {
+ automaticallyAdjustsScrollIndicatorInsets: NATIVE_LIQUID_GLASS_SUPPORTED,
+ contentInsetAdjustmentBehavior: NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never",
+} as const;
+
+/** How far an empty workspace list keeps its message below a glass bar and its search. */
+export function useWorkspaceListEmptyTopInset(): number {
+ const insets = useSafeAreaInsets();
+ return NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0;
+}
diff --git a/apps/mobile/src/features/workspace/workspace-selection-store.ts b/apps/mobile/src/features/layout/workspace/workspace-selection-store.ts
similarity index 90%
rename from apps/mobile/src/features/workspace/workspace-selection-store.ts
rename to apps/mobile/src/features/layout/workspace/workspace-selection-store.ts
index 62adcd07005..19d2653dded 100644
--- a/apps/mobile/src/features/workspace/workspace-selection-store.ts
+++ b/apps/mobile/src/features/layout/workspace/workspace-selection-store.ts
@@ -3,27 +3,27 @@ import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
import * as Linking from "expo-linking";
import { AppState, Dimensions, Platform } from "react-native";
-import { environmentCatalog } from "../../connection/catalog";
-import { deriveLayout } from "../../lib/layout";
+import { environmentCatalog } from "../../../connection/catalog";
+import { deriveLayout } from "../../../lib/layout";
import {
NATIVE_METRICS_TIMEOUT_MS,
nativeWorkspaceColumnsSupportedFor,
-} from "../../native/NativeWorkspaceColumns";
+} from "../../../native/NativeWorkspaceColumns";
import {
currentNativeLayoutMetrics,
firstNativeLayoutMetrics,
-} from "../../native/native-layout-metrics";
-import { loadPreferences, savePreferencesPatch } from "../../persistence/imperative";
-import { rootStackState, type RootStackNavigation } from "../../lib/root-stack-reset";
-import { workspaceRoutesOf } from "../layout/workspace-overlay-routes";
-import type { WorkspaceSelections } from "../../persistence/mobile-preferences";
-import { appAtomRegistry } from "../../state/atom-registry";
-import { environmentPresentations } from "../../state/presentation";
+} from "../../../native/native-layout-metrics";
+import { loadPreferences, savePreferencesPatch } from "../../../persistence/imperative";
+import { rootStackState, type RootStackNavigation } from "../../../lib/root-stack-reset";
+import { workspaceRoutesOf } from "../workspace-overlay-routes";
+import type { WorkspaceSelections } from "../../../persistence/mobile-preferences";
+import { appAtomRegistry } from "../../../state/atom-registry";
+import { environmentPresentations } from "../../../state/presentation";
import {
environmentThreadShells,
startOpeningEnvironmentThread,
threadEnvironment,
-} from "../../state/threads";
+} from "../../../state/threads";
import {
rememberedSettingsPage,
workspaceSelectionsIn,
diff --git a/apps/mobile/src/features/workspace/workspace-tab-navigation.test.ts b/apps/mobile/src/features/layout/workspace/workspace-tab-navigation.test.ts
similarity index 98%
rename from apps/mobile/src/features/workspace/workspace-tab-navigation.test.ts
rename to apps/mobile/src/features/layout/workspace/workspace-tab-navigation.test.ts
index 1d30f2c02e6..167cebafb86 100644
--- a/apps/mobile/src/features/workspace/workspace-tab-navigation.test.ts
+++ b/apps/mobile/src/features/layout/workspace/workspace-tab-navigation.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vite-plus/test";
-import { restoreSettingsLinkState } from "../settings/settings-navigation";
+import { restoreSettingsLinkState } from "../../settings/settings-navigation";
import {
workspaceSelectionsIn,
workspaceTabColumns,
diff --git a/apps/mobile/src/features/workspace/workspace-tab-navigation.ts b/apps/mobile/src/features/layout/workspace/workspace-tab-navigation.ts
similarity index 97%
rename from apps/mobile/src/features/workspace/workspace-tab-navigation.ts
rename to apps/mobile/src/features/layout/workspace/workspace-tab-navigation.ts
index bee1efc005f..900cfa90056 100644
--- a/apps/mobile/src/features/workspace/workspace-tab-navigation.ts
+++ b/apps/mobile/src/features/layout/workspace/workspace-tab-navigation.ts
@@ -1,9 +1,9 @@
-import type { WorkspaceSelections } from "../../persistence/mobile-preferences";
+import type { WorkspaceSelections } from "../../../persistence/mobile-preferences";
import {
SETTINGS_PAGE_TARGETS,
type SettingsPageTarget,
-} from "../settings/components/settings-page-targets";
-import { settingsNavigationState } from "../settings/settings-navigation";
+} from "../../settings/components/settings-page-targets";
+import { settingsNavigationState } from "../../settings/settings-navigation";
import type { WorkspaceTab } from "./workspace-tabs-state";
type RouteLike = {
diff --git a/apps/mobile/src/features/workspace/workspace-tabs-state.test.ts b/apps/mobile/src/features/layout/workspace/workspace-tabs-state.test.ts
similarity index 92%
rename from apps/mobile/src/features/workspace/workspace-tabs-state.test.ts
rename to apps/mobile/src/features/layout/workspace/workspace-tabs-state.test.ts
index 06d4a49e05f..f1c839630eb 100644
--- a/apps/mobile/src/features/workspace/workspace-tabs-state.test.ts
+++ b/apps/mobile/src/features/layout/workspace/workspace-tabs-state.test.ts
@@ -181,7 +181,7 @@ describe("workspace root navigation", () => {
const mocks = vi.hoisted(() => ({ split: false, floating: false }));
-vi.mock("../settings/appearance/AppearancePreferencesProvider", () => ({
+vi.mock("../../settings/appearance/AppearancePreferencesProvider", () => ({
useAndroidFloatingTabs: () => mocks.floating,
}));
vi.mock("react-native", () => ({
@@ -192,7 +192,7 @@ vi.mock("react-native-safe-area-context", () => ({
SafeAreaInsetsContext: createContext({ top: 0, right: 0, bottom: 24, left: 0 }),
useSafeAreaInsets: () => ({ top: 0, right: 0, bottom: 24, left: 0 }),
}));
-vi.mock("../layout/AdaptiveWorkspaceLayout", () => ({
+vi.mock("../AdaptiveWorkspaceLayout", () => ({
useAdaptiveWorkspaceLayout: () => ({
layout: { usesSplitView: mocks.split },
startNewTask: () => undefined,
@@ -211,30 +211,30 @@ vi.mock("./WorkspaceExtraTab", () => ({
return createElement("button", { onClick: () => setTab("Usage") }, tab);
},
}));
-vi.mock("../../native/StackHeader", () => ({ NativeStackScreenOptions: () => null }));
-vi.mock("../../components/ui/AppBar", () => ({ AppBar: () => null }));
-vi.mock("../layout/WorkspaceEmptyDetail", () => ({ WorkspaceEmptyDetail: () => null }));
-vi.mock("../../components/ui/ScreenContent", () => ({
+vi.mock("../../../native/StackHeader", () => ({ NativeStackScreenOptions: () => null }));
+vi.mock("../../../components/ui/AppBar", () => ({ AppBar: () => null }));
+vi.mock("../WorkspaceEmptyDetail", () => ({ WorkspaceEmptyDetail: () => null }));
+vi.mock("../../../components/ui/ScreenContent", () => ({
ScreenContent: ({ children }: { children: ReactNode }) => createElement("div", null, children),
}));
-vi.mock("../../components/ui/useAndroidControlSizing", () => ({
+vi.mock("../../../components/ui/useAndroidControlSizing", () => ({
useAndroidControlSizing: () => ({ fabClearance: 64, scale: 1, fabSize: 56 }),
}));
-vi.mock("../home/HomeRouteScreen", () => ({ HomeRouteScreen: () => null }));
-vi.mock("../pull-requests/PullRequestFilterMenuContext", () => ({
+vi.mock("../../home/HomeRouteScreen", () => ({ HomeRouteScreen: () => null }));
+vi.mock("../../pull-requests/PullRequestFilterMenuContext", () => ({
PullRequestFilterMenuProvider: ({ children }: { children: ReactNode }) =>
createElement("div", null, children),
}));
-vi.mock("../pull-requests/PullRequestsScreen", () => ({ PullRequestsScreen: () => null }));
-vi.mock("../pull-requests/PullRequestToolbar.android", () => ({ PullRequestToolbar: () => null }));
+vi.mock("../../pull-requests/PullRequestsScreen", () => ({ PullRequestsScreen: () => null }));
+vi.mock("./PullRequestToolbar.android", () => ({ PullRequestToolbar: () => null }));
vi.mock("./AndroidWorkspaceNavigation", () => ({
AndroidWorkspaceNavigation: () => null,
FloatingWorkspaceTabs: () => null,
}));
vi.mock("./WorkspaceNoTabs", () => ({ WorkspaceNoTabs: () => null }));
-vi.mock("../../components/ui/Pane", () => ({ usePaneRole: () => "screen" }));
+vi.mock("../../../components/ui/Pane", () => ({ usePaneRole: () => "screen" }));
vi.mock("./AndroidWorkspaceSidebar.android", () => ({ AndroidWorkspaceSidebar: () => null }));
-vi.mock("../../components/ui/WorkspaceAppBar.android", () => ({
+vi.mock("../../../components/ui/WorkspaceAppBar.android", () => ({
WorkspaceAppBarScope: ({ children }: { children: ReactNode }) => children,
}));
diff --git a/apps/mobile/src/features/workspace/workspace-tabs-state.ts b/apps/mobile/src/features/layout/workspace/workspace-tabs-state.ts
similarity index 100%
rename from apps/mobile/src/features/workspace/workspace-tabs-state.ts
rename to apps/mobile/src/features/layout/workspace/workspace-tabs-state.ts
diff --git a/apps/mobile/src/features/projects/AddProjectScreen.test.ts b/apps/mobile/src/features/projects/AddProjectScreen.test.ts
index b251310ef12..ab331d0149e 100644
--- a/apps/mobile/src/features/projects/AddProjectScreen.test.ts
+++ b/apps/mobile/src/features/projects/AddProjectScreen.test.ts
@@ -4,7 +4,7 @@ import * as NodeOS from "node:os";
import * as NodePath from "node:path";
import * as NodeModule from "node:module";
import type { EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
-import { workspaceDetailRouter } from "../workspace/workspace-detail-selection";
+import { workspaceDetailRouter } from "../layout/workspace/workspace-detail-selection";
import type { NavigationState } from "@react-navigation/native";
import { AuthOrchestrationOperateScope, AuthSourceControlWriteScope } from "@t3tools/contracts";
import * as Cause from "effect/Cause";
@@ -46,8 +46,8 @@ function loadRouters() {
};
}
-vi.mock("../workspace/useSelectWorkspaceDetail", async () => {
- const { selectWorkspaceDetail } = await import("../workspace/workspace-detail-selection");
+vi.mock("../layout/workspace/useSelectWorkspaceDetail", async () => {
+ const { selectWorkspaceDetail } = await import("../layout/workspace/workspace-detail-selection");
return {
useSelectWorkspaceDetail: () => (detail: Parameters<typeof selectWorkspaceDetail>[0]) =>
state.dispatch(selectWorkspaceDetail(detail)),
diff --git a/apps/mobile/src/features/projects/AddProjectScreen.tsx b/apps/mobile/src/features/projects/AddProjectScreen.tsx
index ddd6ec120d3..93680aa3815 100644
--- a/apps/mobile/src/features/projects/AddProjectScreen.tsx
+++ b/apps/mobile/src/features/projects/AddProjectScreen.tsx
@@ -1,5 +1,5 @@
import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
import * as Dialog from "../../components/ui/Dialog";
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
import { NavigationRow } from "../../components/ui/NavigationRow";
diff --git a/apps/mobile/src/features/pull-requests/PullRequestListFilters.tsx b/apps/mobile/src/features/pull-requests/PullRequestListFilters.tsx
index 38ac98f3b2a..cbc2c10ce3d 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestListFilters.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestListFilters.tsx
@@ -4,7 +4,7 @@ import type { ScopedProjectRef, SidebarProjectGroupingMode } from "@t3tools/cont
import { Atom } from "effect/reactivity";
import { Platform, ScrollView } from "react-native";
import type { MenuProps } from "../../components/ui/Menu.types";
-import { ListFilterMenu } from "../workspace/ListFilterMenu";
+import { ListFilterMenu } from "../layout/workspace/ListFilterMenu";
import { environmentProjects } from "../../state/projects";
import { environmentThreadShells } from "../../state/threads";
import { useMobileProjectGroupingSettings } from "../../state/project-grouping";
diff --git a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
index 12c755a0b5a..9ee271e4ab8 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
@@ -62,7 +62,7 @@ import { AppBar } from "../../components/ui/AppBar";
import { useContentTopInset } from "../../components/ui/useBarInset";
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
-import { useAndroidWorkspaceBack } from "../workspace/useAndroidWorkspaceNavigation";
+import { useAndroidWorkspaceBack } from "../layout/workspace/useAndroidWorkspaceNavigation";
import { EmptyState } from "../../components/ui/EmptyState";
import { SegmentedControl } from "../../components/ui/SegmentedControl";
import { SymbolView } from "../../components/ui/AppSymbol";
diff --git a/apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
index 3e84e665257..8221d508013 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
@@ -42,9 +42,9 @@ import {
pullRequestProjectChoices,
} from "./pullRequestList";
import { useDebouncedValue } from "../../state/queries";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
-import { useSearchScrollRestoration } from "../workspace/useSearchScrollRestoration";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
+import { useSearchScrollRestoration } from "../layout/workspace/useSearchScrollRestoration";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
function PullRequestListError(props: { readonly message: string }) {
const [expanded, setExpanded] = useState(false);
diff --git a/apps/mobile/src/features/pull-requests/usePullRequestListActions.ts b/apps/mobile/src/features/pull-requests/usePullRequestListActions.ts
index e8b52cec58c..6f13ad3465e 100644
--- a/apps/mobile/src/features/pull-requests/usePullRequestListActions.ts
+++ b/apps/mobile/src/features/pull-requests/usePullRequestListActions.ts
@@ -21,7 +21,7 @@ import { sourceControlClients } from "@t3tools/client-runtime/source-control-cli
import { scopedPullRequestListKey, type EnvironmentPullRequestListEntry } from "./pullRequestList";
import { copyPullRequestLink, sharePullRequestLink } from "./pullRequestLink";
import { pullRequestTarget } from "./usePullRequestDiff";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
import { useOpenWorkspaceDetail } from "../layout/useOpenWorkspaceDetail";
export function usePullRequestListActions(
diff --git a/apps/mobile/src/features/review/ReviewSheet.tsx b/apps/mobile/src/features/review/ReviewSheet.tsx
index 00ea54db3f5..ca1ca034c28 100644
--- a/apps/mobile/src/features/review/ReviewSheet.tsx
+++ b/apps/mobile/src/features/review/ReviewSheet.tsx
@@ -55,7 +55,7 @@ import { resolveReviewAvailability } from "./reviewAvailability";
import { resolveSelectedReviewFileId } from "./reviewPaneSelection";
import { buildReviewSectionMenu } from "./review-section-menu";
import { reportShowcaseSceneRendered } from "../showcase/showcaseRenderSignal";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
function ReviewHeader(
props: Parameters<typeof useReviewHeaderPresentation>[0] & {
diff --git a/apps/mobile/src/features/settings/SettingsNavigationRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsNavigationRouteScreen.tsx
index a4196c07d97..6fec6a2103b 100644
--- a/apps/mobile/src/features/settings/SettingsNavigationRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsNavigationRouteScreen.tsx
@@ -7,7 +7,7 @@ import {
moveNavigationTab,
navigationCustomizationAvailable,
toggleNavigationTabVisibility,
-} from "../workspace/navigation-tab-order";
+} from "../layout/workspace/navigation-tab-order";
import { AppText as Text } from "../../components/ui/AppText";
import { IconButton } from "../../components/ui/IconButton";
import { Button } from "../../components/ui/Button";
@@ -20,10 +20,10 @@ import {
useNavigationTabOrder,
useHiddenNavigationTabs,
useEnabledNavigationTabs,
-} from "../workspace/navigation-tabs";
+} from "../layout/workspace/navigation-tabs";
import { SettingsScreen } from "./components/SettingsScreen";
import { SettingsSection } from "./components/SettingsSection";
-import { resolveWorkspaceTabOrder } from "../workspace/workspace-tabs-state";
+import { resolveWorkspaceTabOrder } from "../layout/workspace/workspace-tabs-state";
export function SettingsNavigationRouteScreen() {
const insets = useSafeAreaInsets();
diff --git a/apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx
index 8492f9b9e03..89408243ef8 100644
--- a/apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx
@@ -41,8 +41,8 @@ import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
import { useSettingsEnvironmentMenu } from "./components/SettingsEnvironmentFilterHeader";
import { useSettingsEnvironmentFilter, type SettingsTarget } from "./settings-environment-filter";
import { leaveSettingsPage } from "./settings-navigation";
-import { workspaceHasColumns } from "../workspace/workspace-selection-store";
-import { DEFAULT_SETTINGS_PAGE } from "../workspace/workspace-tab-navigation";
+import { workspaceHasColumns } from "../layout/workspace/workspace-selection-store";
+import { DEFAULT_SETTINGS_PAGE } from "../layout/workspace/workspace-tab-navigation";
import { readUnloadedThreadCount } from "../../state/olderSettledShelf";
export function SettingsProjectOverviewRouteScreen() {
diff --git a/apps/mobile/src/features/settings/SettingsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
index f43219865f1..05048e71074 100644
--- a/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
@@ -1,17 +1,17 @@
import {
navigationCustomizationAvailable,
overflowNavigationTabs,
-} from "../workspace/navigation-tab-order";
+} from "../layout/workspace/navigation-tab-order";
import {
NAVIGATION_TAB_ICONS,
WORKSPACE_TAB_LABELS,
useNavigationTabOrder,
useHiddenNavigationTabs,
-} from "../workspace/navigation-tabs";
-import { currentWorkspaceSelections } from "../workspace/workspace-selection-store";
-import { rememberedSettingsPage } from "../workspace/workspace-tab-navigation";
-import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
+} from "../layout/workspace/navigation-tabs";
+import { currentWorkspaceSelections } from "../layout/workspace/workspace-selection-store";
+import { rememberedSettingsPage } from "../layout/workspace/workspace-tab-navigation";
+import { useSelectWorkspaceTab } from "../layout/workspace/useSelectWorkspaceTab";
+import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
import { EmptyState } from "../../components/ui/EmptyState";
import { useAuth, useUser } from "@clerk/expo";
diff --git a/apps/mobile/src/features/settings/SettingsWorkspaceLayout.android.tsx b/apps/mobile/src/features/settings/SettingsWorkspaceLayout.android.tsx
index 05bef326c3e..b05d8b24950 100644
--- a/apps/mobile/src/features/settings/SettingsWorkspaceLayout.android.tsx
+++ b/apps/mobile/src/features/settings/SettingsWorkspaceLayout.android.tsx
@@ -5,7 +5,7 @@ import { View } from "react-native";
import { AppText } from "../../components/ui/AppText";
import { PaneContext } from "../../components/ui/Pane";
import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
-import { useAndroidWorkspaceRoot } from "../workspace/AndroidWorkspaceTabsProvider";
+import { useAndroidWorkspaceRoot } from "../layout/workspace/AndroidWorkspaceTabsProvider";
import { SettingsListScreen } from "./SettingsRouteScreen";
import { SettingsScreen } from "./components/SettingsScreen";
diff --git a/apps/mobile/src/features/settings/components/SettingsScreen.tsx b/apps/mobile/src/features/settings/components/SettingsScreen.tsx
index 8cd478c7040..240ac009bdc 100644
--- a/apps/mobile/src/features/settings/components/SettingsScreen.tsx
+++ b/apps/mobile/src/features/settings/components/SettingsScreen.tsx
@@ -5,9 +5,9 @@ import { View } from "react-native";
import type { AppBarProps } from "../../../components/ui/AppBar.types";
import { AppBar } from "../../../components/ui/AppBar";
import { ScreenContent as SettingsScreenContent } from "../../../components/ui/ScreenContent";
-import { useWorkspaceTabs } from "../../workspace/WorkspaceTabsContext";
+import { useWorkspaceTabs } from "../../layout/workspace/WorkspaceTabsContext";
import { useDeviceType } from "../../../native/native-layout-metrics";
-import { useCompactWorkspaceTabs } from "../../workspace/useSystemWorkspaceTabBar";
+import { useCompactWorkspaceTabs } from "../../layout/workspace/useSystemWorkspaceTabBar";
import { useSettingsPageBack } from "../useSettingsPageBack";
import {
ScreenScrollViewBottomInset,
diff --git a/apps/mobile/src/features/sharing/IncomingShareProvider.tsx b/apps/mobile/src/features/sharing/IncomingShareProvider.tsx
index b9c48bd68a1..537af1a725a 100644
--- a/apps/mobile/src/features/sharing/IncomingShareProvider.tsx
+++ b/apps/mobile/src/features/sharing/IncomingShareProvider.tsx
@@ -26,7 +26,7 @@ import { persistComposerAttachmentFile } from "../../lib/composerImages";
import { subscribeAppActive } from "../../lib/appState";
import { coalescedRun } from "../../lib/coalescedRun";
import { rootNavigationRef } from "../../lib/rootNavigation";
-import { selectWorkspaceDetail } from "../workspace/workspace-detail-selection";
+import { selectWorkspaceDetail } from "../layout/workspace/workspace-detail-selection";
import { isDraftThreadRoute } from "../threads/thread-route-state";
import { makeIncomingShareImports } from "../threads/incomingShareImport";
import { liveNewTaskFlowKeys } from "../threads/new-task-flow-state";
diff --git a/apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx b/apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx
index f59f53fc591..884b76ea889 100644
--- a/apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx
+++ b/apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx
@@ -55,7 +55,7 @@ import {
import { retryShowcaseOperation } from "./showcaseRetry";
import { stageShowcaseAgentActivity } from "./stageShowcaseAgentActivity";
import { settingsNavigationState } from "../settings/settings-navigation";
-import { selectWorkspaceDetail } from "../workspace/workspace-detail-selection";
+import { selectWorkspaceDetail } from "../layout/workspace/workspace-detail-selection";
const SHOWCASE_ENABLED = process.env.EXPO_PUBLIC_SHOWCASE === "1";
// Native launch requests (pairing links, scene switches) have no change event.
diff --git a/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.test.tsx b/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.test.tsx
index 636e6658c3d..5173d03f930 100644
--- a/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.test.tsx
+++ b/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.test.tsx
@@ -55,7 +55,7 @@ vi.mock("../../components/ui/AppText", () => ({
}));
vi.mock("../../components/ui/Dialog", () => ({ alert: vi.fn() }));
vi.mock("../../components/ui/AppBar", () => ({ AppBar: () => null }));
-vi.mock("../workspace/useAndroidWorkspaceNavigation", () => ({
+vi.mock("../layout/workspace/useAndroidWorkspaceNavigation", () => ({
useWorkspaceBackNavigation: () => () => undefined,
}));
vi.mock("./ThreadScreenHost", () => ({
diff --git a/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
index 02165d01fdc..4b77761b600 100644
--- a/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
@@ -31,7 +31,7 @@ import {
} from "./new-task-branch-checkout";
import { liveNewTaskFlowKeys, newTaskFlowKey } from "./new-task-flow-state";
import { AppBar } from "../../components/ui/AppBar";
-import { useWorkspaceBackNavigation } from "../workspace/useAndroidWorkspaceNavigation";
+import { useWorkspaceBackNavigation } from "../layout/workspace/useAndroidWorkspaceNavigation";
import { ThreadScreenFallback } from "./ThreadScreenHost";
import { NewTaskDraftScreen } from "./NewTaskDraftScreen";
diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
index b5274b73fae..8f02fe677cd 100644
--- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
@@ -2,7 +2,7 @@ import { DraftEnvironmentControl } from "./DraftEnvironmentControl";
import { NativeScrollEdgeEffectsContext } from "../../native/NativeScrollViewMarker";
import { DraftThreadHeader } from "./DraftThreadHeader";
import { useComposerAttachmentActions } from "../../state/use-composer-attachment-actions";
-import { useWorkspaceBackNavigation } from "../workspace/useAndroidWorkspaceNavigation";
+import { useWorkspaceBackNavigation } from "../layout/workspace/useAndroidWorkspaceNavigation";
import { submittedThreadParams } from "./thread-route-state";
import { ThreadScreenBinding, ThreadScreenFallback } from "./ThreadScreenHost";
import { draftThreadShell } from "./draft-thread-shell";
diff --git a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
index de9ae4ba626..8cbc7bd7d90 100644
--- a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
@@ -40,7 +40,7 @@ import {
getProjectScopeSelectionTarget,
resolveNewTaskScratchOption,
} from "./new-task-project-selection";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
type NewTaskRouteParams = {
readonly incomingShareId?: string | string[];
diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx
index 08ae2486e46..fe17a29dd47 100644
--- a/apps/mobile/src/features/threads/ThreadComposer.tsx
+++ b/apps/mobile/src/features/threads/ThreadComposer.tsx
@@ -1,4 +1,4 @@
-import { useSidebarWorkspaceTabs } from "../workspace/useSystemWorkspaceTabBar";
+import { useSidebarWorkspaceTabs } from "../layout/workspace/useSystemWorkspaceTabBar";
import { Button } from "../../components/ui/Button";
import * as Dialog from "../../components/ui/Dialog";
import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
index d222ba8e9ea..4841c5f76dc 100644
--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
@@ -1,7 +1,7 @@
import { ChildThreadApprovals } from "./ChildThreadApprovals";
import { useOpenThreadInspector } from "./thread-inspector-navigation";
-import { useSidebarWorkspaceTabs } from "../workspace/useSystemWorkspaceTabBar";
-import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
+import { useSidebarWorkspaceTabs } from "../layout/workspace/useSystemWorkspaceTabBar";
+import { useWorkspaceTabs } from "../layout/workspace/WorkspaceTabsContext";
import {
isAtomCommandInterrupted,
settlePromise,
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx
index b561231b805..a44a9c8a1f8 100644
--- a/apps/mobile/src/features/threads/ThreadFeed.tsx
+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx
@@ -285,7 +285,7 @@ import {
ThreadMarkdownImageView,
} from "./ThreadMarkdownImage";
import { openSettings } from "../settings/settings-navigation";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
const WIDE_MARKDOWN_BLOCK_OPTIONS = {
// iOS blockquotes and selectable text measure separately; definite bubble width matches UIKit's drawing width.
diff --git a/apps/mobile/src/features/threads/ThreadHeader.tsx b/apps/mobile/src/features/threads/ThreadHeader.tsx
index d4b13246c4b..955dd5d800b 100644
--- a/apps/mobile/src/features/threads/ThreadHeader.tsx
+++ b/apps/mobile/src/features/threads/ThreadHeader.tsx
@@ -3,7 +3,7 @@ import { ScreenHeaderButton } from "../../components/ui/ScreenHeaderButton";
import type { AppBarAction, AppBarMenu } from "../../components/ui/AppBar.types";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
import type { ThreadInspectorMode } from "./thread-inspector-navigation";
-import { useWorkspaceBackNavigation } from "../workspace/useAndroidWorkspaceNavigation";
+import { useWorkspaceBackNavigation } from "../layout/workspace/useAndroidWorkspaceNavigation";
import {
threadTerminalMenu,
useThreadGitMenuDefinition,
diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
index 5fc720e607a..dce389c8366 100644
--- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
@@ -16,19 +16,15 @@ import type {
import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
import { AnimatedLegendList } from "@legendapp/list/reanimated";
import { THREAD_SIDEBAR_ROW_LAYOUT } from "./threadListAnimations";
-import type { MenuAction } from "@react-native-menu/menu";
import { useAtomValue } from "@effect/atom-react";
import { useMemo, useRef, useState } from "react";
import { Platform, StyleSheet, View } from "react-native";
import { GestureDetector, useNativeGesture } from "react-native-gesture-handler";
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
-import { FLOATING_TABS } from "../workspace/floating-workspace-tabs";
+import { FLOATING_TABS } from "../layout/workspace/floating-workspace-tabs";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import type { SearchBarCommands } from "react-native-screens";
import { AppText as Text } from "../../components/ui/AppText";
-import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
import { useProjects, useNavigationThreadShells } from "../../state/entities";
import { useThreadSearch } from "../../state/queries";
@@ -40,24 +36,20 @@ import { usePendingNewTasks, type PendingNewTask } from "../../state/use-pending
import { useQueuedThreadKeys } from "../../state/use-thread-outbox";
import { useWorkspaceState } from "../../state/workspace";
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
-import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
import { useThreadListV2 } from "./useThreadListV2";
import { useThreadJumpShortcuts } from "../keyboard/threadKeyboardShortcuts";
import { requestThreadMessageJump } from "./threadMessageJump";
import { useThreadListSearchMatches } from "./useThreadListSearchMatches";
import { useHomeListOptions } from "../home/home-list-options";
-import { buildHomeListFilterMenu } from "../home/home-list-filter-menu";
+import { buildHomeListFilterMenuItems } from "../home/home-list-filter-menu";
import { buildHomeProjectScopes } from "../home/homeThreadList";
import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "../home/thread-swipe-actions";
import { usePendingTaskListActions } from "../home/usePendingTaskListActions";
import { useThreadListActions } from "../home/useThreadListActions";
-import { getConnectionAwareBrandHeaderOptions } from "../home/WorkspaceConnectionTitle";
-import { ThreadListToolbar } from "../home/ThreadListToolbar";
import { useFabScroll } from "../home/FabScrollContext";
-import { createSidebarHeaderItems } from "./sidebar-native-header-items";
-import { getCompactBrandHeaderOptions } from "../../components/CompactBrandTitle";
-import { StandaloneStack } from "../layout/nested-stacks";
-import { pageRoute } from "../layout/route-options";
+import { WorkspaceListHeader } from "../layout/workspace/WorkspaceListHeader";
+import { WORKSPACE_LIST_SCROLL_INSETS } from "../layout/workspace/workspace-list-insets";
+import { WorkspaceSidebarColumn } from "../layout/workspace/WorkspaceSidebarColumn";
import {
ThreadListV2PendingRow,
ThreadListV2Row,
@@ -76,7 +68,7 @@ import {
THREAD_LIST_V2_SETTLED_PAGE_COUNT,
type ThreadListV2ListItem,
} from "./threadListV2";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
import { NativeScrollView } from "../../native/NativeScrollViewMarker";
type SidebarListItem =
@@ -107,41 +99,17 @@ interface ThreadNavigationSidebarProps {
readonly searchQuery: string;
}
-// The iOS sidebar column hosts its own stack so it gets a native bar with the brand title.
-const SIDEBAR_COLUMN_OPTIONS = {
- ...pageRoute(),
- ...getCompactBrandHeaderOptions({ fontSize: 18, fontWeight: "800" }),
-};
-
export function ThreadNavigationSidebar(props: ThreadNavigationSidebarProps) {
return (
<ThreadPrDemandProvider visible={props.visible}>
- {Platform.OS !== "ios" ? (
- <ThreadNavigationSidebarPane {...props} nativeChrome={false} />
- ) : (
- <NativeSidebarContainer {...props} />
- )}
+ <WorkspaceSidebarColumn width={props.width}>
+ <ThreadNavigationSidebarPane {...props} />
+ </WorkspaceSidebarColumn>
</ThreadPrDemandProvider>
);
}
-function NativeSidebarContainer(props: ThreadNavigationSidebarProps) {
- return (
- <View
- testID="thread-navigation-sidebar"
- className="flex-1 border-border bg-drawer"
- style={{ borderRightWidth: StyleSheet.hairlineWidth, width: props.width }}
- >
- <StandaloneStack surface="sidebar" options={SIDEBAR_COLUMN_OPTIONS}>
- <ThreadNavigationSidebarPane {...props} nativeChrome />
- </StandaloneStack>
- </View>
- );
-}
-
-function ThreadNavigationSidebarPane(
- props: ThreadNavigationSidebarProps & { readonly nativeChrome: boolean },
-) {
+function ThreadNavigationSidebarPane(props: ThreadNavigationSidebarProps) {
const floatingTabsEnabled = useAndroidFloatingTabs();
const { themeVariables: materialTheme } = useAppearancePreferences();
const drawerColor = materialTheme["--color-drawer"];
@@ -152,7 +120,6 @@ function ThreadNavigationSidebarPane(
const threads = useNavigationThreadShells();
const { environments: workspaceEnvironments, state: catalogState } = useWorkspaceState();
const { savedConnectionsById } = useSavedRemoteConnections();
- const searchBarRef = useRef<SearchBarCommands>(null);
const openSwipeableRef = useRef<SwipeableMethods | null>(null);
const sidebarScrollGesture = useNativeGesture();
const {
@@ -335,78 +302,6 @@ function ThreadNavigationSidebarPane(
},
]
: threadListV2Items;
- const listMenuActions = [
- {
- id: "environment",
- title: "Environment",
- subactions: [
- {
- id: "environment:all",
- title: "All environments",
- subtitle: "Show threads from every environment",
- state: options.selectedEnvironmentId === null ? "on" : "off",
- },
- ...environments.map((environment) => ({
- id: `environment:${environment.environmentId}`,
- title: environment.label,
- state:
- options.selectedEnvironmentId === environment.environmentId
- ? ("on" as const)
- : ("off" as const),
- })),
- ],
- },
- ...(projectFilterOptions.length === 0
- ? []
- : ([
- {
- id: "project",
- title: "Project",
- subactions: [
- {
- id: "project:all",
- title: "All projects",
- subtitle: "Show threads from every project",
- state: selectedProjectKey === null ? "on" : "off",
- },
- ...projectFilterOptions.map((project) => ({
- id: `project:${project.key}`,
- title: project.label,
- state: selectedProjectKey === project.key ? ("on" as const) : ("off" as const),
- })),
- ],
- },
- ] satisfies MenuAction[])),
- ] satisfies MenuAction[];
- const handleListMenuAction = ({
- nativeEvent,
- }: {
- readonly nativeEvent: { readonly event: string };
- }) => {
- const event = nativeEvent.event;
- if (event === "environment:all") {
- setSelectedEnvironmentId(null);
- return;
- }
- if (event.startsWith("environment:")) {
- const environment = environments.find(
- (candidate) => String(candidate.environmentId) === event.slice("environment:".length),
- );
- if (environment) setSelectedEnvironmentId(environment.environmentId);
- return;
- }
- if (event === "project:all") {
- setSelectedProjectKey(null);
- return;
- }
- if (event.startsWith("project:")) {
- const projectKey = event.slice("project:".length);
- if (projectFilterOptions.some((project) => project.key === projectKey)) {
- setSelectedProjectKey(projectKey);
- }
- return;
- }
- };
const handleSwipeableWillOpen = (methods: SwipeableMethods) => {
if (openSwipeableRef.current !== methods) {
@@ -470,18 +365,6 @@ function ThreadNavigationSidebarPane(
}
return false;
};
- const focusSearch = () => {
- if (!props.nativeChrome) return false;
- const focus = () => searchBarRef.current?.focus();
- if (!props.visible) {
- props.onRequestVisibility();
- setTimeout(focus, 240);
- } else {
- focus();
- }
- return true;
- };
- useHardwareKeyboardCommand("focusSearch", focusSearch);
const renderListItem = ({ item }: { readonly item: SidebarListItem }) => {
switch (item.type) {
case "v2-pending": {
@@ -640,23 +523,35 @@ function ThreadNavigationSidebarPane(
);
}
};
- const filterCustomized = options.selectedEnvironmentId !== null || selectedProjectKey !== null;
- const filterIcon = filterCustomized
- ? "line.3.horizontal.decrease.circle.fill"
- : "line.3.horizontal.decrease.circle";
- const filterMenu = buildHomeListFilterMenu({
- environments,
- projects: projectFilterOptions,
- selectedEnvironmentId: options.selectedEnvironmentId,
- selectedProjectKey,
- onEnvironmentChange: setSelectedEnvironmentId,
- onProjectChange: setSelectedProjectKey,
- });
- const nativeHeaderItems = createSidebarHeaderItems({
- filterIcon,
- filterMenu,
- onOpenSettings: props.onOpenSettings,
- });
+ const header = (
+ <WorkspaceListHeader
+ accessibilityLabel="T3 Code, Threads"
+ onOpenEnvironments={props.onOpenEnvironmentSettings}
+ onOpenSettings={props.onOpenSettings}
+ search={{
+ value: props.searchQuery,
+ onChangeText: props.onSearchQueryChange,
+ placeholder: "Search",
+ accessibilityLabel: "Search threads",
+ }}
+ filter={{
+ customized: options.selectedEnvironmentId !== null || selectedProjectKey !== null,
+ items: buildHomeListFilterMenuItems({
+ environments,
+ projects: projectFilterOptions,
+ selectedEnvironmentId: options.selectedEnvironmentId,
+ selectedProjectKey,
+ onEnvironmentChange: setSelectedEnvironmentId,
+ onProjectChange: setSelectedProjectKey,
+ }),
+ }}
+ sidebar={{
+ width: props.width,
+ visible: props.visible,
+ onRequestVisibility: props.onRequestVisibility,
+ }}
+ />
+ );
const listEmpty = (
<Text
className={
@@ -679,36 +574,10 @@ function ThreadNavigationSidebarPane(
</Text>
);
- if (props.nativeChrome) {
+ if (Platform.OS === "ios") {
return (
<>
- <NativeStackScreenOptions
- optionsVersion={[nativeHeaderItems, props.width]}
- options={{
- ...getConnectionAwareBrandHeaderOptions({
- headerWidth: props.width,
- trailingItemCount: nativeHeaderItems.length,
- onOpenEnvironments: props.onOpenEnvironmentSettings,
- fallbackTitleStyle: { fontSize: 18, fontWeight: "800" },
- }),
- headerSearchBarOptions: {
- ref: searchBarRef,
- autoCapitalize: "none",
- hideNavigationBar: false,
- hideWhenScrolling: false,
- obscureBackground: false,
- placeholder: "Search",
- placement: "stacked",
- onCancelButtonPress: () => {
- props.onSearchQueryChange("");
- },
- onChangeText: (event) => {
- props.onSearchQueryChange(event.nativeEvent.text);
- },
- },
- unstable_headerRightItems: () => nativeHeaderItems,
- }}
- />
+ {header}
<View className="flex-1">
<SwipeableScrollGateProvider enabled={swipeEnabled}>
<GestureDetector gesture={sidebarScrollGesture}>
@@ -723,10 +592,7 @@ function ThreadNavigationSidebarPane(
itemsAreEqual={sidebarItemsAreEqual}
keyExtractor={(item) => item.key}
renderItem={renderListItem}
- automaticallyAdjustsScrollIndicatorInsets={NATIVE_LIQUID_GLASS_SUPPORTED}
- contentInsetAdjustmentBehavior={
- NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never"
- }
+ {...WORKSPACE_LIST_SCROLL_INSETS}
contentContainerStyle={[
styles.threadListContent,
{
@@ -751,7 +617,7 @@ function ThreadNavigationSidebarPane(
);
}
- // Android: the bar is the floating ThreadListToolbar below the list.
+ // Android: the bar floats below the list.
return (
<View testID="thread-navigation-sidebar" className="flex-1 bg-header">
<View
@@ -800,15 +666,7 @@ function ThreadNavigationSidebarPane(
</SwipeableScrollGateProvider>
)}
</View>
- <ThreadListToolbar
- searchQuery={props.searchQuery}
- onSearchQueryChange={props.onSearchQueryChange}
- filterActions={listMenuActions}
- filterCustomized={filterCustomized}
- onFilterSelect={(event) => handleListMenuAction({ nativeEvent: { event } })}
- onOpenEnvironments={props.onOpenEnvironmentSettings}
- onRequestVisibility={props.onRequestVisibility}
- />
+ {header}
<ThreadUndoNotice visible={props.visible} />
</View>
);
diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
index 4f13a57a8fb..62c1b039540 100644
--- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
@@ -109,7 +109,7 @@ import { resumeThread } from "./resume-thread";
import {
useAndroidWorkspaceBack,
useWorkspaceBackNavigation,
-} from "../workspace/useAndroidWorkspaceNavigation";
+} from "../layout/workspace/useAndroidWorkspaceNavigation";
import { openSettings } from "../settings/settings-navigation";
import {
InspectorContentScope,
@@ -119,7 +119,7 @@ import {
} from "./thread-inspector-preview";
import { useStartSideChat } from "./useStartSideChat";
import type { ThreadInspectorMode, ThreadInspectorTarget } from "./thread-inspector-navigation";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
function firstRouteParam(value: string | string[] | undefined): string | null {
const first = Array.isArray(value) ? value[0] : value;
diff --git a/apps/mobile/src/features/threads/sidebar-native-header-items.ts b/apps/mobile/src/features/threads/sidebar-native-header-items.ts
deleted file mode 100644
index cfbaf755e89..00000000000
--- a/apps/mobile/src/features/threads/sidebar-native-header-items.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import type {
- NativeStackHeaderItem,
- NativeStackHeaderItemMenu,
-} from "@react-navigation/native-stack";
-
-import type { HomeListFilterMenu } from "../home/home-list-filter-menu";
-import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items";
-
-type NativeHeaderMenuItems = NativeStackHeaderItemMenu["menu"]["items"];
-type NativeHeaderIcon = NonNullable<Extract<NativeStackHeaderItem, { type: "button" }>["icon"]>;
-
-function sfSymbolIcon(name: string): NativeHeaderIcon {
- return { type: "sfSymbol", name: name as never };
-}
-
-function toNativeHeaderMenuItems(items: HomeListFilterMenu["items"]): NativeHeaderMenuItems {
- return items.map((item) =>
- item.type === "action"
- ? {
- type: "action" as const,
- label: item.title,
- description: item.subtitle,
- onPress: item.onPress,
- state: item.state === "on" ? ("on" as const) : undefined,
- }
- : {
- type: "submenu" as const,
- label: item.title,
- items: toNativeHeaderMenuItems(item.items),
- },
- );
-}
-
-export function createSidebarHeaderItems(input: {
- readonly filterIcon: string;
- readonly filterMenu: HomeListFilterMenu;
- readonly onOpenSettings: () => void;
-}): NativeStackHeaderItem[] {
- return [
- withNativeGlassHeaderItem({
- type: "menu",
- axisBehavior: "horizontalOnly",
- label: "",
- accessibilityLabel: "Filter threads",
- icon: sfSymbolIcon(input.filterIcon),
- menu: {
- title: input.filterMenu.title,
- items: toNativeHeaderMenuItems(input.filterMenu.items),
- },
- }),
- withNativeGlassHeaderItem({
- type: "button",
- axisBehavior: "horizontalOnly",
- label: "Settings",
- accessibilityLabel: "Open settings",
- icon: sfSymbolIcon("gearshape"),
- onPress: input.onOpenSettings,
- }),
- ];
-}
diff --git a/apps/mobile/src/features/triage/useStartTriage.ts b/apps/mobile/src/features/triage/useStartTriage.ts
index eefb775bcd1..eb9eef24b26 100644
--- a/apps/mobile/src/features/triage/useStartTriage.ts
+++ b/apps/mobile/src/features/triage/useStartTriage.ts
@@ -18,7 +18,7 @@ import {
setComposerDraftText,
waitForComposerDraftsLoaded,
} from "../../state/use-composer-drafts";
-import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
const CLI_COMMAND = "npx t3 triage";
diff --git a/apps/mobile/src/lib/android-workspace-navigation.test.ts b/apps/mobile/src/lib/android-workspace-navigation.test.ts
index 51f9f3b6a89..059d5865513 100644
--- a/apps/mobile/src/lib/android-workspace-navigation.test.ts
+++ b/apps/mobile/src/lib/android-workspace-navigation.test.ts
@@ -3,7 +3,7 @@ import { describe, expect, it } from "vite-plus/test";
import {
androidWorkspaceTabNavigationState,
type AndroidWorkspaceNavigationTab,
-} from "../features/workspace/android-workspace-tabs";
+} from "../features/layout/workspace/android-workspace-tabs";
import {
linkedThreadStep,
parentThreadIsBelow,
diff --git a/apps/mobile/src/native/V5StackHeader.ios.tsx b/apps/mobile/src/native/V5StackHeader.ios.tsx
index f6bbefce285..f53e71ee23f 100644
--- a/apps/mobile/src/native/V5StackHeader.ios.tsx
+++ b/apps/mobile/src/native/V5StackHeader.ios.tsx
@@ -8,7 +8,7 @@ import { StyleSheet } from "react-native";
import { KeyboardController, useKeyboardState } from "react-native-keyboard-controller";
import { isDuoDevice } from "../lib/device-type";
import { useMobileNavigationTheme } from "../lib/useMobileNavigationTheme";
-import { useDeviceType, useNativeLayoutMetrics } from "../native/native-layout-metrics";
+import { useDeviceType, useNativeLayoutMetrics } from "./native-layout-metrics";
import { HeaderItemsWidthContext } from "./header-items-width";
import {
SearchBar,
diff --git a/apps/mobile/src/native/useOpenPullRequest.ts b/apps/mobile/src/native/useOpenPullRequest.ts
index fa7d437155b..ca6edda06a3 100644
--- a/apps/mobile/src/native/useOpenPullRequest.ts
+++ b/apps/mobile/src/native/useOpenPullRequest.ts
@@ -1,7 +1,7 @@
import { useNavigation, useRoute, StackActions } from "@react-navigation/native";
import { nativePullRequestDestination } from "../lib/pullRequestNavigation";
import { Platform } from "react-native";
-import { useSelectWorkspaceDetail } from "../features/workspace/useSelectWorkspaceDetail";
+import { useSelectWorkspaceDetail } from "../features/layout/workspace/useSelectWorkspaceDetail";
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { useProjects, useThreadShell } from "../state/entities";
import { tryOpenExternalUrl } from "../lib/openExternalUrl";
diff --git a/apps/mobile/src/state/use-selected-thread-git-actions.ts b/apps/mobile/src/state/use-selected-thread-git-actions.ts
index a5351fb3141..7ecc10d0b6d 100644
--- a/apps/mobile/src/state/use-selected-thread-git-actions.ts
+++ b/apps/mobile/src/state/use-selected-thread-git-actions.ts
@@ -21,9 +21,9 @@ import {
import * as Cause from "effect/Cause";
import { AsyncResult } from "effect/reactivity";
-import { useBranches } from "../state/queries";
-import { threadEnvironment } from "../state/threads";
-import { vcsActionManager, vcsEnvironment } from "../state/vcs";
+import { useBranches } from "./queries";
+import { threadEnvironment } from "./threads";
+import { vcsActionManager, vcsEnvironment } from "./vcs";
import { uuidv4 } from "../lib/uuid";
import { appAtomRegistry } from "./atom-registry";
import { readEnvironmentScope, useEnvironmentScope } from "./session";
diff --git a/apps/mobile/src/state/use-selected-thread-requests.ts b/apps/mobile/src/state/use-selected-thread-requests.ts
index d4bbc6bfe5b..776a3faf51c 100644
--- a/apps/mobile/src/state/use-selected-thread-requests.ts
+++ b/apps/mobile/src/state/use-selected-thread-requests.ts
@@ -36,7 +36,7 @@ import {
import { AuthOrchestrationOperateScope } from "@t3tools/contracts";
import { Atom } from "effect/reactivity";
-import { environmentThreadDetails, threadEnvironment } from "../state/threads";
+import { environmentThreadDetails, threadEnvironment } from "./threads";
import {
buildPendingUserInputAnswers,
setPendingUserInputCustomAnswer,
diff --git a/apps/mobile/src/state/use-thread-composer-state.ts b/apps/mobile/src/state/use-thread-composer-state.ts
index 139e5f79448..3e3c645cf3d 100644
--- a/apps/mobile/src/state/use-thread-composer-state.ts
+++ b/apps/mobile/src/state/use-thread-composer-state.ts
@@ -61,12 +61,12 @@ import {
selectPendingAcknowledgedMessages,
} from "../features/threads/pending-thread-feed";
import { threadAllowsProviderSwitch } from "./thread-provider-switching";
-import { appAtomRegistry } from "../state/atom-registry";
+import { appAtomRegistry } from "./atom-registry";
import { pendingThreadCreationMessage } from "./pending-thread-creation";
import {
composerAttachmentUploadBlockReason,
composerAttachmentUploadsAtom,
-} from "../state/composer-attachment-uploads";
+} from "./composer-attachment-uploads";
import {
appendComposerDraftAttachments,
insertComposerDraftContext,
@@ -105,13 +105,13 @@ import {
startQueuedRunEditSave,
useQueuedRunEdit,
} from "./queued-run-edit";
-import { setPendingConnectionError } from "../state/use-remote-environment-registry";
+import { setPendingConnectionError } from "./use-remote-environment-registry";
import { clearThreadComposerError, setThreadComposerError } from "./thread-composer-error";
import {
useSelectedThreadProjection,
useSelectedThreadVisibleTurnItems,
-} from "../state/use-thread-detail";
-import { useThreadSelection } from "../state/use-thread-selection";
+} from "./use-thread-detail";
+import { useThreadSelection } from "./use-thread-selection";
import { enqueueThreadOutboxMessage } from "./thread-outbox";
import { dispatchingQueuedMessageIdAtom, useThreadOutboxMessages } from "./use-thread-outbox";
import { threadEnvironment } from "./threads";
diff --git a/apps/mobile/src/state/use-thread-selection.ts b/apps/mobile/src/state/use-thread-selection.ts
index 17a4a26a186..35598d74bc3 100644
--- a/apps/mobile/src/state/use-thread-selection.ts
+++ b/apps/mobile/src/state/use-thread-selection.ts
@@ -20,8 +20,8 @@ import {
import * as Option from "effect/Option";
import { scopedThreadKey } from "../lib/scopedEntities";
-import { useProject, useQuietThreadShell } from "../state/entities";
-import { useEnvironmentThread } from "../state/threads";
+import { useProject, useQuietThreadShell } from "./entities";
+import { useEnvironmentThread } from "./threads";
import {
resolvePendingThreadCreation,
pendingThreadCreationOutcomesAtom,
diff --git a/apps/mobile/vite.config.ts b/apps/mobile/vite.config.ts
index 9cdbc7ff6e4..629eef984d8 100644
--- a/apps/mobile/vite.config.ts
+++ b/apps/mobile/vite.config.ts
@@ -6,7 +6,7 @@ import "vite-plus/test/config";
const reactTests = [
"src/features/threads/git/GitBranchesSheet.test.tsx",
"src/features/threads/new-task-flow-provider.test.tsx",
- "src/features/workspace/workspace-tabs-state.test.ts",
+ "src/features/layout/workspace/workspace-tabs-state.test.ts",
"src/state/use-thread-pr.demand.test.tsx",
"src/features/threads/git/GitBranchesSheet.occupancy.test.tsx",
"src/features/files/useFileTreeEntries.test.tsx",
@@ -40,7 +40,7 @@ const reactTests = [
"src/features/threads/use-thread-list-now.test.tsx",
"src/features/threads/useThreadListV2.test.tsx",
"src/features/home/home-list-options.test.tsx",
- "src/features/workspace/useSearchScrollRestoration.test.tsx",
+ "src/features/layout/workspace/useSearchScrollRestoration.test.tsx",
"src/features/connection/ConnectionsNewRouteScreen.test.tsx",
"src/features/devices/device-stream.browser.test.ts",
];
diff --git a/docs/internals/mobile-layout.md b/docs/internals/mobile-layout.md
index c1f44c62db0..b98199ff4b6 100644
--- a/docs/internals/mobile-layout.md
+++ b/docs/internals/mobile-layout.md
@@ -12,25 +12,34 @@ screen never asks which platform or window width it is on.
1. **Router.** The [root stack](../../apps/mobile/src/Stack.tsx) is the layout state: what is
selected, what is pushed, which sheet is open. Rotating, folding or resizing renders the same
- stack differently. Nothing remembers which column a page was in. See
- [Mobile navigation](./mobile-navigation.md).
-2. **Workspace shell.** The [adaptive layout](../../apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx)
- owns placement and widths, from the width class in [`layout.ts`](../../apps/mobile/src/lib/layout.ts):
+ stack differently. Nothing remembers which column a page was in. Each route declares what it
+ is with a [preset](../../apps/mobile/src/features/layout/route-options.ts) (`pageRoute`,
+ `sheetRoute`, `modalRoute`, `immersiveRoute`); the preset owns detents, corner radius, header
+ appearance and the Android fallback. See [Mobile navigation](./mobile-navigation.md).
+2. **Workspace shell.** [`features/layout`](../../apps/mobile/src/features/layout/) owns placement
+ and widths, from the width class in [`layout.ts`](../../apps/mobile/src/lib/layout.ts):
- _Expanded_: sidebar, content and inspector columns.
- _Medium_ (600–720pt wide): the sidebar sits beside a list and floats over a page.
- _Compact_ (under 600pt either way): the sidebar is the root, and pages push.
- Where the inspector column does not fit, the inspector is a sheet.
-3. **Feature screens.** A screen places content by role. It renders its page and declares its
- inspector panes with `<Inspector>`, and asks for them with `showInspector()`. The shell decides
- between column and sheet. Choosing a route or a component by width or platform here is the bug
- this structure exists to prevent.
-4. **Design system.** Every pane has an `AppBar` with the same contract as a full screen.
+
+ The workspace tabs, dock and toolbars live in `features/layout/workspace`. Stacks nested in a
+ sheet or popover, and screens rendered under a route of their own, also come from here.
+
+3. **Feature screens.** A screen places content by role. It draws one `AppBar` (or `SheetHeader`
+ for a form sheet), renders its page, declares its inspector panes with `<Inspector>`, and asks
+ for them with `showInspector()`. The shell decides between column and sheet. Choosing a route,
+ a component, header options or an inset by width or platform here is the bug this structure
+ exists to prevent.
+4. **Design system.** Every pane, page, sheet and modal has an `AppBar` with the same contract on
+ both platforms; a sheet or modal passes `onClose`.
[`PaneContext`](../../apps/mobile/src/components/ui/Pane.tsx) tells the bar which column it is
- in, so it adds that column's controls, such as the sidebar toggle. Chrome branches by platform
- only here.
+ in, so it adds that column's controls, such as the sidebar toggle. Where content meets the bar
+ comes from [`useBarInset`](../../apps/mobile/src/components/ui/useBarInset.ts). Chrome
+ branches by platform only here.
5. **Native.** On iOS 26, the columns are `UISplitViewController` columns with a navigation bar
each. On Android and on iPadOS 18–25, the shell draws the same columns in JS from the window
- and hinge metrics.
+ and hinge metrics. Android never shows the native stack header; every bar is drawn in-tree.
Platform splits live in layers 1, 2 and 4, as `.ios` and `.android` files.
diff --git a/docs/internals/mobile-navigation.md b/docs/internals/mobile-navigation.md
index 65e551fa40c..6a5c9988fff 100644
--- a/docs/internals/mobile-navigation.md
+++ b/docs/internals/mobile-navigation.md
@@ -13,7 +13,7 @@ Opening a page has two intents, and each has one action:
- **Select** shows a thread or pull request as the workspace's only page, the
way a list row does. Everything that selects (rows, the command palette,
compose, notifications, deep links) uses
- [`selectWorkspaceDetail`](../../apps/mobile/src/features/workspace/workspace-detail-selection.ts),
+ [`selectWorkspaceDetail`](../../apps/mobile/src/features/layout/workspace/workspace-detail-selection.ts),
which the root stack's router handles. The resulting stack is the same on
phones, collapsed splits, and expanded splits. Only route keys differ: the
page already showing keeps its key, so the detail column updates in place