diff --git a/client/web/src/routes/Main/Navbar/QuickSwitcherNav.tsx b/client/web/src/routes/Main/Navbar/QuickSwitcherNav.tsx new file mode 100644 index 00000000000..391fa40e66a --- /dev/null +++ b/client/web/src/routes/Main/Navbar/QuickSwitcherNav.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { NavbarNavItem } from './NavItem'; +import { t } from 'tailchat-shared'; +import { Icon } from 'tailchat-design'; +import { openQuickSwitcher } from '@/components/QuickSwitcher'; + +export const QuickSwitcherNav: React.FC = React.memo(() => { + return ( + { + openQuickSwitcher(); + }} + data-testid="search" + > + + + ); +}); +QuickSwitcherNav.displayName = 'QuickSwitcherNav'; diff --git a/client/web/src/routes/Main/Navbar/index.tsx b/client/web/src/routes/Main/Navbar/index.tsx index d9dbb7c076e..626b87952a2 100644 --- a/client/web/src/routes/Main/Navbar/index.tsx +++ b/client/web/src/routes/Main/Navbar/index.tsx @@ -9,6 +9,7 @@ import { InstallBtn } from './InstallBtn'; import { ReactQueryDevBtn } from './ReactQueryDevBtn'; import { pluginCustomPanel } from '@/plugin/common'; import { NavbarCustomNavItem } from './CustomNavItem'; +import { QuickSwitcherNav } from './QuickSwitcherNav'; /** * 导航栏组件 @@ -28,6 +29,8 @@ export const Navbar: React.FC = React.memo(() => { + + {pluginCustomPanel .filter((p) => p.position === 'navbar-personal') .map((p) => ( diff --git a/client/web/src/routes/Main/useShortcuts.tsx b/client/web/src/routes/Main/useShortcuts.tsx index fe7335d2dea..2ae6dc54d66 100644 --- a/client/web/src/routes/Main/useShortcuts.tsx +++ b/client/web/src/routes/Main/useShortcuts.tsx @@ -8,7 +8,8 @@ import { isQuickSwitcher } from '@/utils/hot-key'; export function useShortcuts() { useGlobalKeyDown((e) => { if (isQuickSwitcher(e)) { - // 显示快速开关 + // 显示快速跳转开关 + e.preventDefault(); openQuickSwitcher(); } });