Skip to content

Commit 08470d6

Browse files
fix(web): move the subagent collapse toggle to the count badge
1 parent b87b4c3 commit 08470d6

1 file changed

Lines changed: 23 additions & 27 deletions

File tree

‎apps/web/src/components/LegacySidebar.tsx‎

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
584584
},
585585
[threadKey, toggleSubagentParentExpanded],
586586
);
587-
// The row div also navigates on Enter/Space; the chevron activates itself,
588-
// so its key events must not bubble into the row.
587+
// The row div also navigates on Enter/Space; the subagent badge activates
588+
// itself, so its key events must not bubble into the row.
589589
const handleSubagentToggleKeyDown = useCallback(
590590
(event: React.KeyboardEvent<HTMLButtonElement>) => {
591591
if (event.key === "Enter" || event.key === " ") {
@@ -791,28 +791,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
791791
onKeyDown={handleRowKeyDown}
792792
onContextMenu={handleRowContextMenu}
793793
>
794-
{subagentChildCount > 0 ? (
795-
<button
796-
type="button"
797-
data-thread-selection-safe
798-
aria-expanded={subagentChildrenExpanded}
799-
aria-label={
800-
subagentChildrenExpanded
801-
? `Hide subagent threads for ${thread.title}`
802-
: `Show subagent threads for ${thread.title}`
803-
}
804-
className="flex h-6 w-4 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/70 outline-hidden hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
805-
onPointerDown={stopPropagationOnPointerDown}
806-
onKeyDown={handleSubagentToggleKeyDown}
807-
onClick={handleSubagentToggleClick}
808-
>
809-
<ChevronRightIcon
810-
className={`size-3 shrink-0 transition-transform duration-150 ${
811-
subagentChildrenExpanded ? "rotate-90" : ""
812-
}`}
813-
/>
814-
</button>
815-
) : null}
816794
<div className="flex min-w-0 flex-1 items-center gap-1.5 text-left">
817795
{prStatus && pr && (
818796
<Tooltip>
@@ -886,10 +864,28 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
886864
<TooltipPopup side="top">{thread.title}</TooltipPopup>
887865
</Tooltip>
888866
)}
889-
{subagentChildCount > 0 && !subagentChildrenExpanded ? (
890-
<span className="shrink-0 text-3xs text-secondary-label">
867+
{subagentChildCount > 0 ? (
868+
<button
869+
type="button"
870+
data-thread-selection-safe
871+
aria-expanded={subagentChildrenExpanded}
872+
aria-label={
873+
subagentChildrenExpanded
874+
? `Hide ${subagentChildCount} subagent threads for ${thread.title}`
875+
: `Show ${subagentChildCount} subagent threads for ${thread.title}`
876+
}
877+
className="flex shrink-0 cursor-pointer items-center gap-0.5 rounded-sm px-0.5 text-3xs text-secondary-label outline-hidden hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
878+
onPointerDown={stopPropagationOnPointerDown}
879+
onKeyDown={handleSubagentToggleKeyDown}
880+
onClick={handleSubagentToggleClick}
881+
>
882+
<ChevronRightIcon
883+
className={`size-2.5 shrink-0 transition-transform duration-150 ${
884+
subagentChildrenExpanded ? "rotate-90" : ""
885+
}`}
886+
/>
891887
{subagentChildCount} subagent{subagentChildCount === 1 ? "" : "s"}
892-
</span>
888+
</button>
893889
) : null}
894890
</div>
895891
<div className="ml-auto flex shrink-0 items-center gap-1.5">

0 commit comments

Comments
 (0)