From c9113cacd4617c30bff4a45275ef9f9eb7c0560f Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Tue, 7 Jul 2026 09:09:34 -0400 Subject: [PATCH 01/27] added radio to settings page --- src/WebApp/Pages/Account/Edit.cshtml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/WebApp/Pages/Account/Edit.cshtml b/src/WebApp/Pages/Account/Edit.cshtml index 2502512d9..474702e52 100644 --- a/src/WebApp/Pages/Account/Edit.cshtml +++ b/src/WebApp/Pages/Account/Edit.cshtml @@ -1,4 +1,4 @@ -@page +@page @using AirWeb.WebApp.Pages.Shared.EditorTemplates @model EditModel @{ @@ -24,7 +24,27 @@ @Html.EditorFor(m => m.UpdateStaff.OfficeId, EditorTemplate.Select, additionalViewData: new { Items = Model.OfficeSelectList }) +
+ +
+ + + + + + + + +
+
+ From a7e33084a35847dd394a0de1c038db892d8817c0 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Thu, 16 Jul 2026 10:42:00 -0400 Subject: [PATCH 02/27] UserPreferences created --- src/Domain.Core/Entities/UserPreferences.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/Domain.Core/Entities/UserPreferences.cs diff --git a/src/Domain.Core/Entities/UserPreferences.cs b/src/Domain.Core/Entities/UserPreferences.cs new file mode 100644 index 000000000..835d86712 --- /dev/null +++ b/src/Domain.Core/Entities/UserPreferences.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace AirWeb.Domain.Core.Entities; + +public class UserPreferences +{ + public ThemePreference Theme { get; set; } = ThemePreference.Auto; +} +public enum ThemePreference +{ + Auto = 0, + Light = 1, + Dark = 2, +} From 53c8bef03a6b7298864c185e1f6d2ae0873c74b7 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Thu, 16 Jul 2026 11:31:42 -0400 Subject: [PATCH 03/27] Added userpreference to application user --- src/Domain.Core/Entities/ApplicationUser.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Domain.Core/Entities/ApplicationUser.cs b/src/Domain.Core/Entities/ApplicationUser.cs index 73089f679..1c2a09300 100644 --- a/src/Domain.Core/Entities/ApplicationUser.cs +++ b/src/Domain.Core/Entities/ApplicationUser.cs @@ -1,4 +1,4 @@ -using GaEpd.AppLibrary.Extensions; +using GaEpd.AppLibrary.Extensions; using Microsoft.AspNetCore.Identity; using System.Text; @@ -37,6 +37,8 @@ public sealed class ApplicationUser : IdentityUser, IEntity public string SortableFullName => new[] { FamilyName, GivenName }.ConcatWithSeparator(", "); public string FullName => new[] { GivenName, FamilyName }.ConcatWithSeparator(); + public UserPreferences UserPreferences { get; set; } + public string SortableNameWithInactive { get From c832a5468bb0e40f0ea9550eeb7b172e63c40a60 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Mon, 20 Jul 2026 10:58:12 -0400 Subject: [PATCH 04/27] added display to enum, moved radio --- src/Domain.Core/Entities/UserPreferences.cs | 5 +++++ src/WebApp/Pages/Account/Edit.cshtml | 20 -------------------- src/WebApp/Pages/Account/Index.cshtml | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/Domain.Core/Entities/UserPreferences.cs b/src/Domain.Core/Entities/UserPreferences.cs index 835d86712..d152884b7 100644 --- a/src/Domain.Core/Entities/UserPreferences.cs +++ b/src/Domain.Core/Entities/UserPreferences.cs @@ -10,7 +10,12 @@ public class UserPreferences } public enum ThemePreference { + [Display(Name = "Auto")] Auto = 0, + + [Display(Name = "Light")] Light = 1, + + [Display(Name = "Dark")] Dark = 2, } diff --git a/src/WebApp/Pages/Account/Edit.cshtml b/src/WebApp/Pages/Account/Edit.cshtml index 474702e52..3287a70ce 100644 --- a/src/WebApp/Pages/Account/Edit.cshtml +++ b/src/WebApp/Pages/Account/Edit.cshtml @@ -24,26 +24,6 @@ @Html.EditorFor(m => m.UpdateStaff.OfficeId, EditorTemplate.Select, additionalViewData: new { Items = Model.OfficeSelectList }) -
- - -
- - - - - - - - -
-
diff --git a/src/WebApp/Pages/Account/Index.cshtml b/src/WebApp/Pages/Account/Index.cshtml index 9d3423d0f..043783917 100644 --- a/src/WebApp/Pages/Account/Index.cshtml +++ b/src/WebApp/Pages/Account/Index.cshtml @@ -28,7 +28,26 @@
@Html.DisplayFor(m => m.OfficeName, DisplayTemplate.TextOrPlaceholder, additionalViewData: new { Placeholder = DefaultText.PlaceholderNone })
+
+ + +
+ + + + + + + +
+
@if (Model.DisplayStaff is { Active: true, Email: not null }) { From 2a779c8394d0669a4084cfcd393fa2101364575a Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Thu, 23 Jul 2026 10:48:53 -0400 Subject: [PATCH 05/27] GetPreferencesAsync created --- src/AppServices.Core/EntityServices/Staff/StaffService.cs | 7 +++++++ src/Domain.Core/Entities/ApplicationUser.cs | 2 +- src/WebApp/Pages/Account/Index.cshtml.cs | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/AppServices.Core/EntityServices/Staff/StaffService.cs b/src/AppServices.Core/EntityServices/Staff/StaffService.cs index 2d34a22aa..709a1f88c 100644 --- a/src/AppServices.Core/EntityServices/Staff/StaffService.cs +++ b/src/AppServices.Core/EntityServices/Staff/StaffService.cs @@ -31,6 +31,7 @@ public interface IStaffService : IDisposable, IAsyncDisposable Task> GetAppRolesAsync(string id); Task UpdateRolesAsync(string id, Dictionary roles); Task UpdateAsync(string id, StaffUpdateDto resource); + Task GetPreferencesAsync(); } public sealed class StaffService( @@ -175,7 +176,13 @@ public async Task UpdateAsync(string id, StaffUpdateDto resource await cache.RemoveByTagAsync(CachedStaffLists).ConfigureAwait(false); return await userManager.UpdateAsync(user).ConfigureAwait(false); } + public async Task GetPreferencesAsync() + { + var user = await userService.GetCurrentUserAsync().ConfigureAwait(false) + ?? throw new CurrentUserNotFoundException(); + return user.Preferences ?? new UserPreferences(); + } #region IDisposable, IAsyncDisposable public void Dispose() diff --git a/src/Domain.Core/Entities/ApplicationUser.cs b/src/Domain.Core/Entities/ApplicationUser.cs index 1c2a09300..4d7b3479c 100644 --- a/src/Domain.Core/Entities/ApplicationUser.cs +++ b/src/Domain.Core/Entities/ApplicationUser.cs @@ -37,7 +37,7 @@ public sealed class ApplicationUser : IdentityUser, IEntity public string SortableFullName => new[] { FamilyName, GivenName }.ConcatWithSeparator(", "); public string FullName => new[] { GivenName, FamilyName }.ConcatWithSeparator(); - public UserPreferences UserPreferences { get; set; } + public UserPreferences Preferences { get; set; } public string SortableNameWithInactive { diff --git a/src/WebApp/Pages/Account/Index.cshtml.cs b/src/WebApp/Pages/Account/Index.cshtml.cs index 653471aa9..4941e86ab 100644 --- a/src/WebApp/Pages/Account/Index.cshtml.cs +++ b/src/WebApp/Pages/Account/Index.cshtml.cs @@ -1,8 +1,10 @@ -using AirWeb.AppServices.Core.AuthorizationServices; +using AirWeb.AppServices.Core.AuthorizationServices; using AirWeb.AppServices.Core.EntityServices.Staff; using AirWeb.AppServices.Core.EntityServices.Staff.Dto; using AirWeb.Domain.Core.AppRoles; +using AirWeb.Domain.Core.Entities; using AirWeb.WebApp.Models; +using DocumentFormat.OpenXml.Presentation; namespace AirWeb.WebApp.Pages.Account; @@ -10,6 +12,7 @@ namespace AirWeb.WebApp.Pages.Account; public class AccountIndexModel : PageModel { public StaffViewDto DisplayStaff { get; private set; } = null!; + public UserPreferences Preferences { get; private set; } = null!; public string? OfficeName => DisplayStaff.Office?.Name; public IReadOnlyList Roles { get; private set; } = null!; @@ -17,6 +20,7 @@ public async Task OnGetAsync([FromServices] IStaffService staffSe { DisplayStaff = await staffService.GetCurrentUserAsync(); Roles = await staffService.GetAppRolesAsync(DisplayStaff.Id); + if (DisplayStaff.Office is null) TempData.AddDisplayMessage(DisplayMessage.AlertContext.Warning, From edce3065a0191027afc8ee6e3d0b39bbd5353e85 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Thu, 23 Jul 2026 10:56:48 -0400 Subject: [PATCH 06/27] implemented in index.cs --- src/WebApp/Pages/Account/Index.cshtml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebApp/Pages/Account/Index.cshtml.cs b/src/WebApp/Pages/Account/Index.cshtml.cs index 4941e86ab..d2e2142aa 100644 --- a/src/WebApp/Pages/Account/Index.cshtml.cs +++ b/src/WebApp/Pages/Account/Index.cshtml.cs @@ -20,7 +20,7 @@ public async Task OnGetAsync([FromServices] IStaffService staffSe { DisplayStaff = await staffService.GetCurrentUserAsync(); Roles = await staffService.GetAppRolesAsync(DisplayStaff.Id); - + Preferences = await staffService.GetPreferencesAsync(); if (DisplayStaff.Office is null) TempData.AddDisplayMessage(DisplayMessage.AlertContext.Warning, From 0e717487a88a80565217e3d849e455eb1d637e7e Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Fri, 24 Jul 2026 09:55:34 -0400 Subject: [PATCH 07/27] Added test to see if theme displays. dark set to test if default theme appears --- src/Domain.Core/Entities/UserPreferences.cs | 2 +- src/WebApp/Pages/Account/Index.cshtml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Domain.Core/Entities/UserPreferences.cs b/src/Domain.Core/Entities/UserPreferences.cs index d152884b7..48ccd7f94 100644 --- a/src/Domain.Core/Entities/UserPreferences.cs +++ b/src/Domain.Core/Entities/UserPreferences.cs @@ -6,7 +6,7 @@ namespace AirWeb.Domain.Core.Entities; public class UserPreferences { - public ThemePreference Theme { get; set; } = ThemePreference.Auto; + public ThemePreference Theme { get; set; } = ThemePreference.Dark; } public enum ThemePreference { diff --git a/src/WebApp/Pages/Account/Index.cshtml b/src/WebApp/Pages/Account/Index.cshtml index 043783917..c3e719b81 100644 --- a/src/WebApp/Pages/Account/Index.cshtml +++ b/src/WebApp/Pages/Account/Index.cshtml @@ -27,8 +27,13 @@
Office
@Html.DisplayFor(m => m.OfficeName, DisplayTemplate.TextOrPlaceholder, additionalViewData: new { Placeholder = DefaultText.PlaceholderNone })
+
Theme
+
+ @Model.Preferences.Theme +
+
From c635604baeb2e6a05e11d9ddc5adc6f371427776 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Fri, 24 Jul 2026 10:51:17 -0400 Subject: [PATCH 08/27] Removed display names --- src/Domain.Core/Entities/UserPreferences.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Domain.Core/Entities/UserPreferences.cs b/src/Domain.Core/Entities/UserPreferences.cs index 48ccd7f94..21ed9f63b 100644 --- a/src/Domain.Core/Entities/UserPreferences.cs +++ b/src/Domain.Core/Entities/UserPreferences.cs @@ -10,12 +10,7 @@ public class UserPreferences } public enum ThemePreference { - [Display(Name = "Auto")] Auto = 0, - - [Display(Name = "Light")] Light = 1, - - [Display(Name = "Dark")] Dark = 2, } From 03d558d8291cf701218064e6fabf392b35c17904 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Mon, 27 Jul 2026 11:45:25 -0400 Subject: [PATCH 09/27] changed Preferences to make it create when application user is created --- src/Domain.Core/Entities/ApplicationUser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domain.Core/Entities/ApplicationUser.cs b/src/Domain.Core/Entities/ApplicationUser.cs index 4d7b3479c..74a2c8859 100644 --- a/src/Domain.Core/Entities/ApplicationUser.cs +++ b/src/Domain.Core/Entities/ApplicationUser.cs @@ -37,7 +37,7 @@ public sealed class ApplicationUser : IdentityUser, IEntity public string SortableFullName => new[] { FamilyName, GivenName }.ConcatWithSeparator(", "); public string FullName => new[] { GivenName, FamilyName }.ConcatWithSeparator(); - public UserPreferences Preferences { get; set; } + public UserPreferences Preferences { get; set; } = new(); public string SortableNameWithInactive { From 6fb274be1cd94b2c220c9dd198773b27d16b84f2 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Tue, 28 Jul 2026 11:05:02 -0400 Subject: [PATCH 10/27] Created UpdateThemePreferenceAsync --- .../EntityServices/Staff/StaffService.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/AppServices.Core/EntityServices/Staff/StaffService.cs b/src/AppServices.Core/EntityServices/Staff/StaffService.cs index 709a1f88c..98986ad9e 100644 --- a/src/AppServices.Core/EntityServices/Staff/StaffService.cs +++ b/src/AppServices.Core/EntityServices/Staff/StaffService.cs @@ -32,6 +32,8 @@ public interface IStaffService : IDisposable, IAsyncDisposable Task UpdateRolesAsync(string id, Dictionary roles); Task UpdateAsync(string id, StaffUpdateDto resource); Task GetPreferencesAsync(); + Task UpdateThemePreferenceAsync(ThemePreference theme); + } public sealed class StaffService( @@ -183,6 +185,14 @@ public async Task GetPreferencesAsync() return user.Preferences ?? new UserPreferences(); } + public async Task UpdateThemePreferenceAsync(ThemePreference theme) + { + var user = await userService.GetCurrentUserAsync() + ?? throw new CurrentUserNotFoundException(); + + user.Preferences.Theme = theme; + await userManager.UpdateAsync(user); + } #region IDisposable, IAsyncDisposable public void Dispose() From d56cf62f3d6a126daf04a40d9e4a7afa8eda6f0e Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Wed, 29 Jul 2026 10:48:42 -0400 Subject: [PATCH 11/27] made radio a form. Checks correct theme --- src/WebApp/Pages/Account/Index.cshtml | 38 +++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/WebApp/Pages/Account/Index.cshtml b/src/WebApp/Pages/Account/Index.cshtml index c3e719b81..4ec755798 100644 --- a/src/WebApp/Pages/Account/Index.cshtml +++ b/src/WebApp/Pages/Account/Index.cshtml @@ -1,5 +1,6 @@ @page @using AirWeb.WebApp.Pages.Shared.DisplayTemplates +@using AirWeb.Domain.Core.Entities @model AccountIndexModel @{ ViewData["Title"] = "Account Profile"; @@ -27,32 +28,59 @@
Office
@Html.DisplayFor(m => m.OfficeName, DisplayTemplate.TextOrPlaceholder, additionalViewData: new { Placeholder = DefaultText.PlaceholderNone })
+
Theme
@Model.Preferences.Theme
-
+ +
- + + + - + + - + +
-
+ + + + +
@if (Model.DisplayStaff is { Active: true, Email: not null }) { From 7d27fcf5133af00290ca3a5ed670c09ab750091f Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Thu, 30 Jul 2026 11:34:45 -0400 Subject: [PATCH 12/27] Added OnPost method --- src/WebApp/Pages/Account/Index.cshtml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/WebApp/Pages/Account/Index.cshtml.cs b/src/WebApp/Pages/Account/Index.cshtml.cs index d2e2142aa..3d6afc077 100644 --- a/src/WebApp/Pages/Account/Index.cshtml.cs +++ b/src/WebApp/Pages/Account/Index.cshtml.cs @@ -28,4 +28,9 @@ public async Task OnGetAsync([FromServices] IStaffService staffSe return Page(); } + public async Task OnPostAsync(ThemePreference theme, [FromServices] IStaffService staffservice) + { + await staffservice.UpdateThemePreferenceAsync(theme); + return RedirectToPage(); + } } From 8a183510390045f6b41b65fd3870bf2e688cf8db Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Mon, 3 Aug 2026 11:09:25 -0400 Subject: [PATCH 13/27] removed localstorage and implemented preferredtheme --- src/WebApp/wwwroot/js/color-modes.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/WebApp/wwwroot/js/color-modes.js b/src/WebApp/wwwroot/js/color-modes.js index ead60d519..892b85ccd 100644 --- a/src/WebApp/wwwroot/js/color-modes.js +++ b/src/WebApp/wwwroot/js/color-modes.js @@ -1,4 +1,4 @@ -/*! +/*! * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) * Copyright 2011-2025 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. @@ -7,16 +7,8 @@ (() => { 'use strict' - const getStoredTheme = () => localStorage.getItem('theme') - const setStoredTheme = theme => localStorage.setItem('theme', theme) - const getPreferredTheme = () => { - const storedTheme = getStoredTheme() - if (storedTheme) { - return storedTheme - } - - return globalThis.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' + return document.documentElement.dataset.themePreference ?? 'auto'; } const setTheme = theme => { From de1497b1c2cfdf37a63f570dc15e27fceb95443b Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Tue, 4 Aug 2026 10:41:02 -0400 Subject: [PATCH 14/27] added Preferences variable to layout --- src/WebApp/Pages/Shared/_Layout.cshtml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/WebApp/Pages/Shared/_Layout.cshtml b/src/WebApp/Pages/Shared/_Layout.cshtml index dabf822cd..f61051fe1 100644 --- a/src/WebApp/Pages/Shared/_Layout.cshtml +++ b/src/WebApp/Pages/Shared/_Layout.cshtml @@ -1,8 +1,11 @@ +@inject AirWeb.AppServices.Core.EntityServices.Staff.IStaffService StaffService @{ var displayMessages = TempData.GetDisplayMessages(); + var preferences = await StaffService.GetPreferencesAsync(); } - + From b8d4fa933b49fbe3b5e18e7b1bd5ebf679fb3d0d Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Tue, 4 Aug 2026 10:50:25 -0400 Subject: [PATCH 15/27] changed auto to match preference auto --- src/WebApp/wwwroot/js/color-modes.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/WebApp/wwwroot/js/color-modes.js b/src/WebApp/wwwroot/js/color-modes.js index 892b85ccd..ad9e7d5b7 100644 --- a/src/WebApp/wwwroot/js/color-modes.js +++ b/src/WebApp/wwwroot/js/color-modes.js @@ -53,9 +53,8 @@ } globalThis.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { - const storedTheme = getStoredTheme() - if (storedTheme !== 'light' && storedTheme !== 'dark') { - setTheme(getPreferredTheme()) + if (getPreferredTheme() === 'auto') { + setTheme('auto') } }) From e3d27b7d8e65c47b585c85ebf884928f633f8782 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Tue, 4 Aug 2026 10:55:06 -0400 Subject: [PATCH 16/27] deleted old navbar theme methods --- src/WebApp/wwwroot/js/color-modes.js | 45 ---------------------------- 1 file changed, 45 deletions(-) diff --git a/src/WebApp/wwwroot/js/color-modes.js b/src/WebApp/wwwroot/js/color-modes.js index ad9e7d5b7..12fc2c627 100644 --- a/src/WebApp/wwwroot/js/color-modes.js +++ b/src/WebApp/wwwroot/js/color-modes.js @@ -21,54 +21,9 @@ setTheme(getPreferredTheme()) - const showActiveTheme = (theme, focus = false) => { - const themeSwitcher = document.querySelector('#bd-theme') - - if (!themeSwitcher) { - return - } - - const themeSwitcherText = document.querySelector('#bd-theme-text') - const activeThemeIcon = document.querySelector('.theme-icon-active use') - const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`) - const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href') - - document.querySelectorAll('[data-bs-theme-value]').forEach(element => { - element.classList.remove('active') - element.setAttribute('aria-pressed', 'false') - element.querySelector('.theme-checkmark').classList.add('d-none') - }) - - btnToActive.classList.add('active') - btnToActive.setAttribute('aria-pressed', 'true') - btnToActive.querySelector('.theme-checkmark').classList.remove('d-none') - activeThemeIcon.setAttribute('href', svgOfActiveBtn) - const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})` - themeSwitcher.setAttribute('aria-label', themeSwitcherLabel) - themeSwitcher.setAttribute('title', themeSwitcherLabel) - - if (focus) { - themeSwitcher.focus() - } - } - globalThis.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { if (getPreferredTheme() === 'auto') { setTheme('auto') } }) - - globalThis.addEventListener('DOMContentLoaded', () => { - showActiveTheme(getPreferredTheme()) - - document.querySelectorAll('[data-bs-theme-value]') - .forEach(toggle => { - toggle.addEventListener('click', () => { - const theme = toggle.dataset.bsThemeValue - setStoredTheme(theme) - setTheme(theme) - showActiveTheme(theme, true) - }) - }) - }) })() From e24e334d6dbab90104de77a6ceae67dd5c92c5ec Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Tue, 4 Aug 2026 11:01:40 -0400 Subject: [PATCH 17/27] removed dropdown --- .../Shared/Components/MainMenu/Default.cshtml | 40 +------------------ 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/src/WebApp/Pages/Shared/Components/MainMenu/Default.cshtml b/src/WebApp/Pages/Shared/Components/MainMenu/Default.cshtml index af61557a8..9ae0bb1bd 100644 --- a/src/WebApp/Pages/Shared/Components/MainMenu/Default.cshtml +++ b/src/WebApp/Pages/Shared/Components/MainMenu/Default.cshtml @@ -1,4 +1,4 @@ -@model MainMenuViewComponent.MenuParams +@model MainMenuViewComponent.MenuParams
From 56ec29fcb649b4834f2c3260c725109cf5bd4846 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Fri, 7 Aug 2026 09:44:38 -0400 Subject: [PATCH 18/27] easier to read --- src/WebApp/wwwroot/js/color-modes.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WebApp/wwwroot/js/color-modes.js b/src/WebApp/wwwroot/js/color-modes.js index 12fc2c627..8cda0e2a3 100644 --- a/src/WebApp/wwwroot/js/color-modes.js +++ b/src/WebApp/wwwroot/js/color-modes.js @@ -13,7 +13,8 @@ const setTheme = theme => { if (theme === 'auto') { - document.documentElement.dataset.bsTheme = globalThis.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' + document.documentElement.dataset.bsTheme = + globalThis.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' } else { document.documentElement.dataset.bsTheme = theme } From 99e79757d904e6c3a3a0cabb50e12f5abc083de5 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Mon, 10 Aug 2026 09:08:36 -0400 Subject: [PATCH 19/27] fixed button name --- src/WebApp/Pages/Account/Index.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebApp/Pages/Account/Index.cshtml b/src/WebApp/Pages/Account/Index.cshtml index 4ec755798..843ba73f9 100644 --- a/src/WebApp/Pages/Account/Index.cshtml +++ b/src/WebApp/Pages/Account/Index.cshtml @@ -76,7 +76,7 @@
From 26b4550bdd61ec8ceb6473f769f0b24d9d2fe434 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Mon, 10 Aug 2026 09:17:16 -0400 Subject: [PATCH 20/27] fixed preference methods --- src/AppServices.Core/EntityServices/Staff/StaffService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AppServices.Core/EntityServices/Staff/StaffService.cs b/src/AppServices.Core/EntityServices/Staff/StaffService.cs index 98986ad9e..bc6942fa8 100644 --- a/src/AppServices.Core/EntityServices/Staff/StaffService.cs +++ b/src/AppServices.Core/EntityServices/Staff/StaffService.cs @@ -183,7 +183,7 @@ public async Task GetPreferencesAsync() var user = await userService.GetCurrentUserAsync().ConfigureAwait(false) ?? throw new CurrentUserNotFoundException(); - return user.Preferences ?? new UserPreferences(); + return user.Preferences; } public async Task UpdateThemePreferenceAsync(ThemePreference theme) { @@ -191,7 +191,7 @@ public async Task UpdateThemePreferenceAsync(ThemePreference theme) ?? throw new CurrentUserNotFoundException(); user.Preferences.Theme = theme; - await userManager.UpdateAsync(user); + await userManager.UpdateAsync(user).ConfigureAwait(false); } #region IDisposable, IAsyncDisposable From f38afb3e95bf48454785ff43c0d1bdc6aa63aa18 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Mon, 10 Aug 2026 11:22:59 -0400 Subject: [PATCH 21/27] checks to see if user is logged in before checking preference --- .../EntityServices/Staff/StaffService.cs | 4 ++-- src/WebApp/Pages/Shared/_Layout.cshtml | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/AppServices.Core/EntityServices/Staff/StaffService.cs b/src/AppServices.Core/EntityServices/Staff/StaffService.cs index bc6942fa8..c53c6dba2 100644 --- a/src/AppServices.Core/EntityServices/Staff/StaffService.cs +++ b/src/AppServices.Core/EntityServices/Staff/StaffService.cs @@ -180,8 +180,8 @@ public async Task UpdateAsync(string id, StaffUpdateDto resource } public async Task GetPreferencesAsync() { - var user = await userService.GetCurrentUserAsync().ConfigureAwait(false) - ?? throw new CurrentUserNotFoundException(); + var user = await userService.GetCurrentUserAsync() + ?? throw new CurrentUserNotFoundException(); return user.Preferences; } diff --git a/src/WebApp/Pages/Shared/_Layout.cshtml b/src/WebApp/Pages/Shared/_Layout.cshtml index f61051fe1..177707875 100644 --- a/src/WebApp/Pages/Shared/_Layout.cshtml +++ b/src/WebApp/Pages/Shared/_Layout.cshtml @@ -1,11 +1,16 @@ @inject AirWeb.AppServices.Core.EntityServices.Staff.IStaffService StaffService @{ var displayMessages = TempData.GetDisplayMessages(); - var preferences = await StaffService.GetPreferencesAsync(); + var themePreference = "auto"; + if (User.Identity?.IsAuthenticated == true) + { + var preferences = await StaffService.GetPreferencesAsync(); + themePreference = preferences.Theme.ToString().ToLower(); + } } + data-theme-preference="@themePreference"> From 0e9affc4eca71750f3029f396eab06db465bde59 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Wed, 12 Aug 2026 11:20:13 -0400 Subject: [PATCH 22/27] added event listener to detect theme changes --- src/WebApp/wwwroot/js/color-modes.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/WebApp/wwwroot/js/color-modes.js b/src/WebApp/wwwroot/js/color-modes.js index 8cda0e2a3..5731256e7 100644 --- a/src/WebApp/wwwroot/js/color-modes.js +++ b/src/WebApp/wwwroot/js/color-modes.js @@ -27,4 +27,14 @@ setTheme('auto') } }) + + globalThis.addEventListener('DOMContentLoaded', () => { + document.querySelectorAll('input[name="Theme"]') + .forEach(radio => { + radio.addEventListener('change', () => { + const theme = radio.value; + setTHeme(theme); + }) + }) + }) })() From 777b676844d6ddc2c6a163f9302a4e3880e08391 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Wed, 12 Aug 2026 11:50:40 -0400 Subject: [PATCH 23/27] removed form and save changes button --- src/WebApp/Pages/Account/Index.cshtml | 84 +++++++++++++-------------- src/WebApp/wwwroot/js/color-modes.js | 2 +- 2 files changed, 40 insertions(+), 46 deletions(-) diff --git a/src/WebApp/Pages/Account/Index.cshtml b/src/WebApp/Pages/Account/Index.cshtml index 843ba73f9..d2d7ffe31 100644 --- a/src/WebApp/Pages/Account/Index.cshtml +++ b/src/WebApp/Pages/Account/Index.cshtml @@ -35,51 +35,45 @@ -
- - - -
- - - - - - - - - - - - -
- - - -
+ + + +
+ + + + + + + + + + + + +
+
@if (Model.DisplayStaff is { Active: true, Email: not null }) diff --git a/src/WebApp/wwwroot/js/color-modes.js b/src/WebApp/wwwroot/js/color-modes.js index 5731256e7..9f3bd941e 100644 --- a/src/WebApp/wwwroot/js/color-modes.js +++ b/src/WebApp/wwwroot/js/color-modes.js @@ -33,7 +33,7 @@ .forEach(radio => { radio.addEventListener('change', () => { const theme = radio.value; - setTHeme(theme); + setTheme(theme); }) }) }) From 455dc30677f4506fdf7103ff59f10b9a98cb1117 Mon Sep 17 00:00:00 2001 From: yoyocaleb Date: Fri, 14 Aug 2026 10:26:22 -0400 Subject: [PATCH 24/27] Looks for "theme" in lowercase. values in radio are now lowercase --- src/WebApp/Pages/Account/Index.cshtml | 6 +++--- src/WebApp/wwwroot/js/color-modes.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/WebApp/Pages/Account/Index.cshtml b/src/WebApp/Pages/Account/Index.cshtml index d2d7ffe31..7b1c85c26 100644 --- a/src/WebApp/Pages/Account/Index.cshtml +++ b/src/WebApp/Pages/Account/Index.cshtml @@ -44,7 +44,7 @@ type="radio" name="theme" id="themeLight" - value="@ThemePreference.Light" + value="light" checked="@(Model.Preferences.Theme == ThemePreference.Light)" />