GuestLog - User message improvements

- Added UserMessageService to have common methods for showing messages and errors to the user.
- Added Result record so services can return status on operation error (so it can be shown in the UI messages).
- Updated services to use the new Result record.
- Updated pages to use the new IUserMessageService.
This commit is contained in:
2026-08-23 21:57:26 +02:00
parent 0de4e1ba10
commit 511bd023f2
22 changed files with 239 additions and 80 deletions
@@ -2,7 +2,7 @@
@using Somnia.GuestLog.Services
@inject ILogger<AddressQueryDialog> logger;
@inject ISnackbar Snackbar
@inject IUserMessageService userMessage
@inject IGuestDocumentService guestDocumentService;
@@ -108,7 +108,7 @@
catch (Exception ex)
{
logger.LogError(ex, "GuestDocument Search returned an error!");
Snackbar.Add($"Error searching: {ex.Message}", Severity.Error);
userMessage.ShowMessage($"Error searching: {ex.Message}", MessageKind.Error);
}
}
@@ -119,7 +119,7 @@
{
if (filter.IsEmpty)
{
Snackbar.Add("Add some search!", Severity.Warning);
userMessage.ShowMessage("Search can't be empty!", MessageKind.Warning);
return;
}
@@ -131,7 +131,7 @@
{
if (SelectedResult is null)
{
Snackbar.Add("Select a guest document", Severity.Warning);
userMessage.ShowMessage("A guest document must be selected", MessageKind.Warning);
return;
}