mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 19:04:23 +08:00
优化横竖切换按钮位置图标并修复侧栏重复显示
This commit is contained in:
+1
-1
@@ -141,7 +141,7 @@ function MainContent(): React.JSX.Element {
|
||||
}
|
||||
if (nextPortraitMode) {
|
||||
await api.windowSetResizable(false)
|
||||
await api.windowResize(940, 1280)
|
||||
await api.windowResize(940, 1380)
|
||||
setSidebarCollapsed(true)
|
||||
} else {
|
||||
await api.windowSetResizable(true)
|
||||
|
||||
+28
-22
@@ -193,7 +193,11 @@ export function Sidebar({
|
||||
|
||||
const showFloatingPanel = floatingExpand && collapsed && floatingExpanded
|
||||
|
||||
const renderSidebarBody = (isCollapsedView: boolean, isFloatingPanel = false) => (
|
||||
const renderSidebarBody = (
|
||||
isCollapsedView: boolean,
|
||||
isFloatingPanel = false,
|
||||
hideMenu = false
|
||||
) => (
|
||||
<>
|
||||
<div
|
||||
data-tauri-drag-region
|
||||
@@ -270,27 +274,29 @@ export function Sidebar({
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div style={{ flex: 1, overflowY: "auto", display: "flex", flexDirection: "column" }}>
|
||||
<Menu
|
||||
mode="inline"
|
||||
inlineCollapsed={isCollapsedView}
|
||||
selectedKeys={[activeMenu]}
|
||||
onClick={({ key }) => {
|
||||
onMenuChange(key)
|
||||
if (floatingExpand && collapsed) {
|
||||
setFloatingExpanded(false)
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
width: "100%",
|
||||
border: "none",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
items={menuItems}
|
||||
/>
|
||||
</div>
|
||||
{!hideMenu && (
|
||||
<div style={{ flex: 1, overflowY: "auto", display: "flex", flexDirection: "column" }}>
|
||||
<Menu
|
||||
mode="inline"
|
||||
inlineCollapsed={isCollapsedView}
|
||||
selectedKeys={[activeMenu]}
|
||||
onClick={({ key }) => {
|
||||
onMenuChange(key)
|
||||
if (floatingExpand && collapsed) {
|
||||
setFloatingExpanded(false)
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
width: "100%",
|
||||
border: "none",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
items={menuItems}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!isCollapsedView && dbStatus.type === "postgresql" && (
|
||||
{!isCollapsedView && !hideMenu && dbStatus.type === "postgresql" && (
|
||||
<Card
|
||||
size="small"
|
||||
style={{
|
||||
@@ -370,7 +376,7 @@ export function Sidebar({
|
||||
theme="light"
|
||||
>
|
||||
{contextHolder}
|
||||
{renderSidebarBody(collapsed)}
|
||||
{renderSidebarBody(collapsed, false, showFloatingPanel)}
|
||||
|
||||
{showFloatingPanel && (
|
||||
<div
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
BorderOutlined,
|
||||
CloseOutlined,
|
||||
FullscreenExitOutlined,
|
||||
SwapOutlined,
|
||||
RotateRightOutlined,
|
||||
} from "@ant-design/icons"
|
||||
import { useEffect, useState } from "react"
|
||||
|
||||
@@ -76,20 +76,20 @@ export function WindowControls({
|
||||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
<Button
|
||||
type="text"
|
||||
onClick={minimize}
|
||||
style={{ width: "46px", height: "32px", borderRadius: 0 }}
|
||||
>
|
||||
<MinusOutlined />
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
onClick={onToggleOrientation}
|
||||
title={isPortraitMode ? "切换到横屏模式" : "切换到竖屏模式"}
|
||||
style={{ width: "46px", height: "32px", borderRadius: 0 }}
|
||||
>
|
||||
<SwapOutlined style={{ transform: "rotate(90deg)" }} />
|
||||
<RotateRightOutlined />
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
onClick={minimize}
|
||||
style={{ width: "46px", height: "32px", borderRadius: 0 }}
|
||||
>
|
||||
<MinusOutlined />
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
|
||||
Reference in New Issue
Block a user