feat: add theme mode support with AppThemeMode enum and AppThemeState service
- Introduced AppThemeMode enum to define theme options: System, Light, Dark. - Updated AppSettingsDocument to include ThemeMode property. - Created AppThemeState service to manage current theme mode and handle changes. - Integrated theme mode handling in CouchbaseLiteAppSettingsService for persistence. - Added JavaScript for theme management in the frontend, supporting system preference detection. - Enhanced CSS with theme variables for consistent styling across light and dark modes. - Updated Playwright tests to ensure sidebar functionality and responsiveness.
This commit is contained in:
parent
b45eac8055
commit
158906fa28
19 changed files with 889 additions and 82 deletions
|
|
@ -2,6 +2,7 @@
|
|||
@attribute [Authorize]
|
||||
|
||||
@inject IAppSettingsService AppSettingsService
|
||||
@inject AppThemeState ThemeState
|
||||
|
||||
<PageTitle>Settings</PageTitle>
|
||||
|
||||
|
|
@ -18,6 +19,14 @@ else
|
|||
<DataAnnotationsValidator />
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Theme</label>
|
||||
<InputSelect class="form-select" @bind-Value="settings.ThemeMode">
|
||||
<option value="@AppThemeMode.System">Follow system</option>
|
||||
<option value="@AppThemeMode.Light">Light</option>
|
||||
<option value="@AppThemeMode.Dark">Dark</option>
|
||||
</InputSelect>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Standard work hours/day</label>
|
||||
<InputNumber class="form-control" @bind-Value="settings.StandardWorkHoursPerDay" />
|
||||
|
|
@ -75,6 +84,7 @@ else
|
|||
}
|
||||
|
||||
settings = await AppSettingsService.SaveAsync(settings);
|
||||
ThemeState.SetThemeMode(settings.ThemeMode);
|
||||
statusMessage = $"Saved at {DateTime.Now:t}";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue