Enable night mode on /login if that's the system preferred color scheme (references #71)

This commit is contained in:
Bernd Bestel 2024-01-28 09:39:58 +01:00
parent 4659f51551
commit 15ab198af0
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 5 additions and 4 deletions

View File

@ -57,6 +57,7 @@
### General
- Night mode is now also used on the login page if that's the system preferred color scheme (generally if night mode is on or not is based on user settings and before logging in no user context is available)
- Optimized sidebar icon spacing (thanks @chris-thorn)
- Fixed that file uploads (product pictures and so on) didn't work for files where the file name contains multiple spaces
- Fixed that some dialogs were not properly (too small) displayed in Firefox >= 121

View File

@ -49,9 +49,9 @@ $("#auto-night-mode-time-range-goes-over-midgnight").on("change", function()
function CheckNightMode()
{
if (Grocy.UserId === -1)
if (Grocy.UserId === -1) // Not logged in => always use system preferred color scheme
{
return;
Grocy.UserSettings.night_mode = "follow-system";
}
var nightModeEnabledInternalBefore = Grocy.UserSettings.night_mode_enabled_internal;
@ -132,8 +132,6 @@ if (Grocy.UserId !== -1)
$("#auto-night-mode-time-range-from").trigger("keyup");
$("#auto-night-mode-time-range-to").val(Grocy.UserSettings.auto_night_mode_time_range_to);
$("#auto-night-mode-time-range-to").trigger("keyup");
CheckNightMode();
}
if (Grocy.Mode === "production")
@ -144,3 +142,5 @@ else
{
setInterval(CheckNightMode, 4000);
}
CheckNightMode();