Respect site cfg_json theme on first-run; add user_theme_selected flag; set flag when user selects theme or URL param
This commit is contained in:
@@ -316,9 +316,14 @@ $effect(() => {
|
||||
const url_theme = data.url.searchParams.get('theme');
|
||||
const url_theme_mode = data.url.searchParams.get('theme_mode');
|
||||
if (url_theme || url_theme_mode) {
|
||||
if (url_theme) $ae_loc.theme_name = url_theme;
|
||||
if (url_theme_mode === 'light' || url_theme_mode === 'dark')
|
||||
$ae_loc.theme_mode = url_theme_mode;
|
||||
if (url_theme) {
|
||||
// Mark that the user (or URL) explicitly chose a theme so site defaults
|
||||
// won't overwrite it later on subsequent loads.
|
||||
ae_loc.update((l: any) => ({ ...l, theme_name: url_theme, user_theme_selected: true }));
|
||||
}
|
||||
if (url_theme_mode === 'light' || url_theme_mode === 'dark') {
|
||||
ae_loc.update((l: any) => ({ ...l, theme_mode: url_theme_mode }));
|
||||
}
|
||||
const clean_url = new URL(data.url.href);
|
||||
clean_url.searchParams.delete('theme');
|
||||
clean_url.searchParams.delete('theme_mode');
|
||||
|
||||
Reference in New Issue
Block a user