diff --git a/site/src/pages/AgentsPage/components/ChatsSidebar/ChatsSidebar.stories.tsx b/site/src/pages/AgentsPage/components/ChatsSidebar/ChatsSidebar.stories.tsx index 02500f7958a..039da529995 100644 --- a/site/src/pages/AgentsPage/components/ChatsSidebar/ChatsSidebar.stories.tsx +++ b/site/src/pages/AgentsPage/components/ChatsSidebar/ChatsSidebar.stories.tsx @@ -1752,6 +1752,33 @@ export const ActiveChatKebabPersistent: Story = { }, }; +export const ActiveChatContextMenuOpen: Story = { + args: { + chats: [ + buildChat({ + id: "active-context-menu", + title: "Active context menu chat", + updated_at: recentTimestamp, + }), + ], + }, + parameters: { + reactRouter: reactRouterParameters({ + location: { + path: "/agents/active-context-menu", + pathParams: { agentId: "active-context-menu" }, + }, + routing: agentsRouting, + }), + }, + play: async ({ canvasElement }) => { + fireEvent.contextMenu( + within(canvasElement).getByTestId("agents-tree-node-active-context-menu"), + ); + await within(document.body).findByText("Pin agent"); + }, +}; + export const WithUnreadChats: Story = { args: { chats: [ @@ -1848,6 +1875,33 @@ export const AgentWithWorkspaceMenuFull: Story = { }, }; +export const AgentWithWorkspaceContextMenuFull: Story = { + args: { + chats: [ + buildChat({ + id: "chat-with-context-menu", + title: "Agent with context menu", + workspace_id: "workspace-1", + updated_at: recentTimestamp, + }), + ], + }, + parameters: { + reactRouter: reactRouterParameters({ + location: { path: "/agents" }, + routing: agentsRouting, + }), + }, + play: async ({ canvasElement }) => { + fireEvent.contextMenu( + within(canvasElement).getByTestId( + "agents-tree-node-chat-with-context-menu", + ), + ); + await within(document.body).findByText("Pin agent"); + }, +}; + export const ArchiveActionsFollowChatStatus: Story = { args: { chats: [ diff --git a/site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx b/site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx index c1792da0e06..9b6ac10d2c0 100644 --- a/site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx +++ b/site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx @@ -155,10 +155,6 @@ export const ChatTreeNode: FC = ({ chat, depth = 0 }) => { hasSubagentsToggle: hasChildren, }); - const hoverLayout = - "[@media(hover:hover)]:hover:-mx-2 [@media(hover:hover)]:hover:pl-3 [@media(hover:hover)]:hover:pr-3.5 [@media(hover:hover)]:hover:rounded-none"; - const activeLayout = - "has-[[aria-current=page]]:-mx-2 has-[[aria-current=page]]:pl-[11px] has-[[aria-current=page]]:pr-3.5 has-[[aria-current=page]]:rounded-none has-[[aria-current=page]]:border-l has-[[aria-current=page]]:border-content-primary [@media(hover:hover)]:has-[[aria-current=page]]:hover:pl-[11px]"; const sharedMenuItemProps = { chat, canManage, @@ -189,11 +185,10 @@ export const ChatTreeNode: FC = ({ chat, depth = 0 }) => {
= ({ chat, depth = 0 }) => { className={cn( "block flex-1 truncate text-[13px] text-content-primary", !isActive && - "opacity-85 [@media(hover:hover)]:group-hover:opacity-100", + "opacity-85 [@media(hover:hover)]:group-hover:opacity-100 group-data-[state=open]:opacity-100 group-has-data-[state=open]:opacity-100", )} > {chat.title} @@ -311,10 +306,10 @@ export const ChatTreeNode: FC = ({ chat, depth = 0 }) => { className={cn( "flex items-center justify-end text-xs text-content-secondary/50 tabular-nums", // The timestamp swaps out for the actions trigger on - // hover; without menu actions there is no trigger, so - // keep the timestamp visible. + // hover or while a menu is open. Without menu actions, + // there is no trigger, so keep the timestamp visible. hasMenuActions && - "[@media(hover:hover)]:group-hover:hidden group-has-data-[state=open]:hidden", + "[@media(hover:hover)]:group-hover:hidden group-data-[state=open]:hidden group-has-data-[state=open]:hidden", hasMenuActions && isActiveChat && "hidden", )} > @@ -353,7 +348,7 @@ export const ChatTreeNode: FC = ({ chat, depth = 0 }) => { size="icon" variant="subtle" className={cn( - "absolute inset-0 flex h-6 w-7 min-w-0 justify-end rounded-none px-0 opacity-0 text-content-secondary hover:text-content-primary [@media(hover:hover)]:group-hover:opacity-100 data-[state=open]:opacity-100", + "absolute inset-0 flex h-6 w-7 min-w-0 justify-end rounded-none px-0 opacity-0 text-content-secondary hover:text-content-primary [@media(hover:hover)]:group-hover:opacity-100 data-[state=open]:opacity-100 group-data-[state=open]:opacity-100", isActiveChat && "opacity-100", )} aria-label={`Open actions for ${chat.title}`}