[pmg-devel] [PATCH pmg-gui 2/3] quarantines: fix the default behavior of the theme toggle button

Stefan Sterz s.sterz at proxmox.com
Thu Mar 23 16:44:54 CET 2023


since the default theme is "auto" now, the behavior of the dark theme
toggle needs to be adjust accordingly.

Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
---
checking for null here explicitly as that is the documented behavior
if the cookie does not exist [1].

https://docs-devel.sencha.com/extjs/6.0.0/classic/Ext.util.Cookies.html#method-get

 js/controller/QuarantineController.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/js/controller/QuarantineController.js b/js/controller/QuarantineController.js
index 15e69fa..3135e2b 100644
--- a/js/controller/QuarantineController.js
+++ b/js/controller/QuarantineController.js
@@ -194,7 +194,7 @@ Ext.define('PMG.controller.QuarantineController', {
 	let me = this;
 	let currentTheme = Ext.util.Cookies.get("PMGThemeCookie");
 
-	if (currentTheme === "auto") {
+	if (currentTheme === "__default__" || currentTheme === null) {
 	    me.mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)");
 
 	    me.themeListener = (e) => {
@@ -207,7 +207,7 @@ Ext.define('PMG.controller.QuarantineController', {
 
 	    me.themeListener(me.mediaQueryList);
 	    me.mediaQueryList.addEventListener("change", me.themeListener);
-	} else if (currentTheme === "__default__") {
+	} else if (currentTheme === "crisp") {
 	    me.hideThemeToggle();
 	} else {
 	    me.showThemeToggle();
-- 
2.30.2





More information about the pmg-devel mailing list