mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 20:23:36 +00:00
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:
@@ -37,6 +37,9 @@ import { TestLogsPanel } from '@/components/ui/test-logs-panel';
|
|||||||
import { Undo2 } from 'lucide-react';
|
import { Undo2 } from 'lucide-react';
|
||||||
import { getElectronAPI } from '@/lib/electron';
|
import { getElectronAPI } from '@/lib/electron';
|
||||||
|
|
||||||
|
/** Threshold for switching from tabs to dropdown layout (number of worktrees) */
|
||||||
|
const WORKTREE_DROPDOWN_THRESHOLD = 3;
|
||||||
|
|
||||||
export function WorktreePanel({
|
export function WorktreePanel({
|
||||||
projectPath,
|
projectPath,
|
||||||
onCreateWorktree,
|
onCreateWorktree,
|
||||||
@@ -713,8 +716,8 @@ export function WorktreePanel({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Threshold for switching from tabs to dropdown (3+ worktrees total)
|
// Use dropdown layout when worktree count meets or exceeds the threshold
|
||||||
const useDropdownLayout = worktrees.length >= 3;
|
const useDropdownLayout = worktrees.length >= WORKTREE_DROPDOWN_THRESHOLD;
|
||||||
|
|
||||||
// Desktop view: full tabs layout or dropdown layout depending on worktree count
|
// Desktop view: full tabs layout or dropdown layout depending on worktree count
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user