balibabu commited on
Commit
6b85a7f
·
1 Parent(s): 4fd5400

feat: Let the top navigation bar open in a tab when you right click on it #3018 (#3486)

Browse files

### What problem does this PR solve?

feat: Let the top navigation bar open in a tab when you right click on
it #3018

### Type of change


- [x] New Feature (non-breaking change which adds functionality)

web/src/layouts/components/header/index.less CHANGED
@@ -31,7 +31,7 @@
31
  }
32
 
33
  .radioGroup {
34
- & > label {
35
  height: 40px;
36
  line-height: 40px;
37
  border: 0 !important;
@@ -44,6 +44,9 @@
44
  }
45
  :global(.ant-radio-button-wrapper-checked) {
46
  border-radius: 6px !important;
 
 
 
47
  }
48
  }
49
 
 
31
  }
32
 
33
  .radioGroup {
34
+ & label {
35
  height: 40px;
36
  line-height: 40px;
37
  border: 0 !important;
 
44
  }
45
  :global(.ant-radio-button-wrapper-checked) {
46
  border-radius: 6px !important;
47
+ & a {
48
+ color: white;
49
+ }
50
  }
51
  }
52
 
web/src/layouts/components/header/index.tsx CHANGED
@@ -6,7 +6,7 @@ import { useFetchAppConf } from '@/hooks/logic-hooks';
6
  import { useNavigateWithFromState } from '@/hooks/route-hook';
7
  import { MessageOutlined, SearchOutlined } from '@ant-design/icons';
8
  import { Flex, Layout, Radio, Space, theme } from 'antd';
9
- import { useCallback, useMemo } from 'react';
10
  import { useLocation } from 'umi';
11
  import Toolbar from '../right-toolbar';
12
 
@@ -40,9 +40,14 @@ const RagHeader = () => {
40
  );
41
  }, [pathname, tagsData]);
42
 
43
- const handleChange = (path: string) => {
44
- navigate(path);
45
- };
 
 
 
 
 
46
 
47
  const handleLogoClick = useCallback(() => {
48
  navigate('/');
@@ -77,18 +82,21 @@ const RagHeader = () => {
77
  value={currentPath}
78
  >
79
  {tagsData.map((item) => (
80
- <Radio.Button
81
- value={item.name}
82
- onClick={() => handleChange(item.path)}
83
- key={item.name}
84
- >
85
- <Flex align="center" gap={8}>
86
- <item.icon
87
- className={styles.radioButtonIcon}
88
- stroke={item.name === currentPath ? 'black' : 'white'}
89
- ></item.icon>
90
- {item.name}
91
- </Flex>
 
 
 
92
  </Radio.Button>
93
  ))}
94
  </Radio.Group>
 
6
  import { useNavigateWithFromState } from '@/hooks/route-hook';
7
  import { MessageOutlined, SearchOutlined } from '@ant-design/icons';
8
  import { Flex, Layout, Radio, Space, theme } from 'antd';
9
+ import { MouseEventHandler, useCallback, useMemo } from 'react';
10
  import { useLocation } from 'umi';
11
  import Toolbar from '../right-toolbar';
12
 
 
40
  );
41
  }, [pathname, tagsData]);
42
 
43
+ const handleChange = useCallback(
44
+ (path: string): MouseEventHandler =>
45
+ (e) => {
46
+ e.preventDefault();
47
+ navigate(path);
48
+ },
49
+ [navigate],
50
+ );
51
 
52
  const handleLogoClick = useCallback(() => {
53
  navigate('/');
 
82
  value={currentPath}
83
  >
84
  {tagsData.map((item) => (
85
+ <Radio.Button value={item.name} key={item.name}>
86
+ <a href={item.path}>
87
+ <Flex
88
+ align="center"
89
+ gap={8}
90
+ onClick={handleChange(item.path)}
91
+ className="cursor-pointer"
92
+ >
93
+ <item.icon
94
+ className={styles.radioButtonIcon}
95
+ stroke={item.name === currentPath ? 'black' : 'white'}
96
+ ></item.icon>
97
+ {item.name}
98
+ </Flex>
99
+ </a>
100
  </Radio.Button>
101
  ))}
102
  </Radio.Group>