2022-09-11 18:33:58 +02:00
|
|
|
@inject HttpClient Client
|
2022-09-10 06:56:53 +02:00
|
|
|
@inject IDialogService DialogService
|
2023-10-16 11:38:27 +02:00
|
|
|
@inject LoginService LoginService
|
|
|
|
@inject NavigationManager NavigationManager
|
2024-03-09 07:07:34 +01:00
|
|
|
|
|
|
|
@using TaikoWebUI.Pages.Components
|
2022-09-10 06:56:53 +02:00
|
|
|
|
2023-11-11 22:04:11 +01:00
|
|
|
@page "/Users"
|
2022-09-10 06:56:53 +02:00
|
|
|
|
2024-03-08 09:06:08 +01:00
|
|
|
<MudText Typo="Typo.h4">@Localizer["users"]</MudText>
|
2022-09-10 06:56:53 +02:00
|
|
|
<MudGrid Class="my-8">
|
2024-03-09 07:07:34 +01:00
|
|
|
@if (response is not null)
|
2022-09-10 06:56:53 +02:00
|
|
|
{
|
2024-03-09 07:07:34 +01:00
|
|
|
// Response received and users are available
|
|
|
|
if (response.Users.Count != 0)
|
|
|
|
{
|
|
|
|
if (LoginService.IsAdmin || !LoginService.LoginRequired) // Admin mode, can see all users
|
|
|
|
{
|
|
|
|
@foreach (var user in response.Users)
|
|
|
|
{
|
|
|
|
<MudItem xs="12" md="6" lg="4">
|
|
|
|
<UserCard user="user" />
|
|
|
|
</MudItem>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-09 17:59:21 +01:00
|
|
|
// Not admin, redirect
|
2024-03-09 07:07:34 +01:00
|
|
|
@if (!LoginService.IsLoggedIn) // Not logged in, show login form
|
|
|
|
{
|
|
|
|
NavigationManager.NavigateTo("/Login");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-09 17:59:21 +01:00
|
|
|
NavigationManager.NavigateTo("/");
|
2024-03-09 07:07:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // No users in the database
|
|
|
|
<MudItem xs="12">
|
|
|
|
<MudText Align="Align.Center" Class="my-8">
|
|
|
|
@Localizer["No data."]
|
|
|
|
</MudText>
|
|
|
|
</MudItem>
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
// Loading...
|
2024-03-09 17:59:21 +01:00
|
|
|
@for (uint i = 0; i < 6; i++)
|
2022-09-10 06:56:53 +02:00
|
|
|
{
|
2023-10-16 11:38:27 +02:00
|
|
|
<MudItem xs="12" md="6" lg="4">
|
|
|
|
<MudCard Outlined="true">
|
|
|
|
<MudCardContent>
|
2023-12-19 16:01:13 +01:00
|
|
|
<MudSkeleton Width="30%" Height="42px;" Class="mb-5" />
|
|
|
|
<MudSkeleton Width="80%" />
|
|
|
|
<MudSkeleton Width="100%" />
|
2023-10-16 11:38:27 +02:00
|
|
|
</MudCardContent>
|
|
|
|
<MudCardActions>
|
|
|
|
<MudStack Row="true" Style="width:100%" Spacing="4" Justify="Justify.FlexEnd">
|
2023-12-19 16:01:13 +01:00
|
|
|
<MudSkeleton Width="64px" Height="40px" />
|
|
|
|
<MudSkeleton Width="64px" Height="40px" />
|
2023-10-16 11:38:27 +02:00
|
|
|
</MudStack>
|
|
|
|
</MudCardActions>
|
|
|
|
</MudCard>
|
|
|
|
</MudItem>
|
2022-09-10 06:56:53 +02:00
|
|
|
}
|
|
|
|
}
|
2024-03-08 18:05:20 +01:00
|
|
|
</MudGrid>
|