🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(topic): polish the inline archive button on topic rows (#21634)
AmAzing-0c7db65a24ce
diff --git a/src/features/AgentSidebar/Topic/List/Item/index.test.tsx b/src/features/AgentSidebar/Topic/List/Item/index.test.tsxindex bd171ce618f..d736bbdea6e 100644--- a/src/features/AgentSidebar/Topic/List/Item/index.test.tsx+++ b/src/features/AgentSidebar/Topic/List/Item/index.test.tsx@@ -52,6 +52,7 @@ vi.mock('../../useScopedTopics', () => ({ useScopedTopic: () => scopedTopicMock.vi.mock('@/const/version', () => ({ isDesktop: false }));vi.mock('@/features/NavPanel/components/NavItem', () => ({default: ({+ actions,active,description,extra,@@ -59,6 +60,7 @@ vi.mock('@/features/NavPanel/components/NavItem', () => ({icon,title,}: {+ actions?: ReactNode | (() => ReactNode);active?: boolean;description?: ReactNode;extra?: ReactNode;@@ -71,6 +73,7 @@ vi.mock('@/features/NavPanel/components/NavItem', () => ({{title}{description}{extra}+ {typeof actions === 'function' ? actions() : actions}</div>),}));@@ -164,7 +167,9 @@ vi.mock('./metaCardData', () => {};});vi.mock('./Actions', () => ({- default: () => null,+ default: ({ showInlineArchive }: { showInlineArchive?: boolean }) => (+ <div data-show-inline-archive={String(!!showInlineArchive)} data-testid="topic-actions" />+ ),}));vi.mock('./useDropdownMenu', () => ({useTopicItemDropdownMenu: () => ({ dropdownMenu: [] }),@@ -421,6 +426,35 @@ describe('TopicItem active state', () => {expect(screen.queryByText('02:37')).not.toBeInTheDocument();});+ it('hides the inline archive action while the topic is running', () => {+ useTopicNavigationMock.mockReturnValue({+ isInAgentSubRoute: false,+ isInTopicContextRoute: false,+ navigateToTopic: vi.fn(),+ routeTopicId: undefined,+ });++ render(<TopicItem id="tpc_test" status="running" title="Topic" />);++ expect(screen.getByTestId('topic-actions')).toHaveAttribute(+ 'data-show-inline-archive',+ 'false',+ );+ });++ it('offers the inline archive action once the topic is idle', () => {+ useTopicNavigationMock.mockReturnValue({+ isInAgentSubRoute: false,+ isInTopicContextRoute: false,+ navigateToTopic: vi.fn(),+ routeTopicId: undefined,+ });++ render(<TopicItem id="tpc_test" title="Topic" />);++ expect(screen.getByTestId('topic-actions')).toHaveAttribute('data-show-inline-archive', 'true');+ });+it('keeps idle topics iconless', () => {useTopicNavigationMock.mockReturnValue({isInAgentSubRoute: false,diff --git a/src/features/AgentSidebar/Topic/List/Item/index.tsx b/src/features/AgentSidebar/Topic/List/Item/index.tsxindex 1d2d8a8be34..7b40484c30a 100644--- a/src/features/AgentSidebar/Topic/List/Item/index.tsx+++ b/src/features/AgentSidebar/Topic/List/Item/index.tsx@@ -599,7 +599,14 @@ const TopicItemRow = memo<TopicItemRowProps>(title={title === '...' ? <DotsLoading gap={3} size={4} /> : title}titleColor={cssVar.colorText}actions={() => (- <Actions showInlineArchive fav={fav} id={id} status={status} title={title} />+ <Actions+ fav={fav}+ id={id}+ // Archiving a topic mid-run would hide work that is still going.+ showInlineArchive={!shouldShowRunningIcon}+ status={status}+ title={title}+ />)}extra={<>diff --git a/src/features/NavPanel/components/NavItem.tsx b/src/features/NavPanel/components/NavItem.tsxindex 3a5df08d7a0..0b4b74893d5 100644--- a/src/features/NavPanel/components/NavItem.tsx+++ b/src/features/NavPanel/components/NavItem.tsx@@ -25,10 +25,20 @@ const CONTENT_CLASS_NAME = 'nav-item-content';const styles = createStaticStyles(({ css }) => ({container: css`+ /* Width the title fades out under: one small action icon (24px) plus spacing.+ Each extra icon adds its 24px plus the 2px gap. The focus guards and the+ aria-owns portal marker an open menu inserts beside its trigger are not+ icons, so they are not counted. */+ --nav-item-actions-inset: 28px;+user-select: none;overflow: hidden;min-width: 32px;+ &:has(.${ACTION_CLASS_NAME} > :nth-child(2 of :not([data-base-ui-focus-guard], [aria-owns]))) {+ --nav-item-actions-inset: 54px;+ }+/* focus-visible, not focus-within: closing a dropdown hands focus back to itstrigger, which would pin the actions open after the pointer has left. */&:hover,@@ -44,8 +54,8 @@ const styles = createStaticStyles(({ css }) => ({.${CONTENT_CLASS_NAME} {mask-image: linear-gradient(to right,- #000 calc(100% - 56px),- transparent calc(100% - 28px)+ #000 calc(100% - var(--nav-item-actions-inset) - 28px),+ transparent calc(100% - var(--nav-item-actions-inset)));}}