From bbe669cdf2e00b3f4e44dc827e39472de21164e0 Mon Sep 17 00:00:00 2001 From: Shirone Date: Sat, 24 Jan 2026 18:11:47 +0100 Subject: [PATCH] refactor(worktree-panel): introduce constant for dropdown layout threshold - Added a constant `WORKTREE_DROPDOWN_THRESHOLD` to define the threshold for switching from tabs to dropdown layout in the WorktreePanel. - Updated the logic to use this constant for better readability and maintainability of the code. --- .../views/board-view/worktree-panel/worktree-panel.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/ui/src/components/views/board-view/worktree-panel/worktree-panel.tsx b/apps/ui/src/components/views/board-view/worktree-panel/worktree-panel.tsx index 82c69545..b1e800fe 100644 --- a/apps/ui/src/components/views/board-view/worktree-panel/worktree-panel.tsx +++ b/apps/ui/src/components/views/board-view/worktree-panel/worktree-panel.tsx @@ -37,6 +37,9 @@ import { TestLogsPanel } from '@/components/ui/test-logs-panel'; import { Undo2 } from 'lucide-react'; import { getElectronAPI } from '@/lib/electron'; +/** Threshold for switching from tabs to dropdown layout (number of worktrees) */ +const WORKTREE_DROPDOWN_THRESHOLD = 3; + export function WorktreePanel({ projectPath, onCreateWorktree, @@ -713,8 +716,8 @@ export function WorktreePanel({ ); } - // Threshold for switching from tabs to dropdown (3+ worktrees total) - const useDropdownLayout = worktrees.length >= 3; + // Use dropdown layout when worktree count meets or exceeds the threshold + const useDropdownLayout = worktrees.length >= WORKTREE_DROPDOWN_THRESHOLD; // Desktop view: full tabs layout or dropdown layout depending on worktree count return (