File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
client/web/src/routes/Main Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import { NavbarNavItem } from './NavItem' ;
3
+ import { t } from 'tailchat-shared' ;
4
+ import { Icon } from 'tailchat-design' ;
5
+ import { openQuickSwitcher } from '@/components/QuickSwitcher' ;
6
+
7
+ export const QuickSwitcherNav : React . FC = React . memo ( ( ) => {
8
+ return (
9
+ < NavbarNavItem
10
+ className = "bg-gray-700"
11
+ name = { t ( '快速搜索、跳转' ) + ' | ctrl + k' }
12
+ onClick = { ( ) => {
13
+ openQuickSwitcher ( ) ;
14
+ } }
15
+ data-testid = "search"
16
+ >
17
+ < Icon className = "text-3xl text-white" icon = "mdi:search" />
18
+ </ NavbarNavItem >
19
+ ) ;
20
+ } ) ;
21
+ QuickSwitcherNav . displayName = 'QuickSwitcherNav' ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { InstallBtn } from './InstallBtn';
9
9
import { ReactQueryDevBtn } from './ReactQueryDevBtn' ;
10
10
import { pluginCustomPanel } from '@/plugin/common' ;
11
11
import { NavbarCustomNavItem } from './CustomNavItem' ;
12
+ import { QuickSwitcherNav } from './QuickSwitcherNav' ;
12
13
13
14
/**
14
15
* 导航栏组件
@@ -28,6 +29,8 @@ export const Navbar: React.FC = React.memo(() => {
28
29
29
30
< InboxNav />
30
31
32
+ < QuickSwitcherNav />
33
+
31
34
{ pluginCustomPanel
32
35
. filter ( ( p ) => p . position === 'navbar-personal' )
33
36
. map ( ( p ) => (
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ import { isQuickSwitcher } from '@/utils/hot-key';
8
8
export function useShortcuts ( ) {
9
9
useGlobalKeyDown ( ( e ) => {
10
10
if ( isQuickSwitcher ( e ) ) {
11
- // 显示快速开关
11
+ // 显示快速跳转开关
12
+ e . preventDefault ( ) ;
12
13
openQuickSwitcher ( ) ;
13
14
}
14
15
} ) ;
You can’t perform that action at this time.
0 commit comments