🤯 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
💄 style(agent-chat): move the terminal button into the header right actions (#18162)
Arvin Xude78912cde98
diff --git a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.test.tsx b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.test.tsxindex b53286c83a2..dfda99c4c2d 100644--- a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.test.tsx+++ b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.test.tsx@@ -1,25 +1,9 @@-import { fireEvent, render, screen } from '@testing-library/react';+import { render, screen } from '@testing-library/react';import type { ReactNode } from 'react';import { describe, expect, it, vi } from 'vitest';import HeaderActions from './index';-const { toggleTerminalPanel } = vi.hoisted(() => ({- toggleTerminalPanel: vi.fn(),-}));--vi.mock('@/const/version', () => ({ isDesktop: true }));--vi.mock('@/store/global', () => ({- useGlobalStore: (- selector: (state: { toggleTerminalPanel: typeof toggleTerminalPanel }) => unknown,- ) => selector({ toggleTerminalPanel }),-}));--vi.mock('react-i18next', () => ({- useTranslation: () => ({ t: (key: string) => key }),-}));-vi.mock('@lobehub/ui', () => ({ActionIcon: ({ title, onClick }: { title?: string; onClick?: () => void }) => (<button@@ -55,12 +39,4 @@ describe('Conversation header actions', () => {expect(screen.getByTestId('topic-info-header')).toBeInTheDocument();});-- it('opens the terminal directly from the desktop header', () => {- render(<HeaderActions />);-- fireEvent.click(screen.getByRole('button', { name: 'terminalPanel.title' }));-- expect(toggleTerminalPanel).toHaveBeenCalledWith(true);- });});diff --git a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.tsxindex 0b001d071e5..e0535f0c553 100644--- a/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.tsx+++ b/src/routes/(main)/agent/features/Conversation/Header/HeaderActions/index.tsx@@ -1,33 +1,19 @@'use client';import { ActionIcon, DropdownMenu } from '@lobehub/ui';-import { MoreHorizontal, SquareTerminalIcon } from 'lucide-react';+import { MoreHorizontal } from 'lucide-react';import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import { isDesktop } from '@/const/version';import HeaderSlot from '@/routes/(main)/agent/(chat)/_layout/HeaderSlot';-import { useGlobalStore } from '@/store/global';import { useMenu } from './useMenu';const HeaderActions = memo(() => {- const { t } = useTranslation('chat');const { menuHeader, menuItems } = useMenu();- const toggleTerminalPanel = useGlobalStore((s) => s.toggleTerminalPanel);return (<><HeaderSlot.Outlet />- {isDesktop && (- <ActionIcon- icon={SquareTerminalIcon}- size={'small'}- title={t('terminalPanel.title')}- tooltipProps={{ placement: 'bottom' }}- onClick={() => toggleTerminalPanel(true)}- />- )}<DropdownMenu header={menuHeader} items={menuItems}><ActionIcon icon={MoreHorizontal} size={'small'} /></DropdownMenu>diff --git a/src/routes/(main)/agent/features/Conversation/Header/TerminalPanelToggle/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/TerminalPanelToggle/index.tsxnew file mode 100644index 00000000000..cc7240c6df2--- /dev/null+++ b/src/routes/(main)/agent/features/Conversation/Header/TerminalPanelToggle/index.tsx@@ -0,0 +1,29 @@+'use client';++import { ActionIcon } from '@lobehub/ui';+import { SquareTerminalIcon } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { DESKTOP_HEADER_ICON_SMALL_SIZE } from '@/const/layoutTokens';+import { isDesktop } from '@/const/version';+import { useGlobalStore } from '@/store/global';++const TerminalPanelToggle = memo(() => {+ const { t } = useTranslation('chat');+ const toggleTerminalPanel = useGlobalStore((s) => s.toggleTerminalPanel);++ if (!isDesktop) return null;++ return (+ <ActionIcon+ icon={SquareTerminalIcon}+ size={DESKTOP_HEADER_ICON_SMALL_SIZE}+ title={t('terminalPanel.title')}+ tooltipProps={{ placement: 'bottom' }}+ onClick={() => toggleTerminalPanel(true)}+ />+ );+});++export default TerminalPanelToggle;diff --git a/src/routes/(main)/agent/features/Conversation/Header/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/index.tsxindex 2606ce4613c..32c91a73042 100644--- a/src/routes/(main)/agent/features/Conversation/Header/index.tsx+++ b/src/routes/(main)/agent/features/Conversation/Header/index.tsx@@ -17,6 +17,7 @@ import { useElectronStore } from '@/store/electron';import HeaderActions from './HeaderActions';import ShareButton from './ShareButton';import Tags from './Tags';+import TerminalPanelToggle from './TerminalPanelToggle';import WorkingPanelToggle from './WorkingPanelToggle';// Below this column width the header is a solid in-flow bar with a bottom@@ -181,6 +182,7 @@ const Header = memo(() => {{isLocalSystemEnabled && workingDirectory && (<OpenInAppButton workingDirectory={workingDirectory} />)}+ <TerminalPanelToggle /><TopicCommentButton /><ShareButton /><WorkingPanelToggle />