Creata card notifiche

This commit is contained in:
2025-09-09 16:30:51 +02:00
parent dfb86e3cd7
commit 7319378e75
13 changed files with 289 additions and 18 deletions

View File

@@ -2,13 +2,45 @@
@attribute [Authorize]
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Core.Dto.Notification
@using salesbook.Shared.Core.Dto.PageState
@using salesbook.Shared.Core.Messages.Notification
@inject NotificationState Notification
@inject NewPushNotificationService NewPushNotificationService
@inject IJSRuntime JS
<HeaderLayout Title="Notifiche" />
<div class="container">
<NoDataAvailable Text="Nessuna notifica meno recente" />
@if (Notification.UnreadNotifications.IsNullOrEmpty())
{
<NoDataAvailable Text="Nessuna notifica meno recente" />
}
else
{
<div class="list" id="list">
@foreach(var notification in Notification.UnreadNotifications)
{
<NotificationCard Notification="notification" />
}
</div>
}
</div>
@code {
protected override Task OnInitializedAsync()
{
NewPushNotificationService.OnNotificationReceived += NewNotificationReceived;
return Task.CompletedTask;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await JS.InvokeVoidAsync("initNotifications");
}
private void NewNotificationReceived(PushNotificationDTO notification)
{
InvokeAsync(StateHasChanged);
}
}