11/** @jsxImportSource react */
22import * as React from "react" ;
33import {
4- ChevronDown ,
54 ChevronRight ,
65 Loader2 ,
76 MoreHorizontal ,
@@ -100,13 +99,13 @@ function SessionActions({ className, sessionId }: SessionActionsProps) {
10099 < DropdownMenuContent align = "end" side = "bottom" sideOffset = { 4 } alignOffset = { - 4 } className = "w-56" >
101100 { ctx . onOpenRenameSession ? (
102101 < DropdownMenuItem onClick = { ( ) => ctx . onOpenRenameSession ?.( sessionId ) } >
103- < Pencil size = { 14 } />
102+ < Pencil className = "size-4" />
104103 { t ( "workspace_list.rename_session" ) }
105104 </ DropdownMenuItem >
106105 ) : null }
107106 { ctx . onOpenDeleteSession ? (
108107 < DropdownMenuItem variant = "destructive" onClick = { ( ) => ctx . onOpenDeleteSession ?.( sessionId ) } >
109- < Trash2 size = { 14 } />
108+ < Trash2 className = "size-4" />
110109 { t ( "workspace_list.delete_session" ) }
111110 </ DropdownMenuItem >
112111 ) : null }
@@ -134,13 +133,13 @@ function SessionContextMenu({ children, sessionId }: SessionContextMenuProps) {
134133 < ContextMenuContent className = "w-56" >
135134 { ctx . onOpenRenameSession ? (
136135 < ContextMenuItem onClick = { ( ) => ctx . onOpenRenameSession ?.( sessionId ) } >
137- < Pencil size = { 14 } />
136+ < Pencil className = "size-4" />
138137 { t ( "workspace_list.rename_session" ) }
139138 </ ContextMenuItem >
140139 ) : null }
141140 { ctx . onOpenDeleteSession ? (
142141 < ContextMenuItem variant = "destructive" onClick = { ( ) => ctx . onOpenDeleteSession ?.( sessionId ) } >
143- < Trash2 size = { 14 } />
142+ < Trash2 className = "size-4" />
144143 { t ( "workspace_list.delete_session" ) }
145144 </ ContextMenuItem >
146145 ) : null }
@@ -172,22 +171,22 @@ function WorkspaceActionsMenu({ workspace, isConnectionActionBusy, canRecover, c
172171 } }
173172 aria-label = { t ( "workspace_list.workspace_options" ) }
174173 >
175- < MoreHorizontal size = { 14 } />
174+ < MoreHorizontal className = "size-4" />
176175 </ Button >
177176 }
178177 />
179178 < DropdownMenuContent align = "end" side = "bottom" sideOffset = { 4 } className = "w-56" >
180179 < DropdownMenuItem onClick = { ( ) => ctx . onOpenRenameWorkspace ( workspace . id ) } >
181- < Pencil size = { 14 } />
180+ < Pencil className = "size-4" />
182181 { t ( "workspace_list.edit_name" ) }
183182 </ DropdownMenuItem >
184183 < DropdownMenuItem onClick = { ( ) => ctx . onShareWorkspace ( workspace . id ) } >
185- < Share2 size = { 14 } />
184+ < Share2 className = "size-4" />
186185 { t ( "workspace_list.share" ) }
187186 </ DropdownMenuItem >
188187 { workspace . workspaceType === "local" ? (
189188 < DropdownMenuItem onClick = { ( ) => ctx . onRevealWorkspace ( workspace . id ) } >
190- < FolderOpen size = { 14 } />
189+ < FolderOpen className = "size-4" />
191190 { isWindowsPlatform ( ) ? t ( "workspace_list.reveal_explorer" ) : t ( "workspace_list.reveal_finder" ) }
192191 </ DropdownMenuItem >
193192 ) : null }
@@ -198,22 +197,22 @@ function WorkspaceActionsMenu({ workspace, isConnectionActionBusy, canRecover, c
198197 onClick = { ( ) => void Promise . resolve ( ctx . onRecoverWorkspace ( workspace . id ) ) }
199198 disabled = { isConnectionActionBusy }
200199 >
201- < RefreshCw size = { 14 } />
200+ < RefreshCw className = "size-4" />
202201 { t ( "workspace_list.recover" ) }
203202 </ DropdownMenuItem >
204203 ) : null }
205204 < DropdownMenuItem
206205 onClick = { ( ) => void Promise . resolve ( ctx . onTestWorkspaceConnection ( workspace . id ) ) }
207206 disabled = { isConnectionActionBusy }
208207 >
209- < RefreshCw size = { 14 } />
208+ < RefreshCw className = "size-4" />
210209 { t ( "workspace_list.test_connection" ) }
211210 </ DropdownMenuItem >
212211 < DropdownMenuItem
213212 onClick = { ( ) => ctx . onEditWorkspaceConnection ( workspace . id ) }
214213 disabled = { isConnectionActionBusy }
215214 >
216- < Settings size = { 14 } />
215+ < Settings className = "size-4" />
217216 { t ( "workspace_list.edit_connection" ) }
218217 </ DropdownMenuItem >
219218 </ >
@@ -223,7 +222,7 @@ function WorkspaceActionsMenu({ workspace, isConnectionActionBusy, canRecover, c
223222 variant = "destructive"
224223 onClick = { ( ) => ctx . onForgetWorkspace ( workspace . id ) }
225224 >
226- < Trash2 size = { 14 } />
225+ < Trash2 className = "size-4" />
227226 { t ( "workspace_list.remove_workspace" ) }
228227 </ DropdownMenuItem >
229228 </ DropdownMenuContent >
@@ -416,7 +415,7 @@ export function AppSidebar(props: AppSidebarProps) {
416415 < SidebarMenu >
417416 < SidebarMenuItem >
418417 < SidebarMenuButton onClick = { props . onOpenCreateWorkspace } >
419- < Plus size = { 14 } />
418+ < Plus className = "size-4" />
420419 { t ( "workspace_list.add_workspace" ) }
421420 </ SidebarMenuButton >
422421 </ SidebarMenuItem >
@@ -459,18 +458,23 @@ function WorkspaceHeader({
459458 return (
460459 < SidebarMenuButton
461460 { ...props }
462- className = "h-8 group-hover/workspace-header:bg-sidebar-accent group-hover/workspace-header:text-sidebar-accent-foreground mac:group-hover/workspace-header:bg-black/5 dark:mac:group-hover/workspace-header:bg-white/10"
461+ className = { cn ( "h-8 group-hover/workspace-header:bg-sidebar-accent group-hover/workspace-header:text-sidebar-accent-foreground mac:group-hover/workspace-header:bg-black/5 dark:mac:group-hover/workspace-header:bg-white/10" , statusLabel && "h-10" ) }
463462 onClick = { ( event ) => {
464463 onClick ?.( event ) ;
465464 handleSelectWorkspace ( ) ;
466465 } }
467466 >
468467 < div
469- className = "flex size-5 shrink-0 items-center justify-center rounded-full"
468+ className = "flex size-4 shrink-0 items-center justify-center rounded-full"
470469 style = { { backgroundColor : workspaceSwatchColor ( workspace . id || workspaceLabel ( workspace ) ) } }
471470 />
472- < div className = "min-w-0 flex-1" >
473- < span className = "block truncate font-medium" > { workspaceLabel ( workspace ) } </ span >
471+ < div
472+ className = { cn (
473+ "min-w-0 flex-1 transition-[padding] duration-75 group-hover/menu-item:pr-12 group-focus-within/menu-item:pr-12 group-hover/workspace-header:pr-12 group-focus-within/workspace-header:pr-12" ,
474+ isLoading && "pr-6" ,
475+ ) }
476+ >
477+ < span className = "block truncate" > { workspaceLabel ( workspace ) } </ span >
474478 { statusLabel ? (
475479 < span className = { `block text-xs ${ isError ? "text-destructive" : "text-muted-foreground" } ` } >
476480 { statusLabel }
@@ -479,9 +483,9 @@ function WorkspaceHeader({
479483 </ div >
480484 < span className = "ml-auto flex items-center gap-1 pl-0" >
481485 { isLoading ? (
482- < Loader2 size = { 14 } className = "animate-spin text-muted-foreground" />
486+ < Loader2 className = "size-4 animate-spin text-muted-foreground transition-opacity group-hover/menu-item:opacity-0 group-hover/workspace-header:opacity-0 " />
483487 ) : null }
484- < ChevronRight size = { 14 } className = "text-muted-foreground transition-transform duration-200 group-data-open/collapsible:rotate-90 hover:text-foreground" />
488+ < ChevronRight className = "size-4 text-muted-foreground transition-transform duration-200 group-data-open/collapsible:rotate-90 hover:text-foreground" />
485489 </ span >
486490 </ SidebarMenuButton >
487491 ) ;
@@ -570,26 +574,26 @@ function WorkspaceSidebarGroup({
570574 />
571575 }
572576 />
573- < div className = "absolute right-8 top-1 flex items-center gap-1" >
574- < Button
575- variant = "ghost"
576- size = "icon"
577- className = "size-6 text-muted-foreground opacity-0 group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100"
578- onClick = { ( e ) => {
579- e . stopPropagation ( ) ;
580- ctx . onCreateTaskInWorkspace ( workspace . id ) ;
581- } }
582- disabled = { ctx . newTaskDisabled }
583- aria-label = { t ( "session.new_task" ) }
584- >
585- < Plus size = { 14 } />
586- </ Button >
587- < WorkspaceActionsMenu
588- workspace = { workspace }
589- isConnectionActionBusy = { isConnectionActionBusy }
590- canRecover = { canRecover }
591- className = "size-6 text-muted-foreground opacity-0 group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-popup-open:opacity-100"
592- />
577+ < div className = "absolute right-8 top-1/2 flex -translate-y-1/2 items-center gap-1" >
578+ < Button
579+ variant = "ghost"
580+ size = "icon"
581+ className = "size-6 text-muted-foreground opacity-0 group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100"
582+ onClick = { ( e ) => {
583+ e . stopPropagation ( ) ;
584+ ctx . onCreateTaskInWorkspace ( workspace . id ) ;
585+ } }
586+ disabled = { ctx . newTaskDisabled }
587+ aria-label = { t ( "session.new_task" ) }
588+ >
589+ < Plus className = "size-4" />
590+ </ Button >
591+ < WorkspaceActionsMenu
592+ workspace = { workspace }
593+ isConnectionActionBusy = { isConnectionActionBusy }
594+ canRecover = { canRecover }
595+ className = "size-6 text-muted-foreground opacity-0 group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-popup-open:opacity-100"
596+ />
593597 </ div >
594598 </ div >
595599
@@ -605,8 +609,8 @@ function WorkspaceSidebarGroup({
605609 </ >
606610 ) : group . status === "loading" && group . sessions . length === 0 ? (
607611 < SidebarMenuSubItem >
608- < SidebarMenuSubButton aria-disabled className = "text-muted-foreground text-xs" >
609- { t ( "workspace.loading_tasks" ) }
612+ < SidebarMenuSubButton aria-disabled className = "text-muted-foreground text-xs truncate " >
613+ < span className = "truncate" > { t ( "workspace.loading_tasks" ) } </ span >
610614 </ SidebarMenuSubButton >
611615 </ SidebarMenuSubItem >
612616 ) : group . sessions . length > 0 ? (
@@ -615,6 +619,7 @@ function WorkspaceSidebarGroup({
615619 < SessionMenuItem
616620 key = { row . session . id }
617621 session = { row . session }
622+ depth = { row . depth }
618623 tree = { tree }
619624 workspaceId = { workspace . id }
620625 forcedExpandedSessionIds = { forcedExpandedSessionIds }
@@ -626,7 +631,7 @@ function WorkspaceSidebarGroup({
626631 className = "text-muted-foreground text-xs"
627632 onClick = { ( ) => showMoreSessions ( workspace . id , rootSessions . length ) }
628633 >
629- { showMoreLabel }
634+ < span className = "truncate" > { showMoreLabel } </ span >
630635 </ SidebarMenuSubButton >
631636 </ SidebarMenuSubItem >
632637 ) : null }
@@ -635,9 +640,9 @@ function WorkspaceSidebarGroup({
635640 < SidebarMenuSubItem >
636641 < SidebarMenuSubButton
637642 aria-disabled
638- className = { taskLoadError . tone === "offline" ? "text-amber-600" : "text-destructive" }
643+ className = { cn ( "text-xs" , taskLoadError . tone === "offline" ? "text-amber-600" : "text-destructive" ) }
639644 >
640- { taskLoadError . message }
645+ < span className = "truncate" > { taskLoadError . message } </ span >
641646 </ SidebarMenuSubButton >
642647 </ SidebarMenuSubItem >
643648 ) : (
@@ -647,7 +652,7 @@ function WorkspaceSidebarGroup({
647652 onClick = { ( ) => ctx . onCreateTaskInWorkspace ( workspace . id ) }
648653 aria-disabled = { ctx . newTaskDisabled }
649654 >
650- { t ( "workspace.no_tasks" ) }
655+ < span className = "truncate" > { t ( "workspace.no_tasks" ) } </ span >
651656 </ SidebarMenuSubButton >
652657 </ SidebarMenuSubItem >
653658 ) }
@@ -662,12 +667,13 @@ function WorkspaceSidebarGroup({
662667
663668type SessionMenuItemProps = {
664669 session : SessionListItem ;
670+ depth : number ;
665671 tree : SessionTreeState ;
666672 workspaceId : string ;
667673 forcedExpandedSessionIds : Set < string > ;
668674} ;
669675
670- function SessionMenuItem ( { session, tree, workspaceId, forcedExpandedSessionIds } : SessionMenuItemProps ) {
676+ function SessionMenuItem ( { session, tree, workspaceId, forcedExpandedSessionIds, depth } : SessionMenuItemProps ) {
671677 const ctx = useSidebarContext ( ) ;
672678 const isSelected = ctx . selectedSessionId === session . id ;
673679 const displayTitle = getDisplaySessionTitle ( session . title ) ;
@@ -689,38 +695,39 @@ function SessionMenuItem({ session, tree, workspaceId, forcedExpandedSessionIds
689695
690696 if ( hasChildren ) {
691697 return (
692- < Collapsible open = { isExpanded } onOpenChange = { ( ) => ctx . toggleSessionExpanded ( session . id ) } >
698+ < Collapsible
699+ open = { isExpanded }
700+ onOpenChange = { ( ) => ctx . toggleSessionExpanded ( session . id ) }
701+ className = "group/session-collapsible"
702+ >
693703 < SidebarMenuSubItem >
694- < div className = "flex min-w-0 items-center gap-1" >
704+ < SessionContextMenu sessionId = { session . id } >
695705 < CollapsibleTrigger
696706 render = {
697- < Button
698- variant = "ghost"
699- size = "icon"
700- className = "size-7 shrink-0"
701- aria-label = { isExpanded ? t ( "sidebar.collapse" ) : t ( "sidebar.expand" ) }
707+ < SidebarMenuSubButton
708+ className = { cn ( depth > 0 && "ps-13" ) }
709+ isActive = { isSelected }
710+ onClick = { openSession }
711+ onPointerEnter = { prefetchSession }
712+ onFocus = { prefetchSession }
702713 >
703- { isExpanded ? < ChevronDown size = { 14 } /> : < ChevronRight size = { 14 } /> }
704- </ Button >
714+ { isSessionActive ? < span className = "size-1.5 shrink-0 rounded-full bg-amber-500" /> : null }
715+ < span
716+ className = "min-w-0 flex-1 truncate transition-[padding] duration-75 group-hover/menu-sub-item:pe-5 group-focus-within/menu-sub-item:pe-5"
717+ title = { displayTitle }
718+ >
719+ { displayTitle }
720+ </ span >
721+ < span className = "ml-auto flex shrink-0 items-center pl-0" >
722+ < ChevronRight className = "size-4 text-muted-foreground transition-transform duration-200 group-data-open/session-collapsible:rotate-90 hover:text-foreground" />
723+ </ span >
724+ </ SidebarMenuSubButton >
705725 }
706726 />
707- < SessionContextMenu sessionId = { session . id } >
708- < SidebarMenuSubButton
709- isActive = { isSelected }
710- onClick = { openSession }
711- onPointerEnter = { prefetchSession }
712- onFocus = { prefetchSession }
713- >
714- { isSessionActive ? < span className = "size-1.5 shrink-0 rounded-full bg-amber-500" /> : null }
715- < span className = "truncate" title = { displayTitle } >
716- { displayTitle }
717- </ span >
718- </ SidebarMenuSubButton >
719- </ SessionContextMenu >
720- </ div >
727+ </ SessionContextMenu >
721728 < SessionActions
722729 sessionId = { session . id }
723- className = "absolute right-3 top-1.5 opacity-0 group-hover/menu-sub-item:opacity-100 data-popup-open:opacity-100"
730+ className = "absolute right-9 top-1/2 -translate-y-1/2 opacity-0 group-hover/menu-sub-item:opacity-100 data-popup-open:opacity-100"
724731 />
725732 </ SidebarMenuSubItem >
726733 </ Collapsible >
@@ -730,14 +737,20 @@ function SessionMenuItem({ session, tree, workspaceId, forcedExpandedSessionIds
730737 return (
731738 < SidebarMenuSubItem >
732739 < SessionContextMenu sessionId = { session . id } >
733- < SidebarMenuSubButton isActive = { isSelected } onClick = { openSession } onPointerEnter = { prefetchSession } onFocus = { prefetchSession } >
740+ < SidebarMenuSubButton
741+ isActive = { isSelected }
742+ onClick = { openSession }
743+ onPointerEnter = { prefetchSession }
744+ onFocus = { prefetchSession }
745+ className = { cn ( "transition-[padding] duration-75 group-hover/menu-sub-item:pe-8 group-focus-within/menu-sub-item:pe-8" , depth > 0 && "ps-13" ) }
746+ >
734747 { isSessionActive ? < span className = "size-1.5 shrink-0 rounded-full bg-amber-500" /> : null }
735748 < span className = "truncate" title = { displayTitle } > { displayTitle } </ span >
736749 </ SidebarMenuSubButton >
737750 </ SessionContextMenu >
738751 < SessionActions
739752 sessionId = { session . id }
740- className = "absolute right-3 top-1.5 opacity-0 group-hover/menu-sub-item:opacity-100 data-popup-open:opacity-100"
753+ className = "absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover/menu-sub-item:opacity-100 data-popup-open:opacity-100"
741754 />
742755 </ SidebarMenuSubItem >
743756 ) ;
0 commit comments