1
0
mirror of synced 2024-11-28 08:30:56 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Users.razor
2024-05-16 23:32:46 +01:00

51 lines
1.9 KiB
Plaintext

@inject HttpClient Client
@inject AuthService AuthService
@inject NavigationManager NavigationManager
@using TaikoWebUI.Components
@page "/Users"
<MudText Typo="Typo.h4">@Localizer["Users"]</MudText>
<MudGrid Class="my-8">
@if (!AuthService.LoginRequired || (AuthService.LoginRequired && AuthService.IsAdmin)) {
if (users == null) {
// Loading...
for (uint i = 0; i < 6; i++) {
<MudItem xs="12" md="6" lg="4">
<MudCard Outlined="true">
<MudCardContent>
<MudSkeleton Width="30%" Height="42px;" Class="mb-5" />
<MudSkeleton Width="80%" />
<MudSkeleton Width="100%" />
</MudCardContent>
<MudCardActions>
<MudStack Row="true" Style="width:100%" Spacing="4" Justify="Justify.FlexEnd">
<MudSkeleton Width="64px" Height="40px" />
<MudSkeleton Width="64px" Height="40px" />
</MudStack>
</MudCardActions>
</MudCard>
</MudItem>
}
} else if (users.Count > 0) {
foreach (var user in users)
{
<MudItem xs="12" md="6" lg="4">
<UserCard User="user" />
</MudItem>
}
} else { // No users in the database
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-8">
@Localizer["No data."]
</MudText>
</MudItem>
}
} else if (AuthService.LoginRequired && !AuthService.IsLoggedIn) {
// Not logged in, redirect
NavigationManager.NavigateTo("/Login");
} else {
NavigationManager.NavigateTo("/");
}
</MudGrid>