< Summary

Information
Class: Syki.Front.Features.Cross.ViewNotifications.ViewNotificationsDialog
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Features/Cross/ViewNotifications/ViewNotificationsDialog.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 57
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%210%
OnInitializedAsync()100%210%
HandleRowClick()0%620%
GetNotFoundMessage()100%210%

File(s)

/home/runner/work/syki/syki/Front/Features/Cross/ViewNotifications/ViewNotificationsDialog.razor

#LineLine coverage
 1@namespace Syki.Front.Features.Cross.ViewNotifications
 2
 3<MudDialog>
 4    <TitleContent>
 5        <SykiDialogTitle Icon="@Icons.Material.Filled.Notifications" Text="Notificações" />
 6    </TitleContent>
 7    <DialogContent>
 8        <MudDataGrid
 9            Class="mb-4"
 10            Hover="true"
 11            Loading="@_loading"
 12            T="@UserNotificationOut"
 13            RowClass="cursor-pointer"
 14            RowClick="@HandleRowClick"
 015            Items="@_notifications.OrderByDescending(d => d.CreatedAt)"
 16        >
 17            <Columns>
 18                <PropertyColumn Property="x => x.Title" Title="Título" />
 19                <PropertyColumn Property="x => x.Description" Title="Descrição" />
 20                <PropertyColumn Property="x => x.CreatedAt.ToLocalTime()" Title="Criada em" />
 21            </Columns>
 22            <NoRecordsContent>
 23                @(GetNotFoundMessage())
 24            </NoRecordsContent>
 25        </MudDataGrid>
 26    </DialogContent>
 27</MudDialog>
 28
 29@inject NavigationManager Nav
 30@inject GetUserNotificationsClient GetUserNotificationsClient
 31
 32@code
 33{
 34    private bool _loading;
 035    private List<UserNotificationOut> _notifications = [];
 36
 37    protected override async Task OnInitializedAsync()
 38    {
 039        _loading = true;
 040        _notifications = await GetUserNotificationsClient.Get();
 041        _loading = false;
 042    }
 43
 44    private async Task HandleRowClick(DataGridRowClickEventArgs<UserNotificationOut> row)
 45    {
 046        await Task.FromResult(0);
 047        if (row.Item.Title == "Nota adicionada")
 48        {
 049            Nav.NavigateTo("/student/exam-grades");
 50        }
 051    }
 52
 53    private string GetNotFoundMessage()
 54    {
 055        return "Não existem notificações cadastradas ainda.";
 56    }
 57}