diff --git a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx index fe3db9a4f0..88e08f1d9a 100644 --- a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx +++ b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx @@ -1,4 +1,7 @@ -import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell"; +import type { + EnvironmentProject, + EnvironmentThreadShell, +} from "@t3tools/client-runtime/state/shell"; import { EnvironmentId, ThreadId } from "@t3tools/contracts"; import { useFocusEffect } from "@react-navigation/native"; import { @@ -401,6 +404,20 @@ export function AdaptiveWorkspaceLayout(props: { navigation.navigate("SettingsSheet", { screen: "SettingsEnvironments" }); }, [navigation]); + const handleNewThreadInProject = useCallback( + (project: EnvironmentProject) => { + navigation.navigate("NewTaskSheet", { + screen: "NewTaskDraft", + params: { + environmentId: String(project.environmentId), + projectId: String(project.id), + title: project.title, + }, + }); + }, + [navigation], + ); + const renderedSidebarWidth = useSharedValue( panes.primarySidebarVisible ? (layout.listPaneWidth ?? 0) : 0, ); @@ -477,6 +494,7 @@ export function AdaptiveWorkspaceLayout(props: { selectedThreadKey={selectedThreadKey} onOpenSettings={handleOpenSettings} onOpenEnvironmentSettings={handleOpenEnvironmentSettings} + onNewThreadInProject={handleNewThreadInProject} onSelectThread={handleSelectThread} onSearchQueryChange={setPrimarySidebarSearchQuery} searchQuery={primarySidebarSearchQuery} diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx index 1cdb4ce257..2d7e732bde 100644 --- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx +++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx @@ -1,5 +1,8 @@ import { isLiquidGlassSupported, LiquidGlassView } from "@callstack/liquid-glass"; -import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell"; +import type { + EnvironmentProject, + EnvironmentThreadShell, +} from "@t3tools/client-runtime/state/shell"; import { LegendList } from "@legendapp/list/react-native"; import type { MenuAction } from "@react-native-menu/menu"; import { SymbolView } from "expo-symbols"; @@ -107,6 +110,7 @@ interface ThreadNavigationSidebarProps { readonly selectedThreadKey: string | null; readonly onOpenSettings: () => void; readonly onOpenEnvironmentSettings: () => void; + readonly onNewThreadInProject: (project: EnvironmentProject) => void; readonly onSearchQueryChange: (query: string) => void; readonly onSelectThread: (thread: EnvironmentThreadShell) => void; readonly onRequestVisibility: () => void; @@ -413,6 +417,14 @@ function ThreadNavigationSidebarPane( isFirst={item.isFirst} groupKey={item.group.key} onGroupAction={updateGroupDisplay} + // Same gating as the compact Home list: aggregated groups have no + // single target project, and pending-project groups hold a + // placeholder shell rather than a real project. + onNewThread={ + item.group.projects.length === 1 && !item.group.key.startsWith("pending-project:") + ? props.onNewThreadInProject + : undefined + } project={item.group.representative} threadCount={item.group.threads.length + item.group.pendingTasks.length} title={item.group.title} @@ -480,6 +492,7 @@ function ThreadNavigationSidebarPane( handleSwipeableWillOpen, openPendingTask, projectCwdByKey, + props.onNewThreadInProject, props.selectedThreadKey, props.width, savedConnectionsById,