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.
This commit is contained in:
Shirone
2026-01-24 18:11:47 +01:00
parent 8e13245aab
commit bbe669cdf2

View File

@@ -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 (