feat: implement preview work units preference with local storage support
All checks were successful
Publish Container / publish (push) Successful in 3m16s
All checks were successful
Publish Container / publish (push) Successful in 3m16s
This commit is contained in:
parent
158906fa28
commit
0991128b30
4 changed files with 104 additions and 5 deletions
|
|
@ -199,6 +199,8 @@ else
|
|||
@code {
|
||||
[Parameter] public string? YearMonth { get; set; }
|
||||
|
||||
private const string IncludePreviewPreferenceKey = "worktracker.includePreviewWorkUnits";
|
||||
|
||||
private DateOnly firstOfMonth;
|
||||
private bool loading = true;
|
||||
private List<CalendarCell?[]> weeks = [];
|
||||
|
|
@ -222,6 +224,22 @@ else
|
|||
await LoadMonth();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (!firstRender)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var savedIncludePreview = await JS.InvokeAsync<bool?>("workTrackerPreferences.getBool", IncludePreviewPreferenceKey);
|
||||
if (savedIncludePreview.HasValue && savedIncludePreview.Value != includePreviewTotals)
|
||||
{
|
||||
includePreviewTotals = savedIncludePreview.Value;
|
||||
await LoadMonth();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadMonth()
|
||||
{
|
||||
loading = true;
|
||||
|
|
@ -269,6 +287,7 @@ else
|
|||
private async Task OnIncludePreviewTotalsChanged(ChangeEventArgs e)
|
||||
{
|
||||
includePreviewTotals = e.Value is bool value && value;
|
||||
await JS.InvokeVoidAsync("workTrackerPreferences.setBool", IncludePreviewPreferenceKey, includePreviewTotals);
|
||||
await LoadMonth();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue