Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
A
audit_project_manager
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
David Yang
audit_project_manager
Commits
230b53ca
Commit
230b53ca
authored
Sep 01, 2026
by
Andy-bubu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add collapsible sidebar navigation groups
parent
34a0ef70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
27 deletions
+68
-27
DashboardSidebar.jsx
src/components/DashboardSidebar.jsx
+53
-26
Layout.jsx
src/pages/project_manager_xy/Layout.jsx
+15
-1
No files found.
src/components/DashboardSidebar.jsx
View file @
230b53ca
...
...
@@ -2,8 +2,8 @@ import xyLogoWhite from '@/assets/xy-logo-white.png';
import
{
APPLICATION_DISPLAY_NAME
}
from
'@/config/application'
;
import
{
Sheet
}
from
'@heroui-pro/react'
;
import
{
Sidebar
,
useSidebar
}
from
'@heroui-pro/react/sidebar'
;
import
{
Avatar
,
Button
,
Dropdown
,
Label
}
from
'@heroui/react'
;
import
{
AppGrid
,
LogOut
}
from
'./AppIcons'
;
import
{
Avatar
,
Button
,
D
isclosure
,
D
ropdown
,
Label
}
from
'@heroui/react'
;
import
{
AppGrid
,
ChevronDown
,
LogOut
}
from
'./AppIcons'
;
function
getUserDisplay
(
userInfo
)
{
const
displayName
=
userInfo
?.
display_name
||
userInfo
?.
username
||
'当前用户'
;
...
...
@@ -65,6 +65,54 @@ function SidebarContents({
pathname
,
userInfo
,
})
{
const
renderMenu
=
(
group
)
=>
(
<
Sidebar
.
Menu
aria
-
label=
{
group
.
title
}
>
{
group
.
items
.
map
((
item
)
=>
{
const
Icon
=
item
.
icon
;
return
(
<
Sidebar
.
MenuItem
href=
{
item
.
path
}
isCurrent=
{
pathname
===
item
.
path
}
key=
{
item
.
path
}
textValue=
{
item
.
name
}
tooltip=
{
item
.
name
}
>
<
Sidebar
.
MenuIcon
>
<
Icon
size=
{
16
}
/>
</
Sidebar
.
MenuIcon
>
<
Sidebar
.
MenuLabel
>
{
item
.
name
}
</
Sidebar
.
MenuLabel
>
</
Sidebar
.
MenuItem
>
);
})
}
</
Sidebar
.
Menu
>
);
const
renderGroup
=
(
group
)
=>
{
const
hasCurrentItem
=
group
.
items
.
some
((
item
)
=>
pathname
===
item
.
path
);
const
GroupIcon
=
group
.
icon
;
return
(
<
Sidebar
.
Group
key=
{
group
.
title
}
>
<
Disclosure
defaultExpanded=
{
hasCurrentItem
}
>
<
Disclosure
.
Heading
>
<
Sidebar
.
GroupLabel
>
<
Disclosure
.
Trigger
className=
"flex w-full min-w-0 items-center gap-2 text-left"
>
{
GroupIcon
?
<
GroupIcon
size=
{
16
}
/>
:
null
}
<
span
className=
"min-w-0 flex-1 truncate"
>
{
group
.
title
}
</
span
>
<
Disclosure
.
Indicator
>
<
ChevronDown
size=
{
14
}
/>
</
Disclosure
.
Indicator
>
</
Disclosure
.
Trigger
>
</
Sidebar
.
GroupLabel
>
</
Disclosure
.
Heading
>
<
Disclosure
.
Content
>
<
Disclosure
.
Body
>
{
renderMenu
(
group
)
}
</
Disclosure
.
Body
>
</
Disclosure
.
Content
>
</
Disclosure
>
</
Sidebar
.
Group
>
);
};
return
(
<>
<
Sidebar
.
Header
>
...
...
@@ -104,30 +152,9 @@ function SidebarContents({
<
Sidebar
.
Content
>
{
menuGroups
.
map
((
group
)
=>
(
<
Sidebar
.
Group
key=
{
group
.
title
}
>
{
group
.
showLabel
!==
false
?
(
<
Sidebar
.
GroupLabel
>
{
group
.
title
}
</
Sidebar
.
GroupLabel
>
)
:
null
}
<
Sidebar
.
Menu
aria
-
label=
{
group
.
title
}
>
{
group
.
items
.
map
((
item
)
=>
{
const
Icon
=
item
.
icon
;
return
(
<
Sidebar
.
MenuItem
href=
{
item
.
path
}
isCurrent=
{
pathname
===
item
.
path
}
key=
{
item
.
path
}
textValue=
{
item
.
name
}
tooltip=
{
item
.
name
}
>
<
Sidebar
.
MenuIcon
>
<
Icon
size=
{
16
}
/>
</
Sidebar
.
MenuIcon
>
<
Sidebar
.
MenuLabel
>
{
item
.
name
}
</
Sidebar
.
MenuLabel
>
</
Sidebar
.
MenuItem
>
);
})
}
</
Sidebar
.
Menu
>
</
Sidebar
.
Group
>
group
.
showLabel
===
false
?
(
<
Sidebar
.
Group
key=
{
group
.
title
}
>
{
renderMenu
(
group
)
}
</
Sidebar
.
Group
>
)
:
renderGroup
(
group
)
))
}
</
Sidebar
.
Content
>
...
...
src/pages/project_manager_xy/Layout.jsx
View file @
230b53ca
...
...
@@ -7,6 +7,8 @@ import {
Archive
,
BarChart
,
FileText
,
Folder
,
Group
,
Project
,
}
from
'@/components/AppIcons'
;
import
ApplicationSwitcherDialog
from
'./ApplicationSwitcherDialog'
;
...
...
@@ -21,7 +23,7 @@ import { Outlet, useLocation } from 'umi';
const
MENU_GROUPS
=
[
{
title
:
APPLICATION_DISPLAY_NAME
,
title
:
'基础导航'
,
showLabel
:
false
,
items
:
[
{
...
...
@@ -29,6 +31,12 @@ const MENU_GROUPS = [
path
:
'/audit_project_table/dashboard'
,
icon
:
BarChart
,
},
],
},
{
title
:
'开展审计工作'
,
icon
:
Group
,
items
:
[
{
name
:
'审计项目管理'
,
path
:
'/audit_project'
,
...
...
@@ -39,6 +47,12 @@ const MENU_GROUPS = [
path
:
'/audit_project_archive'
,
icon
:
Archive
,
},
],
},
{
title
:
'表单配置及维护'
,
icon
:
Folder
,
items
:
[
{
name
:
'项目表单'
,
path
:
'/project_form'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment