From 022319e23289398e404cecd9a5aef1e3401e966c Mon Sep 17 00:00:00 2001 From: Trae User Date: Tue, 22 Sep 2026 22:55:24 +0800 Subject: [PATCH 1/6] fix: refine sidebar alignment and vertical rhythm - Center nav, workspace and session leading icons instead of left-aligning them so the 24px slots share one optical baseline. - Replace the fixed 76px trailing column with `auto` and drop the fixed width on count/time slots, so rows no longer reserve dead space. - Move the section disclosure arrow next to the section title and keep it always visible; the header becomes a single full-width button with pt-3/pb-1 padding instead of the previous group-hover reveal. - Rebuild the collapsed arrow rotation from -90deg to 0deg. - Tighten row padding, list gaps and the brand row spacing; update sidebarAlignmentArchitecture.test.js to assert the new contract. --- web/src/components/Sidebar.jsx | 80 +++++++++---------- web/src/components/SidebarQuickMenu.jsx | 2 +- .../lib/sidebarAlignmentArchitecture.test.js | 50 +++++++----- 3 files changed, 72 insertions(+), 60 deletions(-) diff --git a/web/src/components/Sidebar.jsx b/web/src/components/Sidebar.jsx index 1e0aa9c7b..305bf3490 100644 --- a/web/src/components/Sidebar.jsx +++ b/web/src/components/Sidebar.jsx @@ -495,7 +495,7 @@ function SidebarDisclosure({ expanded, className = '' }) { name={icon.name} size={icon.size} className={clsx('block shrink-0 transition-transform', className)} - style={{ transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)' }} + style={{ transform: expanded ? 'rotate(0deg)' : 'rotate(-90deg)' }} /> ); } @@ -512,9 +512,9 @@ function SidebarNavItem({ item, onClick }) { data-tour-target={item.id === 'new-task' ? 'sidebar-new-task' : undefined} onPointerDown={item.id === 'new-task' ? preserveHomeComposerFocus : undefined} onClick={onClick} - className="ace-sidebar-primary-text w-full flex items-center gap-[7px] pl-[19px] pr-3 h-8 rounded-md text-[14px] text-fg hover:bg-surface-hi transition text-left" + className="ace-sidebar-primary-text w-full flex items-center gap-[7px] pl-[19px] pr-[13px] py-[3px] rounded-md text-[14px] text-fg hover:bg-surface-hi transition text-left" > - + {item.label} @@ -541,14 +541,14 @@ function CustomSidebarItem({ item, count, onClick }) { type="button" onClick={onClick} data-sidebar-custom-item={item.id} - className="ace-sidebar-primary-text w-full flex items-center gap-[7px] pl-[19px] pr-3 h-8 text-[14px] text-fg hover:bg-surface-hi transition text-left" + className="ace-sidebar-primary-text w-full flex items-center gap-[7px] pl-[19px] pr-[13px] py-[3px] text-[14px] text-fg hover:bg-surface-hi transition text-left" > - + {item.label} {Number.isFinite(count) && ( - {count} + {count} )} ); @@ -597,23 +597,23 @@ function CustomSidebarSection({ workspaceHash = '', onOpenSettingsSection, onOpe type="button" onClick={() => setExpanded((value) => !value)} data-sidebar-custom-section="true" - className="ace-sidebar-extensions-trigger ace-sidebar-primary-text w-full flex items-center gap-[7px] pl-[19px] pr-3 h-8 rounded-md text-[14px] text-fg hover:bg-surface-hi transition" + className="ace-sidebar-extensions-trigger ace-sidebar-primary-text w-full flex items-center gap-[7px] pl-[19px] pr-[13px] py-[3px] rounded-md text-[14px] text-fg hover:bg-surface-hi transition" aria-expanded={expanded} aria-controls={listId} > - + 扩展 {totalCount != null && ( - {totalCount} + {totalCount} )} {expanded && ( -
+
{SIDEBAR_CUSTOM_ITEMS.map((item) => ( {actions && ( @@ -1142,7 +1142,7 @@ function SessionRow({ data-sidebar-workspace-session-workspace={workspaceReorderable ? workspaceHash || undefined : undefined} aria-describedby={hoverCardVisible ? hoverCardId : undefined} className={clsx( - 'ace-sidebar-session-row ace-sidebar-tree-row-grid ace-sidebar-primary-text group grid h-8 grid-cols-[24px_minmax(0,1fr)_76px] items-center gap-x-[7px] mx-1.5 pl-[13px] pr-2 rounded-md text-[14px] transition', + 'ace-sidebar-session-row ace-sidebar-tree-row-grid ace-sidebar-primary-text group grid grid-cols-[24px_minmax(0,1fr)_auto] items-center gap-x-[7px] ml-1.5 mr-0 my-px pl-[13px] pr-[1px] rounded-md text-[14px] transition', pinned && 'ace-sidebar-pinned-session-row', workspaceReorderable && 'ace-sidebar-workspace-session-row', dragging && 'is-dragging', @@ -1221,7 +1221,7 @@ function SessionRow({ onAnimationEnd={() => finishRemoteControlSurge(activeRemoteControlSurgeSequenceRef.current)} /> )} - + {editing ? ( @@ -1265,7 +1265,7 @@ function SessionRow({ )} - + {!editing && pendingPermission ? ( ) : null} {showSessionTime && !editing && !pendingPermission && !pendingQuestion && ( - + {relativeTime(s.updated_at || s.created_at)} )} @@ -1298,7 +1298,7 @@ function SessionRow({ onTogglePin?.(s, !pinned); }} className={clsx( - 'ace-session-pin-btn ace-sidebar-row-hover-action w-5 h-7 rounded items-center justify-center shrink-0 transition', + 'ace-session-pin-btn ace-sidebar-row-hover-action w-[18px] h-7 rounded items-center justify-center shrink-0 transition', pinned ? 'flex text-accent' : 'hidden group-hover:flex group-focus-within:flex text-fg-mute hover:text-fg hover:bg-surface-hi', @@ -1318,7 +1318,7 @@ function SessionRow({ onArchive?.(s); }} className={clsx( - 'ace-sidebar-row-hover-action w-5 h-7 rounded items-center justify-center shrink-0 text-fg-mute hover:text-fg hover:bg-surface-hi transition', + 'ace-sidebar-row-hover-action w-[18px] h-7 rounded items-center justify-center shrink-0 text-fg-mute hover:text-fg hover:bg-surface-hi transition', sessionMarker ? 'flex' : 'hidden group-hover:flex group-focus-within:flex', @@ -1669,7 +1669,7 @@ function WorkspaceGroup({ data-desktop-workspace-opencode-import-count={opencodeImportCount > 0 ? String(opencodeImportCount) : undefined} data-folder-reorderable={folderReorderable && !editing ? 'true' : undefined} className={clsx( - 'ace-sidebar-workspace-row ace-sidebar-tree-row-grid ace-sidebar-primary-text group grid h-8 grid-cols-[24px_minmax(0,1fr)_76px] items-center gap-x-[7px] mx-1.5 pl-[13px] pr-2 rounded-md text-[14px] cursor-pointer transition', + 'ace-sidebar-workspace-row ace-sidebar-tree-row-grid ace-sidebar-primary-text group grid grid-cols-[24px_minmax(0,1fr)_auto] items-center gap-x-[7px] mx-1.5 pl-[13px] pr-[14px] py-[3px] rounded-md text-[14px] cursor-pointer transition', ws.active ? 'bg-accent-bg text-fg' : 'text-fg hover:bg-surface-hi', )} role="button" @@ -1690,7 +1690,7 @@ function WorkspaceGroup({ } }} > - + {editing ? ( @@ -1733,9 +1733,9 @@ function WorkspaceGroup({
{expanded && ( -
+
{sessions.length === 0 ? ( -
+
@@ -1765,7 +1765,7 @@ function WorkspaceGroup({ ); })} {projectedSessions.collapsible && ( -
+