refactor: add settings menu in user menu

This commit is contained in:
moonrailgun 2024-01-28 16:45:26 +08:00
parent 70f0f56b47
commit 00a045915e

View File

@ -1,5 +1,5 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Outlet, useSearchParams } from 'react-router-dom'; import { Outlet, useNavigate, useSearchParams } from 'react-router-dom';
import { NavItem } from '../components/NavItem'; import { NavItem } from '../components/NavItem';
import { MobileNavItem } from '../components/MobileNavItem'; import { MobileNavItem } from '../components/MobileNavItem';
import { UserOutlined } from '@ant-design/icons'; import { UserOutlined } from '@ant-design/icons';
@ -30,6 +30,7 @@ export const Layout: React.FC = React.memo(() => {
const logout = useLogout(); const logout = useLogout();
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const showHeader = !params.has('hideHeader'); const showHeader = !params.has('hideHeader');
const navigate = useNavigate();
const accountEl = ( const accountEl = (
<Dropdown <Dropdown
@ -45,6 +46,13 @@ export const Layout: React.FC = React.memo(() => {
disabled: w.current, disabled: w.current,
})), })),
}, },
{
key: 'settings',
label: 'Settings',
onClick: () => {
navigate('/settings');
},
},
{ {
key: 'logout', key: 'logout',
label: 'Logout', label: 'Logout',