mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 11:49:02 +08:00
将导航栏展开收起按钮移至顶栏
This commit is contained in:
+23
-1
@@ -53,6 +53,7 @@ function MainContent(): React.JSX.Element {
|
||||
const [authLoading, setAuthLoading] = useState(false)
|
||||
const [isPortraitMode, setIsPortraitMode] = useState(false)
|
||||
const [sidebarCollapsed, setSidebarCollapsed] = useState(false)
|
||||
const [floatingSidebarExpanded, setFloatingSidebarExpanded] = useState(false)
|
||||
|
||||
const activeMenu = useMemo(() => {
|
||||
const p = location.pathname
|
||||
@@ -143,10 +144,12 @@ function MainContent(): React.JSX.Element {
|
||||
await api.windowSetResizable(false)
|
||||
await api.windowResize(940, 1600)
|
||||
setSidebarCollapsed(true)
|
||||
setFloatingSidebarExpanded(false)
|
||||
} else {
|
||||
await api.windowSetResizable(true)
|
||||
await api.windowResize(2560, 1440)
|
||||
setSidebarCollapsed(false)
|
||||
setFloatingSidebarExpanded(false)
|
||||
}
|
||||
setIsPortraitMode(nextPortraitMode)
|
||||
} catch (error) {
|
||||
@@ -155,6 +158,20 @@ function MainContent(): React.JSX.Element {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPortraitMode || !sidebarCollapsed) {
|
||||
setFloatingSidebarExpanded(false)
|
||||
}
|
||||
}, [isPortraitMode, sidebarCollapsed])
|
||||
|
||||
const toggleSidebar = () => {
|
||||
if (isPortraitMode && sidebarCollapsed) {
|
||||
setFloatingSidebarExpanded((prev) => !prev)
|
||||
return
|
||||
}
|
||||
setSidebarCollapsed((prev) => !prev)
|
||||
}
|
||||
|
||||
const isDark = currentTheme?.mode === "dark"
|
||||
const brandColor = currentTheme?.config?.tdesign?.brandColor || "#0052D9"
|
||||
|
||||
@@ -175,7 +192,8 @@ function MainContent(): React.JSX.Element {
|
||||
onMenuChange={onMenuChange}
|
||||
collapsed={sidebarCollapsed}
|
||||
floatingExpand={isPortraitMode}
|
||||
onCollapsedChange={setSidebarCollapsed}
|
||||
floatingExpanded={floatingSidebarExpanded}
|
||||
onFloatingExpandedChange={setFloatingSidebarExpanded}
|
||||
/>
|
||||
<ContentArea
|
||||
permission={permission}
|
||||
@@ -183,6 +201,10 @@ function MainContent(): React.JSX.Element {
|
||||
onAuthClick={() => setAuthVisible(true)}
|
||||
onLogout={logout}
|
||||
isPortraitMode={isPortraitMode}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
floatingExpand={isPortraitMode}
|
||||
floatingExpanded={floatingSidebarExpanded}
|
||||
onToggleSidebar={toggleSidebar}
|
||||
onToggleOrientation={toggleOrientationMode}
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user