From 200bb3bcaee905a7bfc8b7ed55a7e39add676229 Mon Sep 17 00:00:00 2001 From: Andy <119136210+AndyMik90@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:26:18 +0100 Subject: [PATCH] fix(terminal): add scroll area to worktree dropdown to prevent overflow (#1146) * fix(terminal): add scroll area to worktree dropdown to prevent overflow Wrap worktree list in ScrollArea with max-height of 300px to handle cases with many worktrees without overflowing the screen. Co-Authored-By: Claude Opus 4.5 * fix(terminal): keep separator fixed above scrollable worktree list Move DropdownMenuSeparator outside ScrollArea so it remains visible when scrolling through many worktrees, maintaining visual distinction from the "Create New" item. Co-Authored-By: Claude Opus 4.5 --------- Co-authored-by: Claude Opus 4.5 --- .../components/terminal/WorktreeSelector.tsx | 154 +++++++++--------- 1 file changed, 78 insertions(+), 76 deletions(-) diff --git a/apps/frontend/src/renderer/components/terminal/WorktreeSelector.tsx b/apps/frontend/src/renderer/components/terminal/WorktreeSelector.tsx index 1394133a..5a94d9e6 100644 --- a/apps/frontend/src/renderer/components/terminal/WorktreeSelector.tsx +++ b/apps/frontend/src/renderer/components/terminal/WorktreeSelector.tsx @@ -20,6 +20,7 @@ import { AlertDialogTitle, } from '../ui/alert-dialog'; import { cn } from '../../lib/utils'; +import { ScrollArea } from '../ui/scroll-area'; import { useProjectStore } from '../../stores/project-store'; interface WorktreeSelectorProps { @@ -169,90 +170,91 @@ export function WorktreeSelector({ {t('terminal:worktree.createNew')} - {/* Separator and existing worktrees */} - {isLoading ? ( - <> - + {/* Fixed separator between "Create New" and scrollable content */} + + + {/* Scrollable content */} + + {isLoading ? (
- - ) : ( - <> - {/* Terminal Worktrees Section */} - {worktrees.length > 0 && ( - <> - -
- {t('terminal:worktree.existing')} -
- {worktrees.map((wt) => ( - { - e.stopPropagation(); - setIsOpen(false); - onSelectWorktree(wt); - }} - className="text-xs group" - > - -
- {wt.name} - {wt.branchName && ( - - {wt.branchName} - - )} -
- -
- ))} - - )} + +
+ {wt.name} + {wt.branchName && ( + + {wt.branchName} + + )} +
+ + + ))} + + )} - {/* Task Worktrees Section */} - {taskWorktrees.length > 0 && ( - <> - -
- {t('terminal:worktree.taskWorktrees')} -
- {taskWorktrees.map((wt) => ( - { - e.stopPropagation(); - setIsOpen(false); - selectTaskWorktree(wt); - }} - className="text-xs group" - > - -
- {wt.specName} - {wt.branch && ( - - {wt.branch} - - )} -
-
- ))} - - )} - - )} + {/* Task Worktrees Section */} + {taskWorktrees.length > 0 && ( + <> + +
+ {t('terminal:worktree.taskWorktrees')} +
+ {taskWorktrees.map((wt) => ( + { + e.stopPropagation(); + setIsOpen(false); + selectTaskWorktree(wt); + }} + className="text-xs group" + > + +
+ {wt.specName} + {wt.branch && ( + + {wt.branch} + + )} +
+
+ ))} + + )} + + )} +