Skip to content

Commit 92c492f

Browse files
committed
🤖 refactor: move New Workspace to + icon on project row
- Rename sidebar header from "Agents" to "Projects" - Replace full-width "+ New Workspace" button with compact + icon - Icon always visible on project row (before secrets/remove) - Saves vertical real estate in sidebar - Expand projects by default in sidebar storybook stories
1 parent 4d1947a commit 92c492f

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

src/browser/components/ProjectSidebar.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,13 @@ const ProjectSidebarInner: React.FC<ProjectSidebarProps> = ({
471471
>
472472
{!collapsed && (
473473
<>
474-
<div className="border-dark flex items-center justify-between border-b p-4">
475-
<h2 className="text-foreground text-md m-0 font-semibold">Agents</h2>
474+
<div className="border-dark flex items-center justify-between border-b py-2 pl-4 pr-3">
475+
<h2 className="text-foreground text-md m-0 font-semibold">Projects</h2>
476476
<TooltipWrapper inline>
477477
<button
478478
onClick={onAddProject}
479479
aria-label="Add project"
480-
className="text-foreground hover:bg-hover hover:border-border-light flex h-6 w-6 cursor-pointer items-center justify-center rounded border border-transparent bg-transparent p-0 text-lg transition-all duration-200"
480+
className="text-muted-dark hover:text-foreground hover:bg-hover flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border-none bg-transparent text-lg transition-all duration-200"
481481
>
482482
+
483483
</button>
@@ -565,7 +565,7 @@ const ProjectSidebarInner: React.FC<ProjectSidebarProps> = ({
565565
}}
566566
aria-label={`Manage secrets for ${projectName}`}
567567
data-project-path={projectPath}
568-
className="text-muted-dark mr-1 flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border-none bg-transparent text-sm opacity-0 transition-all duration-200 hover:bg-yellow-500/10 hover:text-yellow-500"
568+
className="text-muted-dark flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border-none bg-transparent text-sm opacity-0 transition-all duration-200 hover:bg-yellow-500/10 hover:text-yellow-500"
569569
>
570570
<KeyRound size={12} />
571571
</button>
@@ -590,6 +590,24 @@ const ProjectSidebarInner: React.FC<ProjectSidebarProps> = ({
590590
Remove project
591591
</Tooltip>
592592
</TooltipWrapper>
593+
<TooltipWrapper inline>
594+
<button
595+
onClick={(event) => {
596+
event.stopPropagation();
597+
handleAddWorkspace(projectPath);
598+
}}
599+
aria-label={`Add workspace to ${projectName}`}
600+
data-project-path={projectPath}
601+
className="text-muted-dark hover:text-foreground hover:bg-hover flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border-none bg-transparent text-lg transition-all duration-200"
602+
>
603+
+
604+
</button>
605+
<Tooltip className="tooltip" align="right">
606+
New Workspace
607+
{selectedWorkspace?.projectPath === projectPath &&
608+
` (${formatKeybind(KEYBINDS.NEW_WORKSPACE)})`}
609+
</Tooltip>
610+
</TooltipWrapper>
593611
</DraggableProjectItem>
594612

595613
{isExpanded && (
@@ -598,18 +616,6 @@ const ProjectSidebarInner: React.FC<ProjectSidebarProps> = ({
598616
role="region"
599617
aria-label={`Workspaces for ${projectName}`}
600618
>
601-
<div className="border-hover border-b px-3 py-2">
602-
<button
603-
onClick={() => handleAddWorkspace(projectPath)}
604-
data-project-path={projectPath}
605-
aria-label={`Add workspace to ${projectName}`}
606-
className="text-muted border-border-medium hover:bg-hover hover:border-border-darker hover:text-foreground w-full cursor-pointer rounded border border-dashed bg-transparent px-3 py-1.5 text-left text-[13px] transition-all duration-200"
607-
>
608-
+ New Workspace
609-
{selectedWorkspace?.projectPath === projectPath &&
610-
` (${formatKeybind(KEYBINDS.NEW_WORKSPACE)})`}
611-
</button>
612-
</div>
613619
{(() => {
614620
const allWorkspaces =
615621
sortedWorkspacesByProject.get(projectPath) ?? [];

src/browser/stories/App.sidebar.stories.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const SingleProject: AppStory = {
7171
createWorkspace({ id: "ws-3", name: "bugfix/memory-leak", projectName: "my-app" }),
7272
];
7373

74+
expandProjects(["/home/user/projects/my-app"]);
7475
return createMockORPCClient({
7576
projects: groupWorkspacesByProject(workspaces),
7677
workspaces,
@@ -99,6 +100,11 @@ export const MultipleProjects: AppStory = {
99100
createWorkspace({ id: "ws-6", name: "main", projectName: "mobile" }),
100101
];
101102

103+
expandProjects([
104+
"/home/user/projects/frontend",
105+
"/home/user/projects/backend",
106+
"/home/user/projects/mobile",
107+
]);
102108
return createMockORPCClient({
103109
projects: groupWorkspacesByProject(workspaces),
104110
workspaces,
@@ -132,6 +138,7 @@ export const ManyWorkspaces: AppStory = {
132138
createWorkspace({ id: `ws-${i}`, name, projectName: "big-app" })
133139
);
134140

141+
expandProjects(["/home/user/projects/big-app"]);
135142
return createMockORPCClient({
136143
projects: groupWorkspacesByProject(workspaces),
137144
workspaces,
@@ -195,6 +202,7 @@ export const GitStatusVariations: AppStory = {
195202
["ws-ssh", { ahead: 1 }],
196203
]);
197204

205+
expandProjects(["/home/user/projects/my-app"]);
198206
return createMockORPCClient({
199207
projects: groupWorkspacesByProject(workspaces),
200208
workspaces,

0 commit comments

Comments
 (0)