Skip to content

Commit 8fcc6cb

Browse files
authored
Merge pull request #185 from AutoMaker-Org/generate-titles
fixing worktree style
2 parents 84832a1 + 80ab5dd commit 8fcc6cb

2 files changed

Lines changed: 63 additions & 18 deletions

File tree

apps/ui/src/components/views/board-view/worktree-panel/components/worktree-tab.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,6 @@ export function WorktreeTab({
9191
onStopDevServer,
9292
onOpenDevServerUrl,
9393
}: WorktreeTabProps) {
94-
// Determine border color based on state:
95-
// - Running features: cyan border (high visibility, indicates active work)
96-
// - Uncommitted changes: amber border (warning state, needs attention)
97-
// - Both: cyan takes priority (running is more important to see)
98-
const getBorderClasses = () => {
99-
if (isRunning) {
100-
return "ring-2 ring-cyan-500 ring-offset-1 ring-offset-background";
101-
}
102-
if (hasChanges) {
103-
return "ring-2 ring-amber-500 ring-offset-1 ring-offset-background";
104-
}
105-
return "";
106-
};
107-
108-
const borderClasses = getBorderClasses();
10994

11095
let prBadge: JSX.Element | null = null;
11196
if (worktree.pr) {
@@ -197,7 +182,7 @@ export function WorktreeTab({
197182
}
198183

199184
return (
200-
<div className={cn("flex items-center rounded-md", borderClasses)}>
185+
<div className="flex items-center rounded-md">
201186
{worktree.isMain ? (
202187
<>
203188
<Button

apps/ui/src/components/views/board-view/worktree-panel/worktree-panel.tsx

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
1+
import { useState, useEffect } from "react";
22
import { Button } from "@/components/ui/button";
3-
import { GitBranch, Plus, RefreshCw } from "lucide-react";
3+
import { GitBranch, Plus, RefreshCw, ChevronDown, ChevronUp } from "lucide-react";
44
import { cn, pathsEqual } from "@/lib/utils";
55
import type { WorktreePanelProps, WorktreeInfo } from "./types";
66
import {
@@ -13,6 +13,8 @@ import {
1313
} from "./hooks";
1414
import { WorktreeTab } from "./components";
1515

16+
const WORKTREE_PANEL_COLLAPSED_KEY = "worktree-panel-collapsed";
17+
1618
export function WorktreePanel({
1719
projectPath,
1820
onCreateWorktree,
@@ -81,6 +83,27 @@ export function WorktreePanel({
8183
features,
8284
});
8385

86+
// Collapse state with localStorage persistence
87+
const [isCollapsed, setIsCollapsed] = useState(() => {
88+
if (typeof window === "undefined") return false;
89+
const saved = localStorage.getItem(WORKTREE_PANEL_COLLAPSED_KEY);
90+
return saved === "true";
91+
});
92+
93+
useEffect(() => {
94+
localStorage.setItem(WORKTREE_PANEL_COLLAPSED_KEY, String(isCollapsed));
95+
}, [isCollapsed]);
96+
97+
const toggleCollapsed = () => setIsCollapsed((prev) => !prev);
98+
99+
// Get the currently selected worktree for collapsed view
100+
const selectedWorktree = worktrees.find((w) => {
101+
if (currentWorktree === null || currentWorktree === undefined || currentWorktree.path === null) {
102+
return w.isMain;
103+
}
104+
return pathsEqual(w.path, currentWorktreePath);
105+
});
106+
84107
const isWorktreeSelected = (worktree: WorktreeInfo) => {
85108
return worktree.isMain
86109
? currentWorktree === null ||
@@ -106,8 +129,45 @@ export function WorktreePanel({
106129
return null;
107130
}
108131

132+
// Collapsed view - just show current branch and toggle
133+
if (isCollapsed) {
134+
return (
135+
<div className="flex items-center gap-2 px-4 py-1.5 border-b border-border bg-glass/50 backdrop-blur-sm">
136+
<Button
137+
variant="ghost"
138+
size="sm"
139+
className="h-6 w-6 p-0 text-muted-foreground hover:text-foreground"
140+
onClick={toggleCollapsed}
141+
title="Expand worktree panel"
142+
>
143+
<ChevronDown className="w-4 h-4" />
144+
</Button>
145+
<GitBranch className="w-4 h-4 text-muted-foreground" />
146+
<span className="text-sm text-muted-foreground">Branch:</span>
147+
<span className="text-sm font-mono font-medium">
148+
{selectedWorktree?.branch ?? "main"}
149+
</span>
150+
{selectedWorktree?.hasChanges && (
151+
<span className="inline-flex items-center justify-center h-4 min-w-[1rem] px-1 text-[10px] font-medium rounded border bg-amber-500/20 text-amber-600 dark:text-amber-400 border-amber-500/30">
152+
{selectedWorktree.changedFilesCount ?? "!"}
153+
</span>
154+
)}
155+
</div>
156+
);
157+
}
158+
159+
// Expanded view - full worktree panel
109160
return (
110161
<div className="flex items-center gap-2 px-4 py-2 border-b border-border bg-glass/50 backdrop-blur-sm">
162+
<Button
163+
variant="ghost"
164+
size="sm"
165+
className="h-6 w-6 p-0 text-muted-foreground hover:text-foreground"
166+
onClick={toggleCollapsed}
167+
title="Collapse worktree panel"
168+
>
169+
<ChevronUp className="w-4 h-4" />
170+
</Button>
111171
<GitBranch className="w-4 h-4 text-muted-foreground" />
112172
<span className="text-sm text-muted-foreground mr-2">Branch:</span>
113173

0 commit comments

Comments
 (0)