Add loading state to dashboard page, add Title field
This commit is contained in:
parent
5b6559620b
commit
2135580e9a
@ -21,4 +21,6 @@ public class UserSetting
|
||||
public int NotesPosition { get; set; }
|
||||
|
||||
public string MyDonName { get; set; } = String.Empty;
|
||||
|
||||
public string Title { get; set; } = String.Empty;
|
||||
}
|
@ -36,7 +36,8 @@ public class UserSettingsController : BaseController<UserSettingsController>
|
||||
NotesPosition = user.NotesPosition,
|
||||
PlaySetting = PlaySettingConverter.ShortToPlaySetting(user.OptionSetting),
|
||||
ToneId = user.SelectedToneId,
|
||||
MyDonName = user.MyDonName
|
||||
MyDonName = user.MyDonName,
|
||||
Title = user.Title
|
||||
};
|
||||
return Ok(response);
|
||||
}
|
||||
@ -60,6 +61,7 @@ public class UserSettingsController : BaseController<UserSettingsController>
|
||||
user.AchievementDisplayDifficulty = userSetting.AchievementDisplayDifficulty;
|
||||
user.OptionSetting = PlaySettingConverter.PlaySettingToShort(userSetting.PlaySetting);
|
||||
user.MyDonName = userSetting.MyDonName;
|
||||
user.Title = userSetting.Title;
|
||||
|
||||
context.Update(user);
|
||||
await context.SaveChangesAsync();
|
||||
|
@ -18,19 +18,21 @@
|
||||
|
||||
<MudTextField @bind-Value="@response.MyDonName" Label="Name" Variant="Variant.Outlined"></MudTextField>
|
||||
|
||||
<MudTextField @bind-Value="@response.Title" Label="Title" Variant="Variant.Outlined"></MudTextField>
|
||||
|
||||
<MudSelect @bind-Value="@response.IsDisplayAchievement"
|
||||
Label="Is Display Achievement Panel">
|
||||
Label="Display Achievement Panel">
|
||||
<MudSelectItem Value="@true">On</MudSelectItem>
|
||||
<MudSelectItem Value="@false">Off</MudSelectItem>
|
||||
</MudSelect>
|
||||
|
||||
<MudSelect @bind-Value="@response.IsDisplayDanOnNamePlate"
|
||||
Label="Display Dan on Name Plate">
|
||||
Label="Display Dan Rank on Name Plate">
|
||||
<MudSelectItem Value="@true">On</MudSelectItem>
|
||||
<MudSelectItem Value="@false">Off</MudSelectItem>
|
||||
</MudSelect>
|
||||
<MudSelect @bind-Value="@response.AchievementDisplayDifficulty"
|
||||
Label="Difficulty Used on Achievement Panel">
|
||||
Label="Achievement Panel Difficulty">
|
||||
@foreach (var item in Enum.GetValues<Difficulty>())
|
||||
{
|
||||
<MudSelectItem Value="@item" />
|
||||
|
@ -6,47 +6,72 @@
|
||||
|
||||
<h1>Dashboard</h1>
|
||||
|
||||
<MudGrid Class="my-8">
|
||||
@if (response is null)
|
||||
{
|
||||
<MudText Align="Align.Center" Class="my-8">
|
||||
No Data
|
||||
</MudText>
|
||||
@if (isLoading is true) {
|
||||
@for (uint i = 0; i < 3; 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 {
|
||||
<MudItem xs="12">
|
||||
<MudText Align="Align.Center" Class="my-8">
|
||||
No data.
|
||||
</MudText>
|
||||
</MudItem>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudGrid Class="my-8">
|
||||
@foreach (var user in response.Users)
|
||||
{
|
||||
<MudItem xs="12" md="6" lg="4">
|
||||
<MudCard Outlined="true">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6" Style="font-weight:bold">@user.Baid</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent>
|
||||
<MudText Style="font-weight:bold">Access Code</MudText>
|
||||
<MudText Style="font-family:monospace">@user.AccessCode</MudText>
|
||||
</MudCardContent>
|
||||
<MudCardActions>
|
||||
<MudStack Row="true" Style="width:100%" Spacing="4" Justify="Justify.FlexEnd">
|
||||
<MudButton Size="Size.Small" Variant="Variant.Text" StartIcon="@Icons.Material.Filled.Delete" Color="Color.Error">Delete</MudButton>
|
||||
<MudButton OnClick="() => NavigateToProfile(user.Baid)" Size="Size.Small" Variant="Variant.Text" StartIcon="@Icons.Material.Filled.Edit" Color="Color.Primary">Edit</MudButton>
|
||||
</MudStack>
|
||||
</MudCardActions>
|
||||
</MudCard>
|
||||
</MudItem>
|
||||
}
|
||||
</MudGrid>
|
||||
@foreach (var user in response.Users)
|
||||
{
|
||||
<MudItem xs="12" md="6" lg="4">
|
||||
<MudCard Outlined="true">
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudText Typo="Typo.h6" Style="font-weight:bold">@user.Baid</MudText>
|
||||
</CardHeaderContent>
|
||||
</MudCardHeader>
|
||||
<MudCardContent>
|
||||
<MudText Style="font-weight:bold">Access Code</MudText>
|
||||
<MudText Style="font-family:monospace">@user.AccessCode</MudText>
|
||||
</MudCardContent>
|
||||
<MudCardActions>
|
||||
<MudStack Row="true" Style="width:100%" Spacing="4" Justify="Justify.FlexEnd">
|
||||
<MudButton Size="Size.Small" Variant="Variant.Text" StartIcon="@Icons.Material.Filled.Delete" Color="Color.Error">Delete</MudButton>
|
||||
<MudButton OnClick="() => NavigateToProfile(user.Baid)" Size="Size.Small" Variant="Variant.Text" StartIcon="@Icons.Material.Filled.Edit" Color="Color.Primary">Edit</MudButton>
|
||||
</MudStack>
|
||||
</MudCardActions>
|
||||
</MudCard>
|
||||
</MudItem>
|
||||
}
|
||||
}
|
||||
</MudGrid>
|
||||
|
||||
@code {
|
||||
private DashboardResponse? response;
|
||||
private bool isLoading = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
response = await Client.GetFromJsonAsync<DashboardResponse>("api/Dashboard");
|
||||
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user