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
90c9c1b5
authored
Mar 02, 2025
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Persist models expanded state in PersonalSetting component
parent
6e07286e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
web/src/components/PersonalSetting.js
+10
-1
No files found.
web/src/components/PersonalSetting.js
View file @
90c9c1b5
...
...
@@ -69,7 +69,11 @@ const PersonalSetting = () => {
const
[
models
,
setModels
]
=
useState
([]);
const
[
openTransfer
,
setOpenTransfer
]
=
useState
(
false
);
const
[
transferAmount
,
setTransferAmount
]
=
useState
(
0
);
const
[
isModelsExpanded
,
setIsModelsExpanded
]
=
useState
(
false
);
const
[
isModelsExpanded
,
setIsModelsExpanded
]
=
useState
(()
=>
{
// Initialize from localStorage if available
const
savedState
=
localStorage
.
getItem
(
'modelsExpanded'
);
return
savedState
?
JSON
.
parse
(
savedState
)
:
false
;
});
const
MODELS_DISPLAY_COUNT
=
10
;
// 默认显示的模型数量
const
[
notificationSettings
,
setNotificationSettings
]
=
useState
({
warningType
:
'email'
,
...
...
@@ -124,6 +128,11 @@ const PersonalSetting = () => {
}
},
[
userState
?.
user
?.
setting
]);
// Save models expanded state to localStorage whenever it changes
useEffect
(()
=>
{
localStorage
.
setItem
(
'modelsExpanded'
,
JSON
.
stringify
(
isModelsExpanded
));
},
[
isModelsExpanded
]);
const
handleInputChange
=
(
name
,
value
)
=>
{
setInputs
((
inputs
)
=>
({...
inputs
,
[
name
]:
value
}));
};
...
...
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