fix(config): options are not getting reflected in fav light/dark theme select, closes #1079

This commit is contained in:
kunish 2024-10-12 22:48:08 +08:00
parent f2578c958d
commit ae1158d957
No known key found for this signature in database
GPG Key ID: 67D3ACD788F3A7CD
2 changed files with 17 additions and 4 deletions

View File

@ -27,6 +27,13 @@ export const App: ParentComponent = ({ children }) => {
const prefersDark = usePrefersDark()
createEffect(() => {
console.log(
autoSwitchTheme(),
prefersDark(),
favNightTheme(),
favDayTheme(),
)
if (autoSwitchTheme())
setCurTheme(prefersDark() ? favNightTheme() : favDayTheme())
})

View File

@ -492,13 +492,16 @@ const ConfigForXd = () => {
<ConfigTitle>{t('favDayTheme')}</ConfigTitle>
<Select
value={favDayTheme()}
onChange={(e) =>
setFavDayTheme(e.target.value as (typeof themes)[number])
}
>
<For each={themes}>
{(theme) => <option value={theme}>{theme}</option>}
{(theme) => (
<option selected={favDayTheme() === theme} value={theme}>
{theme}
</option>
)}
</For>
</Select>
</div>
@ -507,13 +510,16 @@ const ConfigForXd = () => {
<ConfigTitle>{t('favNightTheme')}</ConfigTitle>
<Select
value={favNightTheme()}
onChange={(e) =>
setFavNightTheme(e.target.value as (typeof themes)[number])
}
>
<For each={themes}>
{(theme) => <option value={theme}>{theme}</option>}
{(theme) => (
<option selected={favNightTheme() === theme} value={theme}>
{theme}
</option>
)}
</For>
</Select>
</div>