From 30e7d99f5fcd618b169f72b09a51b460122a9178 Mon Sep 17 00:00:00 2001 From: Kovah Date: Thu, 16 Mar 2023 22:35:12 +0100 Subject: [PATCH] Correctly set dark mode for guests including login views (#619) --- app/Helper/functions.php | 10 ++++++++++ resources/assets/sass/_variables-dark.scss | 6 ++++++ resources/views/partials/configure-darkmode.blade.php | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/Helper/functions.php b/app/Helper/functions.php index b83e0ac4..b97fd999 100644 --- a/app/Helper/functions.php +++ b/app/Helper/functions.php @@ -209,3 +209,13 @@ function escapeSearchQuery(string $query): string $query ); } + +/** + * Get a list of all routes that are accessible by guests. + * + * @return string[] + */ +function guestRoutes(): array +{ + return ['guest/*', 'login', 'forgot-password', 'reset-password/*', 'two-factor-challenge', 'email/verify']; +} diff --git a/resources/assets/sass/_variables-dark.scss b/resources/assets/sass/_variables-dark.scss index ee031d2c..0c3f7bf5 100644 --- a/resources/assets/sass/_variables-dark.scss +++ b/resources/assets/sass/_variables-dark.scss @@ -151,6 +151,11 @@ $card-cap-bg: $darkmode-bg; $card-bg: $darkmode-bg; +// Inputs +$input-group-addon-bg: $input-bg !default; +$input-group-addon-border-color: $input-border-color !default; + + // List group $list-group-bg: $darkmode-bg; $list-group-color: $body-color; @@ -167,6 +172,7 @@ $list-group-action-color: $white; $list-group-action-active-color: $white; $list-group-action-active-bg: $darkmode-bg-dark; + // Alerts $alert-bg-level: +8; $alert-border-level: +7; diff --git a/resources/views/partials/configure-darkmode.blade.php b/resources/views/partials/configure-darkmode.blade.php index 85ef640c..f5ac1702 100644 --- a/resources/views/partials/configure-darkmode.blade.php +++ b/resources/views/partials/configure-darkmode.blade.php @@ -1,8 +1,8 @@ @if(usersettings('darkmode_setting') === '1' - || (request()->is('guest/*') && systemsettings('guest_darkmode_setting') === '1')) + || (request()->is(...guestRoutes()) && systemsettings('guest_darkmode_setting') === '1')) @elseif(usersettings('darkmode_setting') === '2' - || (request()->is('guest/*') && systemsettings('guest_darkmode_setting') === '2')) + || (request()->is(...guestRoutes()) && systemsettings('guest_darkmode_setting') === '2')) @else