From cb1c4360d97fb0d44f795c6c7531af7057292464 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Fri, 12 Jun 2026 10:25:41 +0800 Subject: [PATCH] feat(sidebar): add Open Folder and Clone Repository actions to the Folders header Surface the two "add a folder" actions as hover-revealed buttons on the left-sidebar Folders section header, reusing the existing open-folder and clone dialogs. - Use the FolderOpenDot and FolderGit2 icons for Open Folder and Clone Repository across the section header, the new-folder dropdown, and the empty-workspace buttons and context menu - Align every sidebar right-edge hover affordance (section headers, folder headers, conversation cards, and the New chat / Search badges) to a uniform 0.75rem inset, with h-6 action buttons whose icons flush to that edge so the icons line up with the badges - Add unit tests for the section-header actions --- .../sidebar-conversation-card.tsx | 16 ++- .../sidebar-conversation-list.test.tsx | 4 +- .../sidebar-conversation-list.tsx | 37 +++-- .../sidebar-section-header.test.tsx | 132 ++++++++++++++++++ .../conversations/sidebar-section-header.tsx | 101 ++++++++++++-- src/components/layout/new-folder-dropdown.tsx | 6 +- 6 files changed, 265 insertions(+), 31 deletions(-) create mode 100644 src/components/conversations/sidebar-section-header.test.tsx diff --git a/src/components/conversations/sidebar-conversation-card.tsx b/src/components/conversations/sidebar-conversation-card.tsx index 4f6f9900f..0a7bccb99 100644 --- a/src/components/conversations/sidebar-conversation-card.tsx +++ b/src/components/conversations/sidebar-conversation-card.tsx @@ -219,7 +219,12 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({ clicks don't select the conversation; `tabIndex={-1}` keeps them mouse-only (the context menu Pin/Unpin + Status is the keyboard/ AT-accessible path). */} -
+ {/* pr-[0.375rem] + the list's px-1.5 (0.375rem) puts the time + badge / hover action buttons at a uniform 0.75rem inset from the + sidebar border — the same right edge as the section-header + actions, folder-header actions, and New chat / Search shortcut + badges. */} +
{isRunning ? ( {onTogglePin && ( )} + {showFolderActions && ( +
+ {onCloneRepository != null && ( + + )} + {onOpenFolder != null && ( + + )} +
+ )}
) diff --git a/src/components/layout/new-folder-dropdown.tsx b/src/components/layout/new-folder-dropdown.tsx index 7c59984da..c25e75981 100644 --- a/src/components/layout/new-folder-dropdown.tsx +++ b/src/components/layout/new-folder-dropdown.tsx @@ -1,7 +1,7 @@ "use client" import { useState } from "react" -import { FolderOpen, FolderPlus, GitBranch, Rocket } from "lucide-react" +import { FolderGit2, FolderOpenDot, FolderPlus, Rocket } from "lucide-react" import { useTranslations } from "next-intl" import { DropdownMenu, @@ -57,11 +57,11 @@ export function NewFolderDropdown() { - + {t("openFolder")} setCloneOpen(true)}> - + {t("cloneRepository")} openProjectBootWindow()}>