1
0
mirror of synced 2025-01-31 12:23:50 +01:00

Redirects, styles clean up

This commit is contained in:
shiibe 2024-03-09 14:13:56 -05:00
parent d034a2218d
commit 604872116f
4 changed files with 115 additions and 102 deletions

View File

@ -5,93 +5,91 @@
@inject NavigationManager NavigationManager
@inject IStringUtil StringUtil
<MudBreadcrumbs Items="breadcrumbs" Class="px-0"></MudBreadcrumbs>
<MudText Typo="Typo.h4">Access Code Management</MudText>
<MudText Typo="Typo.caption">User ID: @Baid</MudText>
<div class="mt-8">
@if (response is null)
@if (response is not null)
{
@if ((LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin))) || User is null)
{
<MudGrid>
<MudItem xs="12">
<MudProgressCircular Size="Size.Large" Color="Color.Primary" />
</MudItem>
</MudGrid>
}
else
{
@if ((LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin))) || User is null)
if (!LoginService.IsLoggedIn)
{
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-8">
You are not authorized to see this page. Please log in by clicking on "Users" tab first.
</MudText>
</MudItem>
NavigationManager.NavigateTo("/Login");
}
else
{
<MudCard Outlined="true" Class="mb-6">
<MudCardContent>
<MudGrid Spacing="3">
<MudItem xs="12">
<MudText Typo="Typo.h6">Bind New Access Code</MudText>
<MudText Typo="Typo.body1">
Enter a new access code to bind to this user account.
</MudText>
<MudForm @ref="bindAccessCodeForm">
<MudGrid Spacing="2" Class="mt-4">
<MudItem xs="12" md="10">
<MudTextField @bind-value="inputAccessCode" InputType="InputType.Text" T="string"
FullWidth="true" Required="@true" RequiredError="Access Code is required" Variant="Variant.Outlined" Margin="Margin.Dense"
Label="New Access Code" />
</MudItem>
<MudItem xs="12" md="2">
<MudButton OnClick="OnBind" FullWidth="true" StartIcon="@Icons.Material.Filled.AddCard" Color="Color.Primary" Variant="Variant.Filled" Class="mt-1">Bind</MudButton>
</MudItem>
</MudGrid>
</MudForm>
</MudItem>
</MudGrid>
</MudCardContent>
</MudCard>
<MudCard Outlined="true">
<MudCardContent>
<MudGrid Spacing="3" Class="pb-2">
<MudItem xs="12">
<MudText Typo="Typo.h6">Access Codes</MudText>
</MudItem>
@for (var idx = 0; idx < User.AccessCodes.Count; idx++)
{
var accessCode = User.AccessCodes[idx];
var localIdx = idx + 1;
NavigationManager.NavigateTo("/");
}
}
else
{
<MudBreadcrumbs Items="breadcrumbs" Class="p-0 mb-2"></MudBreadcrumbs>
<MudText Typo="Typo.h4">Access Codes</MudText>
<MudText Typo="Typo.caption">User ID: @Baid</MudText>
<MudGrid Class="my-4 pb-10">
<MudItem xs="12">
<MudCard Outlined="true" Class="mb-6">
<MudCardContent>
<MudGrid Spacing="3">
<MudItem xs="12">
<div Style="border-bottom:1px solid #eee; padding: 5px 0;">
<MudGrid Spacing="2" Class="d-flex align-center">
<MudItem xs="12" md="8" Class="d-flex align-center">
<pre class="mb-0" style="font-size:16px">
@foreach (var digitGroup in StringUtil.SplitIntoGroups(accessCode, 4))
{
<span class="mr-2">@digitGroup</span>
}
</pre>
<MudText Typo="Typo.h6">Add Access Code</MudText>
<MudForm @ref="bindAccessCodeForm">
<MudGrid Spacing="2" Class="mt-4">
<MudItem xs="12" md="10">
<MudTextField @bind-value="inputAccessCode" InputType="InputType.Text" T="string"
FullWidth="true" Required="@true" RequiredError="Access Code is required" Variant="Variant.Outlined" Margin="Margin.Dense"
Label="New Access Code" />
</MudItem>
<MudItem xs="12" md="4" Class="d-flex justify-end">
<MudButton OnClick="@(_ => DeleteAccessCode(accessCode))"
Size="Size.Small" Variant="Variant.Text" StartIcon="@Icons.Material.Filled.Delete"
Color="Color.Error">
@Localizer["Delete"]
</MudButton>
<MudItem xs="12" md="2">
<MudButton OnClick="OnBind" FullWidth="true" StartIcon="@Icons.Material.Filled.AddCard" Color="Color.Primary" Variant="Variant.Filled" Class="mt-1">Add</MudButton>
</MudItem>
</MudGrid>
</MudForm>
</MudItem>
</MudGrid>
</MudCardContent>
</MudCard>
<MudCard Outlined="true">
<MudCardContent>
<MudGrid Spacing="3" Class="pb-2">
<MudItem xs="12">
<MudText Typo="Typo.h6">Access Codes</MudText>
</MudItem>
@for (var idx = 0; idx < User.AccessCodes.Count; idx++)
{
var accessCode = User.AccessCodes[idx];
var localIdx = idx + 1;
<MudItem xs="12" Class="py-0">
<div Style="border-bottom:1px solid #eee; padding: 5px 0;">
<MudGrid Spacing="2" Class="d-flex align-center">
<MudItem xs="12" md="8" Class="d-flex align-center">
<pre class="mb-0" style="font-size:16px">
@foreach (var digitGroup in StringUtil.SplitIntoGroups(accessCode, 4))
{
<span class="mr-2">@digitGroup</span>
}
</pre>
</MudItem>
<MudItem xs="12" md="4" Class="d-flex justify-end">
<MudButton OnClick="@(_ => DeleteAccessCode(accessCode))"
Size="Size.Small" Variant="Variant.Text" StartIcon="@Icons.Material.Filled.Delete"
Color="Color.Error">
@Localizer["Delete"]
</MudButton>
</MudItem>
</MudGrid>
</div>
</MudItem>
}
</MudGrid>
</MudCardContent>
</MudCard>
}
}
</div>
}
</MudGrid>
</MudCardContent>
</MudCard>
</MudItem>
</MudGrid>
}
}
else
{
<MudContainer Style="display:flex;margin:50px 0;align-items:center;justify-content:center;">
<MudProgressCircular Indeterminate="true" Size="Size.Large" Color="Color.Primary" />
</MudContainer>
}

