Skip to content

Commit 1c554e2

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 1c554e2

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

src/browser/components/ProjectSidebar.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ const ProjectSidebarInner: React.FC<ProjectSidebarProps> = ({
472472
{!collapsed && (
473473
<>
474474
<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>
475+
<h2 className="text-foreground text-md m-0 font-semibold">Projects</h2>
476476
<TooltipWrapper inline>
477477
<button
478478
onClick={onAddProject}
@@ -557,6 +557,24 @@ const ProjectSidebarInner: React.FC<ProjectSidebarProps> = ({
557557
</Tooltip>
558558
</TooltipWrapper>
559559
</div>
560+
<TooltipWrapper inline>
561+
<button
562+
onClick={(event) => {
563+
event.stopPropagation();
564+
handleAddWorkspace(projectPath);
565+
}}
566+
aria-label={`Add workspace to ${projectName}`}
567+
data-project-path={projectPath}
568+
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"
569+
>
570+
+
571+
</button>
572+
<Tooltip className="tooltip" align="right">
573+
New Workspace
574+
{selectedWorkspace?.projectPath === projectPath &&
575+
` (${formatKeybind(KEYBINDS.NEW_WORKSPACE)})`}
576+
</Tooltip>
577+
</TooltipWrapper>
560578
<TooltipWrapper inline>
561579
<button
562580
onClick={(event) => {
@@ -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)