Skip to content

Commit

Permalink
优化前端用户信息显示
Browse files Browse the repository at this point in the history
  • Loading branch information
239573049 committed Nov 17, 2024
1 parent 1af619a commit 8f63b62
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
31 changes: 17 additions & 14 deletions web/src/admin/_layout/Desktop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { memo } from "react";
import { Outlet } from "react-router-dom";
import { Layout, Menu, theme } from 'antd';
import './index.css'
import { Logo } from "@lobehub/ui";
import { Header, Logo } from "@lobehub/ui";
import { Package, User, Gauge, ChartCandlestick, Settings } from 'lucide-react'
import { useNavigate, useLocation } from "react-router-dom";
import React from "react";
const { Header, Content, Footer, Sider } = Layout;
import Avatar from "./Avatar";
const { Content, Footer, Sider } = Layout;

const DesktopLayout = memo(() => {
const navigate = useNavigate();
Expand All @@ -33,17 +34,15 @@ const DesktopLayout = memo(() => {
console.log(collapsed, type);
}}
>
<div>
<div
className="logo"
style={{
height: '32px',
background: 'rgba(255, 255, 255, 0.2)',
margin: '16px',
}}
>
<Logo size={35} extra="NuGet Next" />
</div>
<div
style={{
height: '32px',
margin: '16px',
background: borderRadiusLG,

}}
>
<Logo size={35} extra="NuGet Next" />
</div>
<Menu mode="inline"
defaultSelectedKeys={[selectedKey]}
Expand Down Expand Up @@ -93,7 +92,11 @@ const DesktopLayout = memo(() => {
]} />
</Sider>
<Layout>
<Header style={{ padding: 0, background: colorBgContainer }} />
<Header
actions={<>
<Avatar />
</>}
style={{ padding: 0, background: colorBgContainer }} />
<Content style={{ margin: '24px 16px 0' }}>
<div
style={{
Expand Down
14 changes: 12 additions & 2 deletions web/src/features/User/UserPanel/useMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { DOCUMENTS, EMAIL_SUPPORT, GITHUB_ISSUES, mailTo } from '@/const/url';
import { useQueryRoute } from '@/hooks/useQueryRoute';
import { useUserStore } from '@/store/user';
import { authSelectors } from '@/store/user/selectors';
import { useLocation } from 'react-router-dom';

export const useMenu = () => {
const router = useQueryRoute();
Expand All @@ -25,6 +26,7 @@ export const useMenu = () => {
s.logout,
s.user,
]);
const location = useLocation();

function downloadNugetConfig() {

Expand Down Expand Up @@ -114,9 +116,17 @@ export const useMenu = () => {
{
icon: <Icon icon={AppWindow} />,
key: 'admin',
label: '管理',
label: location.pathname.includes('/admin') ? '首页' : '控制面板',
onClick: () => {
router.push('/admin');
if (!location.pathname.includes('/admin')) {
router.push('/admin', {
replace: true,
});
} else {
router.push('/', {
replace: true,
});
}
},
},
] : [
Expand Down

0 comments on commit 8f63b62

Please sign in to comment.