Creata card notifiche
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user