From 195355ae8b85031fb390c3f218f9846d29b1453a Mon Sep 17 00:00:00 2001 From: Nils <104727469+nilskroe@users.noreply.github.com> Date: Fri, 16 Jan 2026 17:49:46 +0100 Subject: [PATCH] feat(sidebar): add worktree session button to project header (#159) Add a dedicated button to create new worktree sessions directly from the project header. The button appears on hover (alongside the existing menu) for git repositories, making the worktree feature more discoverable. - Add onNewWorktreeSession prop to SortableProjectItem - Show git branch icon button between menu and new session button - Button only visible for git repositories - Uses same hover behavior as the existing project menu --- .../src/components/session/SessionSidebar.tsx | 65 +++++++++++++++---- 1 file changed, 53 insertions(+), 12 deletions(-) diff --git a/packages/ui/src/components/session/SessionSidebar.tsx b/packages/ui/src/components/session/SessionSidebar.tsx index e6f69e52..3c5649b3 100644 --- a/packages/ui/src/components/session/SessionSidebar.tsx +++ b/packages/ui/src/components/session/SessionSidebar.tsx @@ -134,6 +134,7 @@ interface SortableProjectItemProps { onToggle: () => void; onHoverChange: (hovered: boolean) => void; onNewSession: () => void; + onNewWorktreeSession?: () => void; onOpenMultiRunLauncher: () => void; onClose: () => void; sentinelRef: (el: HTMLDivElement | null) => void; @@ -155,6 +156,7 @@ const SortableProjectItem: React.FC = ({ onToggle, onHoverChange, onNewSession, + onNewWorktreeSession, onOpenMultiRunLauncher, onClose, sentinelRef, @@ -253,18 +255,47 @@ const SortableProjectItem: React.FC = ({ - {/* New session button */} - + {isRepo && onNewWorktreeSession && ( + + + + + +

New session in worktree

+
+
+ )} + + + + + +

New session

+
+
@@ -1549,6 +1580,16 @@ export const SessionSidebar: React.FC = ({ openNewSessionDraft({ directoryOverride: project.normalizedPath }); } }} + onNewWorktreeSession={() => { + if (projectKey !== activeProjectId) { + setActiveProject(projectKey); + } + setActiveMainTab('chat'); + if (mobileVariant) { + setSessionSwitcherOpen(false); + } + createWorktreeSession(); + }} onOpenMultiRunLauncher={() => { if (projectKey !== activeProjectId) { setActiveProject(projectKey);