mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 12:06:42 +08:00
### What problem does this PR solve? change language Issue link: #245 - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -7,38 +7,39 @@ import {
|
||||
UserSettingBaseKey,
|
||||
UserSettingIconMap,
|
||||
UserSettingRouteKey,
|
||||
UserSettingRouteMap,
|
||||
} from '../constants';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useLogout } from '@/hooks/userSettingHook';
|
||||
import styles from './index.less';
|
||||
|
||||
type MenuItem = Required<MenuProps>['items'][number];
|
||||
|
||||
function getItem(
|
||||
label: React.ReactNode,
|
||||
key: React.Key,
|
||||
icon?: React.ReactNode,
|
||||
children?: MenuItem[],
|
||||
type?: 'group',
|
||||
): MenuItem {
|
||||
return {
|
||||
key,
|
||||
icon,
|
||||
children,
|
||||
label,
|
||||
type,
|
||||
} as MenuItem;
|
||||
}
|
||||
|
||||
const items: MenuItem[] = Object.values(UserSettingRouteKey).map((value) =>
|
||||
getItem(UserSettingRouteMap[value], value, UserSettingIconMap[value]),
|
||||
);
|
||||
|
||||
const SideBar = () => {
|
||||
const navigate = useNavigate();
|
||||
const pathName = useSecondPathName();
|
||||
const logout = useLogout();
|
||||
const { t } = useTranslate('setting');
|
||||
|
||||
function getItem(
|
||||
label: string,
|
||||
key: React.Key,
|
||||
icon?: React.ReactNode,
|
||||
children?: MenuItem[],
|
||||
type?: 'group',
|
||||
): MenuItem {
|
||||
return {
|
||||
key,
|
||||
icon,
|
||||
children,
|
||||
label: t(label),
|
||||
type,
|
||||
} as MenuItem;
|
||||
}
|
||||
|
||||
const items: MenuItem[] = Object.values(UserSettingRouteKey).map((value) =>
|
||||
getItem(value, value, UserSettingIconMap[value]),
|
||||
);
|
||||
|
||||
const handleMenuClick: MenuProps['onClick'] = ({ key }) => {
|
||||
if (key === UserSettingRouteKey.Logout) {
|
||||
|
||||
Reference in New Issue
Block a user