Pull request: fix missing icons on login page

Updates #5620

Squashed commit of the following:

commit 61969c83c3dd6bd6688f0aabc9d6160b53701866
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Apr 10 14:50:47 2023 +0300

    AG-20691 fix theme select on login page

commit c87b6c37284021f33f440dcd31be5b653e8e689d
Merge: aa744756 89bf3721
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Apr 10 14:21:01 2023 +0300

    Merge branch 'master' into AG-20691

commit aa744756d18d9ed3bc7f60108235d8403e7cb5e0
Author: Ildar Kamalov <ik@adguard.com>
Date:   Fri Apr 7 15:53:38 2023 +0300

    AG-20691 fix missing icons on login page
This commit is contained in:
Ildar Kamalov
2023-04-10 17:12:52 +03:00
parent 89bf3721b5
commit 9e14d5f99f
4 changed files with 20 additions and 7 deletions

View File

@@ -25,6 +25,7 @@ import {
STANDARD_HTTPS_PORT,
STANDARD_WEB_PORT,
SPECIAL_FILTER_ID,
THEMES,
} from './constants';
/**
@@ -684,7 +685,14 @@ export const setHtmlLangAttr = (language) => {
* @param theme
*/
export const setUITheme = (theme) => {
document.body.dataset.theme = theme;
let currentTheme = theme;
if (currentTheme === THEMES.auto) {
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
currentTheme = prefersDark ? THEMES.dark : THEMES.light;
}
document.body.dataset.theme = currentTheme;
};
/**