From 00a045915e7bc651d10273b82377856cba059fc0 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 28 Jan 2024 16:45:26 +0800 Subject: [PATCH] refactor: add settings menu in user menu --- src/client/pages/Layout.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client/pages/Layout.tsx b/src/client/pages/Layout.tsx index 8f6634d..2caaf39 100644 --- a/src/client/pages/Layout.tsx +++ b/src/client/pages/Layout.tsx @@ -1,5 +1,5 @@ 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 { MobileNavItem } from '../components/MobileNavItem'; import { UserOutlined } from '@ant-design/icons'; @@ -30,6 +30,7 @@ export const Layout: React.FC = React.memo(() => { const logout = useLogout(); const isMobile = useIsMobile(); const showHeader = !params.has('hideHeader'); + const navigate = useNavigate(); const accountEl = ( { disabled: w.current, })), }, + { + key: 'settings', + label: 'Settings', + onClick: () => { + navigate('/settings'); + }, + }, { key: 'logout', label: 'Logout',