mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
* feat: Modify the color of the svg icon in the header according to the selected state * feat: add translation icon to header * feat: shorten the route length of the knowledge base * feat: extract routing information from the knowledge base into constants
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import authorizationUtil from '@/utils/authorizationUtil';
|
|
import type { MenuProps } from 'antd';
|
|
import { Avatar, Button, Dropdown } from 'antd';
|
|
import React, { useMemo } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { history } from 'umi';
|
|
|
|
const App: React.FC = () => {
|
|
const { t } = useTranslation();
|
|
|
|
const logout = () => {
|
|
authorizationUtil.removeAll();
|
|
history.push('/login');
|
|
};
|
|
|
|
const toSetting = () => {
|
|
history.push('/setting');
|
|
};
|
|
|
|
const items: MenuProps['items'] = useMemo(() => {
|
|
return [
|
|
{
|
|
key: '1',
|
|
label: (
|
|
<Button type="text" onClick={logout}>
|
|
{t('header.logout')}
|
|
</Button>
|
|
),
|
|
},
|
|
{
|
|
key: '2',
|
|
label: (
|
|
<Button type="text" onClick={toSetting}>
|
|
{t('header.setting')}
|
|
</Button>
|
|
),
|
|
},
|
|
];
|
|
}, []);
|
|
|
|
return (
|
|
<Dropdown menu={{ items }} placement="bottomLeft" arrow>
|
|
<Avatar
|
|
size={32}
|
|
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
|
/>
|
|
</Dropdown>
|
|
);
|
|
};
|
|
|
|
export default App;
|