diff --git a/packages/ui/src/components/session/BranchPickerDialog.tsx b/packages/ui/src/components/session/BranchPickerDialog.tsx index 1574f867..d2e75ff8 100644 --- a/packages/ui/src/components/session/BranchPickerDialog.tsx +++ b/packages/ui/src/components/session/BranchPickerDialog.tsx @@ -4,6 +4,7 @@ import { DialogContent, DialogHeader, DialogTitle, + DialogDescription, } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; @@ -136,9 +137,15 @@ export function BranchPickerDialog({ return ( - + - Branches & Worktrees + + + Branches & Worktrees + + + Start a new worktree session from any local branch +
@@ -152,7 +159,7 @@ export function BranchPickerDialog({
-
+
{gitRepoProjects.length === 0 ? (
No git repositories found @@ -172,11 +179,11 @@ export function BranchPickerDialog({ .filter(b => !worktreeBranches.has(b)); return ( -
+
- {isExpanded && ( -
+
{data?.loading ? ( -
+
Loading branches...
) : data?.error ? ( -
+
{data.error}
) : localBranches.length === 0 ? ( -
+
{searchQuery ? 'No matching branches' : 'No branches found'}
) : ( -
- {localBranches.map((branchName) => { - const branchDetails = branches?.branches[branchName]; - const isCurrent = branchDetails?.current; - const isCreating = creatingWorktree === `${project.id}:${branchName}`; + localBranches.map((branchName) => { + const branchDetails = branches?.branches[branchName]; + const isCurrent = branchDetails?.current; + const isCreating = creatingWorktree === `${project.id}:${branchName}`; - return ( -
- -
-
- - {branchName} + return ( +
+ +
+
+ + {branchName} + + {isCurrent && ( + + current - {isCurrent && ( - - current - - )} -
-
- {branchDetails?.commit && ( - - {branchDetails.commit.slice(0, 7)} - - )} - {branchDetails?.ahead !== undefined && branchDetails.ahead > 0 && ( - - ↑{branchDetails.ahead} - - )} - {branchDetails?.behind !== undefined && branchDetails.behind > 0 && ( - - ↓{branchDetails.behind} - - )} -
+ )} +
+
+ {branchDetails?.commit && ( + + {branchDetails.commit.slice(0, 7)} + + )} + {branchDetails?.ahead !== undefined && branchDetails.ahead > 0 && ( + + ↑{branchDetails.ahead} + + )} + {branchDetails?.behind !== undefined && branchDetails.behind > 0 && ( + + ↓{branchDetails.behind} + + )}
- - - - - - - Create worktree for this branch - -
- ); - })} -
+ + + + + + + Create worktree for this branch + + +
+ ); + }) )}
)} diff --git a/packages/ui/src/components/session/SessionSidebar.tsx b/packages/ui/src/components/session/SessionSidebar.tsx index 46b87686..02fa7256 100644 --- a/packages/ui/src/components/session/SessionSidebar.tsx +++ b/packages/ui/src/components/session/SessionSidebar.tsx @@ -176,6 +176,8 @@ const SortableProjectItem: React.FC = ({ isDragging, } = useSortable({ id }); + const [isMenuOpen, setIsMenuOpen] = React.useState(false); + return (
{/* Sentinel for sticky detection */} @@ -191,7 +193,7 @@ const SortableProjectItem: React.FC = ({ {/* Project header - sticky like workspace groups */}
= ({ }} onMouseEnter={() => onHoverChange(true)} onMouseLeave={() => onHoverChange(false)} + onContextMenu={(event) => { + event.preventDefault(); + setIsMenuOpen(true); + }} >
{/* Project name with tooltip for path - draggable */} @@ -231,7 +237,10 @@ const SortableProjectItem: React.FC = ({ {/* Project menu */} - + + {isRepo && !hideDirectoryControls && settingsAutoCreateWorktree && onNewSession && ( + + + New Session + + )} + {isRepo && !hideDirectoryControls && !settingsAutoCreateWorktree && onNewWorktreeSession && ( + + + New Session in Worktree + + )} + {isRepo && !hideDirectoryControls && onOpenBranchPicker && ( + + + Browse Branches + + )} {isRepo && !hideDirectoryControls && ( @@ -262,7 +289,7 @@ const SortableProjectItem: React.FC = ({ - {isRepo && !hideDirectoryControls && onNewWorktreeSession && !settingsAutoCreateWorktree && ( + {isRepo && !hideDirectoryControls && onNewWorktreeSession && settingsAutoCreateWorktree && ( -

Browse branches

+

New session

)} - - - - - -

New session

-
-
@@ -357,9 +363,6 @@ const ProjectDragOverlay: React.FC = ({ )}> {projectLabel} - - -
); @@ -1605,11 +1608,7 @@ export const SessionSidebar: React.FC = ({ if (mobileVariant) { setSessionSwitcherOpen(false); } - if (settingsAutoCreateWorktree && isRepo) { - createWorktreeSession(); - } else { - openNewSessionDraft({ directoryOverride: project.normalizedPath }); - } + openNewSessionDraft({ directoryOverride: project.normalizedPath }); }} onNewWorktreeSession={() => { if (projectKey !== activeProjectId) {