-
About
@@ -37,8 +29,39 @@
@code {
private bool sidebarCollapsed = true;
+ protected override void OnInitialized()
+ {
+ ThemeState.ThemeModeChanged += HandleThemeModeChanged;
+ }
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ if (!firstRender)
+ {
+ return;
+ }
+
+ var themeMode = await ThemeState.EnsureLoadedAsync();
+ await ApplyThemeAsync(themeMode);
+ }
+
private void ToggleSidebar()
{
sidebarCollapsed = !sidebarCollapsed;
}
+
+ private void HandleThemeModeChanged(AppThemeMode themeMode)
+ {
+ _ = InvokeAsync(() => ApplyThemeAsync(themeMode).AsTask());
+ }
+
+ private ValueTask ApplyThemeAsync(AppThemeMode themeMode)
+ {
+ return JS.InvokeVoidAsync("workTrackerTheme.setTheme", themeMode.ToString().ToLowerInvariant());
+ }
+
+ public void Dispose()
+ {
+ ThemeState.ThemeModeChanged -= HandleThemeModeChanged;
+ }
}
diff --git a/Components/Layout/MainLayout.razor.css b/Components/Layout/MainLayout.razor.css
index 8204d7a..cfbb458 100644
--- a/Components/Layout/MainLayout.razor.css
+++ b/Components/Layout/MainLayout.razor.css
@@ -14,8 +14,8 @@ main {
}
.top-row {
- background-color: #f7f7f7;
- border-bottom: 1px solid #d6d5d5;
+ background-color: var(--wt-header-bg);
+ border-bottom: 1px solid var(--wt-header-border);
justify-content: flex-end;
height: 3.5rem;
display: flex;
@@ -23,6 +23,7 @@ main {
}
.top-row ::deep a, .top-row ::deep .btn-link {
+ color: var(--wt-header-link);
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
@@ -37,30 +38,9 @@ main {
text-overflow: ellipsis;
}
-.sidebar-toggle {
- display: none;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- gap: 0.2rem;
- width: 2.5rem;
- height: 2.5rem;
- margin-right: auto;
- border: 1px solid #d6d5d5;
- border-radius: 0.65rem;
- background: #fff;
-}
-
-.sidebar-toggle-bar {
- width: 1rem;
- height: 2px;
- background: #334155;
- border-radius: 999px;
-}
-
@media (max-width: 640.98px) {
.top-row {
- justify-content: space-between;
+ justify-content: flex-end;
}
.top-row ::deep a, .top-row ::deep .btn-link {
@@ -100,10 +80,6 @@ main {
padding-right: 1.5rem !important;
}
- .sidebar-toggle {
- display: inline-flex;
- }
-
.sidebar.sidebar-collapsed {
width: 5rem;
}
diff --git a/Components/Layout/NavMenu.razor b/Components/Layout/NavMenu.razor
index 4a34d50..514e372 100644
--- a/Components/Layout/NavMenu.razor
+++ b/Components/Layout/NavMenu.razor
@@ -4,15 +4,29 @@
@code {
[Parameter] public bool IsCollapsed { get; set; }
+ [Parameter] public EventCallback OnToggleSidebar { get; set; }
+
+ private Task ToggleSidebarAsync()
+ {
+ return OnToggleSidebar.InvokeAsync();
+ }
}
-
-
-
- WorkTracker
- WT
-
+Calendar
+
+
diff --git a/Components/Layout/NavMenu.razor.css b/Components/Layout/NavMenu.razor.css
index b4e5429..68a8b8e 100644
--- a/Components/Layout/NavMenu.razor.css
+++ b/Components/Layout/NavMenu.razor.css
@@ -1,10 +1,19 @@
.top-row {
min-height: 3.5rem;
background-color: rgba(0,0,0,0.4);
+ padding-left: 0.75rem !important;
+ padding-right: 0.75rem !important;
+}
+
+.nav-menu-header {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
}
.navbar-brand {
font-size: 1.1rem;
+ margin-bottom: 0;
}
.sidebar-brand-compact {
@@ -15,6 +24,32 @@
height: 100%;
}
+.sidebar-toggle {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ gap: 0.2rem;
+ width: 2.5rem;
+ height: 2.5rem;
+ border: 1px solid rgba(255, 255, 255, 0.18);
+ border-radius: 0.65rem;
+ background: rgba(255, 255, 255, 0.08);
+ color: #fff;
+ flex: 0 0 auto;
+}
+
+.sidebar-toggle:hover {
+ background: rgba(255, 255, 255, 0.16);
+}
+
+.sidebar-toggle-bar {
+ width: 1rem;
+ height: 2px;
+ background: currentColor;
+ border-radius: 999px;
+}
+
.bi {
display: inline-block;
position: relative;
@@ -122,19 +157,22 @@
display: none;
}
+ .nav-menu-shell-collapsed .nav-scrollable {
+ display: none;
+ }
+
+ .nav-menu-shell:not(.nav-menu-shell-collapsed) .nav-scrollable {
+ display: block;
+ }
+
.nav-scrollable {
height: auto;
}
}
@media (min-width: 641px) {
- .nav-menu-shell-collapsed .top-row {
- padding-left: 0.5rem !important;
- padding-right: 0.5rem !important;
- }
-
.nav-menu-shell-collapsed .container-fluid {
- justify-content: center;
+ justify-content: flex-start;
}
.nav-menu-shell-collapsed .sidebar-brand-full,
diff --git a/Components/Pages/CalendarView.razor b/Components/Pages/CalendarView.razor
index 60f2df0..8052c58 100644
--- a/Components/Pages/CalendarView.razor
+++ b/Components/Pages/CalendarView.razor
@@ -10,6 +10,7 @@
+
Calendar
@@ -51,11 +52,11 @@ else
{
@if (cell is null)
{
-
+
}
else
{
- TogglePopup(cell.Date)" role="button">
+ TogglePopup(cell.Date)" role="button">
@cell.Date.Day
@foreach (var workUnit in cell.Entry?.WorkUnits ?? [])
@@ -193,6 +194,7 @@ else
}
}
+
@code {
[Parameter] public string? YearMonth { get; set; }
@@ -306,6 +308,8 @@ else
private bool IsActiveCell(DateOnly date) => activeDate == date;
+ private static bool IsToday(DateOnly date) => date == DateOnly.FromDateTime(DateTime.Today);
+
private void CreateWorkUnit(DateOnly date)
{
Navigation.NavigateTo($"/work-unit/{date:yyyy-MM-dd}");
diff --git a/Components/Pages/GridView.razor b/Components/Pages/GridView.razor
index 2887739..c21e3f8 100644
--- a/Components/Pages/GridView.razor
+++ b/Components/Pages/GridView.razor
@@ -24,7 +24,7 @@
else
{
-
+
| Date | @@ -150,31 +150,31 @@ else private string GetRowClass(CalendarDayRow row) { - if (row.IsWeekend || row.IsFestivity) return "table-danger"; - if (row.Entry is null) return ""; + if (row.IsWeekend || row.IsFestivity) return "grid-row-weekend"; + if (row.Entry is null) return string.Empty; if (row.Entry.CalendarEvents.Any(entry => entry.EventType == CalendarEventType.Holiday)) { - return "table-success"; + return "grid-row-holiday"; } if (row.Entry.CalendarEvents.Any(entry => entry.EventType == CalendarEventType.Closure)) { - return "table-warning"; + return "grid-row-closure"; } if (row.Entry.CalendarEvents.Any(entry => entry.EventType == CalendarEventType.Illness)) { - return "table-info"; + return "grid-row-illness"; } if (row.Entry.CalendarEvents.Any(entry => entry.EventType == CalendarEventType.DayOff)) { - return "table-secondary"; + return "grid-row-dayoff"; } if (row.Entry.WorkUnits.Any(entry => entry.Location == WorkUnitLocation.Home)) { - return "table-light"; + return "grid-row-home"; } return string.Empty; diff --git a/Components/Pages/Settings.razor b/Components/Pages/Settings.razor index 0cb3a2d..38d2689 100644 --- a/Components/Pages/Settings.razor +++ b/Components/Pages/Settings.razor @@ -2,6 +2,7 @@ @attribute [Authorize] @inject IAppSettingsService AppSettingsService +@inject AppThemeState ThemeState
|---|