Skip to content

Commit 364b41f

Browse files
committed
Enhance UI, logging, and localization support
- ✨ Increased `MudCardHeader` and `MudCardContent` heights for better spacing in `AnalysisJobCard.razor`. - 🌐 Added localized loading messages with `InfoLoading0` in `Resource.en.resx` and `Resource.resx`. - 🛠️ Improved `Loading.razor` to support customizable loading text via a new `Text` parameter. - 🐛 Adjusted refresh logic in `AnalysisJobsPending.razor` to reduce frequency and improve validation. - 📝 Enhanced logging with `BlazorService.BrowserLogAsync` for better debugging and traceability. - 🔄 Updated `version-info.json` to reflect the latest build and commit details.
1 parent c5a25d0 commit 364b41f

7 files changed

Lines changed: 32 additions & 11 deletions

File tree

Gastos.Pwa/Components/Features/AnalysisJobs/AnalysisJobCard.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@inject StateContainer StateContainer
33

44
<MudCard Outlined="true">
5-
<MudCardHeader Style="height: 3rem; border-bottom: 1px solid var(--mud-palette-lines-default);">
5+
<MudCardHeader Style="height: 4.5rem; border-bottom: 1px solid var(--mud-palette-lines-default);">
66
<CardHeaderContent>
77
<MudTooltip>
88
<ChildContent>
@@ -30,7 +30,7 @@
3030
</CardHeaderAvatar>
3131
</MudCardHeader>
3232

33-
<MudCardContent Class="pt-3" Style="height: 6rem;">
33+
<MudCardContent Class="pt-3" Style="height: 7rem;">
3434
@if(!_isPending)
3535
{
3636
<MudText Typo="Typo.h6">@(Job.ReceiptMerchant is null ? $"{Loc.Get(RS.EntityStore)}: ?" : Job.ReceiptMerchant)</MudText>

Gastos.Pwa/Components/Features/AnalysisJobs/AnalysisJobsPending.razor

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
else if(_analysisJobs is null)
1717
{
18-
<Loading Class="mt-4" />
18+
<Loading Class="mt-4" Text="@string.Format(Loc.Get(RS.InfoLoading0), Loc.Get(RS.EntityReceipts))" />
1919
}
2020
else if (_analysisJobs.ItemsCount == 0)
2121
{
@@ -28,7 +28,7 @@ else
2828
<MyButton Type="IconRefresh" OnClick="RefreshAnalysisJobsAsync" Disabled="@_checkingStatus" />
2929
</MudStack>
3030

31-
<MudGrid Spacing="5">
31+
<MudGrid Spacing="5" Class="m-0">
3232
@foreach (var job in _analysisJobs.Items.OrderBy(j => j.CreatedAtUtc))
3333
{
3434
<MudItem xs="12" sm="4">
@@ -49,7 +49,7 @@ else
4949
private bool _checkingStatus = false;
5050

5151
private System.Timers.Timer? _refreshTimer;
52-
private const int _refreshIntervalMilliseconds = 300;
52+
private const int _refreshIntervalMilliseconds = 1000;
5353

5454
protected override void OnInitialized()
5555
{
@@ -114,7 +114,8 @@ else
114114
_errorMessage = BlazorService.GetResponseError(ex);
115115
}
116116

117-
StateHasChanged();
117+
await BlazorService.BrowserLogAsync("StateHasChanged FetchPendingAnalysisJobsAsync");
118+
await InvokeAsync(StateHasChanged);
118119

119120
await CheckAnalysisJobsStatus();
120121

@@ -133,11 +134,10 @@ else
133134
{
134135
var responseJob = await DocIntelApi.GetAnalysisJobByIdAsync(job.Id);
135136
if (!(responseJob.IsSuccessStatusCode && responseJob.Content is AnalysisJobResponse remoteJob)) continue;
137+
if (!(remoteJob.IsSuccessful && remoteJob.DocumentId is not null)) continue;
136138

137139
job.UpdateJobInfo(remoteJob);
138140

139-
if (!(remoteJob.IsSuccessful && remoteJob.DocumentId is not null)) continue;
140-
141141
var responseReceipt = await DocIntelApi.GetReceiptByIdAsync((Guid)remoteJob.DocumentId);
142142
if (responseReceipt.IsSuccessStatusCode && responseReceipt.Content is ReceiptResponse receipt)
143143
{
@@ -150,9 +150,10 @@ else
150150
else if (await IsJobReceiptAlreadyCreated(job))
151151
{
152152
job.IsReceiptAlreadyCreated = true;
153-
}
153+
}
154154
}
155155

156+
await BlazorService.BrowserLogAsync($"StateHasChanged for job {job.Id}");
156157
await InvokeAsync(StateHasChanged);
157158
}
158159

@@ -204,6 +205,7 @@ else
204205
{
205206
_refreshTimer?.Stop();
206207
_analysisJobs = null;
208+
await BlazorService.BrowserLogAsync("StateHasChanged RefreshAnalysisJobsAsync");
207209
await InvokeAsync(StateHasChanged);
208210
_restoredAnalysisJobs = null;
209211
await FetchPendingAnalysisJobsAsync();
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
<MudProgressCircular Indeterminate="true" Color="Color.Primary" Size="@Size" Class="mt-4" />
1+
@if (string.IsNullOrEmpty(Text))
2+
{
3+
<MudProgressCircular Indeterminate="true" Color="Color.Primary" Size="@Size" Class="mt-4" />
4+
}
5+
else
6+
{
7+
<MudStack Row AlignItems="AlignItems.Center" Class="mt-4">
8+
<MudProgressCircular Indeterminate="true" Color="Color.Primary" Size="@Size" />
9+
<MudText Class="ms-5">@Text</MudText>
10+
</MudStack>
11+
}
12+
213

314
@code{
415
[Parameter] public Size Size { get; set; } = Size.Medium;
516
[Parameter] public string Class { get; set; } = "";
17+
[Parameter] public string Text { get; set; } = "";
618
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"v0.1.1","build":"176","commit":"612e81a","branch":"main","date":"2025-10-25 17:01:11","buildDate":"2025-10-25 17:01:12"}
1+
{"version":"v0.1.1","build":"177","commit":"c5a25d0","branch":"main","date":"2025-10-26 17:12:13","buildDate":"2025-10-26 17:12:13"}

Gastos.Shared/Resources/Resource.en.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,4 +558,7 @@
558558
<data name="ErrorCameraChecking" xml:space="preserve">
559559
<value>Error checking camera availability</value>
560560
</data>
561+
<data name="InfoLoading0" xml:space="preserve">
562+
<value>Loading {0}...</value>
563+
</data>
561564
</root>

Gastos.Shared/Resources/Resource.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,4 +558,7 @@
558558
<data name="ErrorCameraChecking" xml:space="preserve">
559559
<value>Error al comprobar la disponibilidad de la cámara</value>
560560
</data>
561+
<data name="InfoLoading0" xml:space="preserve">
562+
<value>Cargando {0}...</value>
563+
</data>
561564
</root>

Gastos.Shared/Resources/ResourceStrings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public enum ResourceStrings
8383
FieldUnitPrice0,
8484
FieldUnitsPack,
8585
InfoCameraInitializing,
86+
InfoLoading0,
8687
InfoLoginStarting,
8788
InfoLoginProcessing,
8889
InfoProducts0,

0 commit comments

Comments
 (0)