View File

@ -2,21 +2,25 @@
@inject HttpClient Client
@inject LoginService LoginService
@inject IJSRuntime JSRuntime
@inject NavigationManager NavigationManager
@page "/Users/{baid:int}/DaniDojo"
<MudBreadcrumbs Items="breadcrumbs" Class="px-0"></MudBreadcrumbs>
<MudBreadcrumbs Items="breadcrumbs" Class="p-0 mb-2"></MudBreadcrumbs>
<MudText Typo="Typo.h4">@Localizer["Key_03"]</MudText>
<MudText Typo="Typo.caption">User ID: @Baid</MudText>
@if (LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin)))
{
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-8">
@Localizer["Key_02"]
</MudText>
</MudItem>
if (!LoginService.IsLoggedIn)
{
NavigationManager.NavigateTo("/Login");
}
else
{
NavigationManager.NavigateTo("/");
}
}
else
{

View File

@ -2,15 +2,14 @@
@inject HttpClient Client
@inject LoginService LoginService
@inject IJSRuntime JSRuntime
@inject NavigationManager NavigationManager
@page "/Users/{baid:int}/HighScores"
<MudBreadcrumbs Items="breadcrumbs" Class="px-0"></MudBreadcrumbs>
<MudBreadcrumbs Items="breadcrumbs" Class="p-0 mb-2"></MudBreadcrumbs>
<MudText Typo="Typo.h4">@Localizer["Key_01"]</MudText>
<MudText Typo="Typo.caption">User ID: @Baid</MudText>
<MudGrid Class="my-8">
@if (response is null)
{
@ -24,11 +23,14 @@
{
@if (LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin)))
{
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-8">
@Localizer["Key_02"]
</MudText>
</MudItem>
if (!LoginService.IsLoggedIn)
{
NavigationManager.NavigateTo("/Login");
}
else
{
NavigationManager.NavigateTo("/");
}
}
else
{

View File

@ -4,23 +4,26 @@
@inject IDialogService DialogService
@inject LoginService LoginService
@inject IJSRuntime Js
<MudBreadcrumbs Items="breadcrumbs" Class="px-0"></MudBreadcrumbs>
<MudText Typo="Typo.h4">@Localizer["Profile"]</MudText>
<MudText Typo="Typo.caption">User ID: @Baid</MudText>
@inject NavigationManager NavigationManager
@if (response is not null)
{
@if (LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin)))
{
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-8">
@Localizer["Key_02"]
</MudText>
</MudItem>
if (!LoginService.IsLoggedIn)
{
NavigationManager.NavigateTo("/Login");
}
else
{
NavigationManager.NavigateTo("/");
}
}
else
{
<MudBreadcrumbs Items="breadcrumbs" Class="p-0 mb-2"></MudBreadcrumbs>
<MudText Typo="Typo.h4">@Localizer["Profile"]</MudText>
<MudText Typo="Typo.caption">User ID: @Baid</MudText>
<MudGrid Class="my-4 pb-10">
<MudItem xs="12" md="8">
<MudPaper Elevation="0" Outlined="true">
@ -448,6 +451,12 @@
</MudGrid>
}
}
else
{
<MudContainer Style="display:flex;margin:50px 0;align-items:center;justify-content:center;">
<MudProgressCircular Indeterminate="true" Size="Size.Large" Color="Color.Primary" />
</MudContainer>
}
@code {
private async Task UpdateMyDonName()