| | 1 | | @namespace Syki.Front.Features.Student.GetStudentInsights |
| | 2 | |
|
| | 3 | | <MudContainer Class="my-4 px-4"> |
| | 4 | | <MudText Typo="Typo.h4" Style="font-weight: bold" Class="ml-2"> |
| | 5 | | Olá, @_userName |
| | 6 | | </MudText> |
| | 7 | | <MudAlert Class="mt-4" NoIcon="true" Severity="Severity.Normal" Variant="Variant.Text" Elevation="1"> |
| | 8 | | <MudStack Row="true" Justify="Justify.SpaceAround"> |
| | 9 | | <MudText>Aqui você encontra dados consolidados sobre seu curso.</MudText> |
| | 10 | | </MudStack> |
| | 11 | | </MudAlert> |
| | 12 | | <MudGrid Class="pt-4" Spacing="4"> |
| | 13 | | <StudentInsightCard |
| | 14 | | Icon="@Icons.Material.Filled.Person4" |
| | 15 | | Title="Status" |
| | 16 | | Text="@($"{_data.Status.GetDescription()}")" |
| | 17 | | Loading="@_loading" |
| | 18 | | /> |
| | 19 | | <StudentInsightCard |
| | 20 | | Icon="@Icons.Material.Filled.CheckCircle" |
| | 21 | | Title="Disciplinas" |
| | 22 | | Text="@($"{_data.FinishedDisciplines} / {_data.TotalDisciplines}")" |
| | 23 | | Loading="@_loading" |
| | 24 | | /> |
| | 25 | | <StudentInsightCard |
| | 26 | | Icon="@Icons.Material.Filled.CoPresent" |
| | 27 | | Title="Frequência" |
| | 28 | | Text="@($"{_data.Frequency.Format()}%")" |
| | 29 | | Loading="@_loading" |
| | 30 | | /> |
| | 31 | | <StudentInsightCard |
| | 32 | | Icon="@Icons.Material.Filled.GroupWork" |
| | 33 | | Title="Média" |
| | 34 | | Text="@($"{_data.Average.Format()}")" |
| | 35 | | Loading="@_loading" |
| | 36 | | /> |
| | 37 | | </MudGrid> |
| | 38 | | </MudContainer> |
| | 39 | |
|
| | 40 | | @inject GetStudentInsightsClient Client |
| | 41 | |
|
| | 42 | | @code |
| | 43 | | { |
| | 44 | | [CascadingParameter] |
| 0 | 45 | | public Task<AuthenticationState> AuthState { get; set; } |
| | 46 | |
|
| | 47 | | private bool _loading; |
| 0 | 48 | | private string _userName = ""; |
| 0 | 49 | | private StudentInsightsOut _data = new(); |
| | 50 | |
|
| | 51 | | protected override async Task OnInitializedAsync() |
| | 52 | | { |
| 0 | 53 | | _loading = true; |
| 0 | 54 | | await SetUserName(); |
| 0 | 55 | | _data = await Client.Get(); |
| 0 | 56 | | _loading = false; |
| 0 | 57 | | } |
| | 58 | |
|
| | 59 | | private async Task SetUserName() |
| | 60 | | { |
| 0 | 61 | | var state = await AuthState; |
| | 62 | |
|
| 0 | 63 | | var claim = state.User.FindFirst("name"); |
| 0 | 64 | | if (claim != null) |
| | 65 | | { |
| 0 | 66 | | _userName = claim.Value; |
| | 67 | | } |
| 0 | 68 | | } |
| | 69 | | } |