Add the quick new-thread button to the split-view sidebar
Same behavior as the compact Home list: a plus button on each single-project group header opens the new-task draft targeted at that project. The navigation callback is minted in AdaptiveWorkspaceLayout (root stack) per the sidebar's no-navigation-hooks convention. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
8fb1785ee1
commit
21eb3bdaa7
2 files changed
+33
-2
No files matched your search
@@ -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}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user