Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fa1a6cb5
authored
Mar 10, 2025
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: Remove unnecessary transition styles and simplify sidebar state management
parent
e704f076
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
8 deletions
+5
-8
web/src/components/PageLayout.js
+0
-2
web/src/components/SiderBar.js
+5
-6
No files found.
web/src/components/PageLayout.js
View file @
fa1a6cb5
...
@@ -106,7 +106,6 @@ const PageLayout = () => {
...
@@ -106,7 +106,6 @@ const PageLayout = () => {
boxShadow
:
'0 2px 8px rgba(0, 0, 0, 0.15)'
,
boxShadow
:
'0 2px 8px rgba(0, 0, 0, 0.15)'
,
border
:
'none'
,
border
:
'none'
,
paddingRight
:
'0'
,
paddingRight
:
'0'
,
transition
:
'transform 0.3s ease'
,
height
:
'calc(100vh - 56px)'
,
height
:
'calc(100vh - 56px)'
,
}}
>
}}
>
<
SiderBar
/>
<
SiderBar
/>
...
@@ -126,7 +125,6 @@ const PageLayout = () => {
...
@@ -126,7 +125,6 @@ const PageLayout = () => {
WebkitOverflowScrolling
:
'touch'
,
WebkitOverflowScrolling
:
'touch'
,
padding
:
styleState
.
shouldInnerPadding
?
'24px'
:
'0'
,
padding
:
styleState
.
shouldInnerPadding
?
'24px'
:
'0'
,
position
:
'relative'
,
position
:
'relative'
,
paddingBottom
:
styleState
.
isMobile
?
'80px'
:
'0'
// 移动端底部额外内边距
}}
}}
>
>
<
App
/>
<
App
/>
...
...
web/src/components/SiderBar.js
View file @
fa1a6cb5
...
@@ -39,7 +39,6 @@ import Text from '@douyinfe/semi-ui/lib/es/typography/text';
...
@@ -39,7 +39,6 @@ import Text from '@douyinfe/semi-ui/lib/es/typography/text';
const
navItemStyle
=
{
const
navItemStyle
=
{
borderRadius
:
'6px'
,
borderRadius
:
'6px'
,
margin
:
'4px 8px'
,
margin
:
'4px 8px'
,
transition
:
'all 0.3s ease'
};
};
// 自定义侧边栏按钮悬停样式
// 自定义侧边栏按钮悬停样式
...
@@ -60,7 +59,6 @@ const iconStyle = (itemKey, selectedKeys) => {
...
@@ -60,7 +59,6 @@ const iconStyle = (itemKey, selectedKeys) => {
return
{
return
{
fontSize
:
'18px'
,
fontSize
:
'18px'
,
color
:
selectedKeys
.
includes
(
itemKey
)
?
'var(--semi-color-primary)'
:
'var(--semi-color-text-2)'
,
color
:
selectedKeys
.
includes
(
itemKey
)
?
'var(--semi-color-primary)'
:
'var(--semi-color-text-2)'
,
transition
:
'all 0.3s ease'
};
};
};
};
...
@@ -248,7 +246,9 @@ const SiderBar = () => {
...
@@ -248,7 +246,9 @@ const SiderBar = () => {
}
else
if
(
currentPath
.
startsWith
(
'/chat/'
))
{
}
else
if
(
currentPath
.
startsWith
(
'/chat/'
))
{
setSelectedKeys
([
'chat'
]);
setSelectedKeys
([
'chat'
]);
}
}
},
[
location
.
pathname
]);
useEffect
(()
=>
{
let
chats
=
localStorage
.
getItem
(
'chats'
);
let
chats
=
localStorage
.
getItem
(
'chats'
);
if
(
chats
)
{
if
(
chats
)
{
// console.log(chats);
// console.log(chats);
...
@@ -274,8 +274,8 @@ const SiderBar = () => {
...
@@ -274,8 +274,8 @@ const SiderBar = () => {
}
}
}
}
setIsCollapsed
(
localStorage
.
getItem
(
'default_collapse_sidebar'
)
===
'true'
);
setIsCollapsed
(
styleState
.
siderCollapsed
);
}
,
[
location
.
pathname
]);
}
)
// Custom divider style
// Custom divider style
const
dividerStyle
=
{
const
dividerStyle
=
{
...
@@ -303,7 +303,6 @@ const SiderBar = () => {
...
@@ -303,7 +303,6 @@ const SiderBar = () => {
borderRight
:
'1px solid var(--semi-color-border)'
,
borderRight
:
'1px solid var(--semi-color-border)'
,
background
:
'var(--semi-color-bg-1)'
,
background
:
'var(--semi-color-bg-1)'
,
borderRadius
:
styleState
.
isMobile
?
'0'
:
'0 8px 8px 0'
,
borderRadius
:
styleState
.
isMobile
?
'0'
:
'0 8px 8px 0'
,
transition
:
'all 0.3s ease'
,
position
:
'relative'
,
position
:
'relative'
,
zIndex
:
95
,
zIndex
:
95
,
height
:
'100%'
,
height
:
'100%'
,
...
@@ -330,7 +329,7 @@ const SiderBar = () => {
...
@@ -330,7 +329,7 @@ const SiderBar = () => {
}
else
if
(
currentPath
.
startsWith
(
'/chat/'
))
{
}
else
if
(
currentPath
.
startsWith
(
'/chat/'
))
{
setSelectedKeys
([
'chat'
]);
setSelectedKeys
([
'chat'
]);
}
else
{
}
else
{
setSelectedKeys
([
'detail'
]);
// 默认选中首页
setSelectedKeys
([]);
// 默认选中首页
}
}
}
}
}}
}}
...
...
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