Skip to content

Commit c547bb2

Browse files
committed
fix: some global config will be clear when save color
1 parent 924395d commit c547bb2

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

src/GZCTF/ClientApp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"embla-carousel": "^8.0.4",
3636
"embla-carousel-autoplay": "^8.0.4",
3737
"embla-carousel-react": "^8.0.4",
38-
"i18next": "^23.11.3",
38+
"i18next": "^23.11.4",
3939
"i18next-browser-languagedetector": "^7.2.1",
4040
"katex": "^0.16.10",
4141
"lz-string": "^1.5.0",

src/GZCTF/ClientApp/pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GZCTF/ClientApp/src/pages/admin/Settings.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,11 @@ const Configs: FC = () => {
6161
})
6262
.catch((e) => showErrorNotification(e, t))
6363
.finally(() => {
64-
mutateConfig({ ...conf.globalConfig })
64+
mutateConfig({ ...conf.globalConfig, ...conf.containerPolicy })
6565
setDisabled(false)
6666
})
6767
}
6868

69-
useEffect(() => {
70-
if (color && /^#[0-9A-F]{6}$/i.test(color)) {
71-
setGlobalConfig({ ...(globalConfig ?? {}), customTheme: color })
72-
} else {
73-
setGlobalConfig({ ...(globalConfig ?? {}), customTheme: '' })
74-
}
75-
}, [color])
76-
7769
const colors = color && /^#[0-9A-F]{6}$/i.test(color) ? generateColors(color) : theme.colors.brand
7870

7971
return (
@@ -85,7 +77,14 @@ const Configs: FC = () => {
8577
size="md"
8678
leftSection={<Icon path={saved ? mdiContentSaveOutline : mdiCheck} size={1} />}
8779
onClick={() => {
88-
updateConfig({ globalConfig, accountPolicy, containerPolicy })
80+
updateConfig({
81+
globalConfig: {
82+
...(globalConfig ?? {}),
83+
customTheme: color && /^#[0-9A-F]{6}$/i.test(color) ? color : '',
84+
},
85+
accountPolicy,
86+
containerPolicy,
87+
})
8988
setSaved(false)
9089
setTimeout(() => {
9190
setSaved(true)

0 commit comments

Comments
 (0)