From 1d8cd8e03042daf8dd3c018c5fb48e2cd2df3ef1 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Wed, 17 Nov 2021 14:03:02 +0530 Subject: [PATCH] refactor: Revert unnecessary changes and update style --- frappe/public/js/frappe/ui/theme_switcher.js | 26 +++++++++++--------- frappe/public/scss/desk/theme_switcher.scss | 3 ++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/frappe/public/js/frappe/ui/theme_switcher.js b/frappe/public/js/frappe/ui/theme_switcher.js index 4f263e8f1e..3680089e3c 100644 --- a/frappe/public/js/frappe/ui/theme_switcher.js +++ b/frappe/public/js/frappe/ui/theme_switcher.js @@ -54,10 +54,12 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher { { name: "light", label: __("Frappe Light"), + info: __("Light Theme") }, { name: "dark", label: __("Timeless Night"), + info: __("Dark Theme") }, { name: "automatic", @@ -79,11 +81,15 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher { } get_preview_html(theme) { + const is_auto_theme = theme.name === "automatic"; const preview = $(`
-
+
-
${frappe.utils.icon('tick', 'xs')}
+
+ ${frappe.utils.icon('tick', 'xs')} +
@@ -115,20 +121,16 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher { return preview; } - toggle_theme(theme, options = { save_preferences: true, show_alert: true }) { + toggle_theme(theme) { this.current_theme = theme.toLowerCase(); document.documentElement.setAttribute("data-theme-mode", this.current_theme); + frappe.show_alert("Theme Changed", 3); - if (options && options.show_alert) { - frappe.show_alert("Theme Changed", 3); - } - - if (options && options.save_preferences) { - frappe.xcall("frappe.core.doctype.user.user.switch_theme", { - theme: toTitle(theme) - }); - } + frappe.xcall("frappe.core.doctype.user.user.switch_theme", { + theme: toTitle(theme) + }); } + show() { this.dialog.show(); } diff --git a/frappe/public/scss/desk/theme_switcher.scss b/frappe/public/scss/desk/theme_switcher.scss index c8ff4d3bef..924c2edd9d 100644 --- a/frappe/public/scss/desk/theme_switcher.scss +++ b/frappe/public/scss/desk/theme_switcher.scss @@ -28,6 +28,7 @@ margin-right: var(--margin-sm); border-radius: var(--border-radius-full); + z-index: 1; } } @@ -84,7 +85,7 @@ } // TODO: Replace with better alternative -[data-theme="automatic"] { +[data-is-auto-theme="true"] { .background::after { content: ""; top: 0;