1
0
mirror of synced 2024-11-30 17:24:33 +01:00

Clean up dashboard page

This commit is contained in:
shiibe 2022-09-05 17:42:13 -04:00
parent 5925950d16
commit 1f8726c46a
3 changed files with 53 additions and 35 deletions

View File

@ -4,6 +4,8 @@
@using SharedProject.Models @using SharedProject.Models
@inject HttpClient Client @inject HttpClient Client
<MudBreadcrumbs Items="_breadcrumbs" Class="px-0"></MudBreadcrumbs>
<h1>Card: @Baid</h1> <h1>Card: @Baid</h1>
@if (response is not null) @if (response is not null)
@ -84,7 +86,7 @@
<MudButton Disabled="@isSavingOptions" <MudButton Disabled="@isSavingOptions"
OnClick="SaveOptions" OnClick="SaveOptions"
Variant="Variant.Filled" Variant="Variant.Filled"
Color="Color.Info"> Color="Color.Primary">
@if (isSavingOptions) @if (isSavingOptions)
{ {
<MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true" /> <MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true" />
@ -99,6 +101,11 @@
</MudStack> </MudStack>
</MudItem> </MudItem>
</MudGrid> </MudGrid>
<MudScrollToTop>
<MudFab Color="Color.Secondary" Icon="@Icons.Filled.ArrowCircleUp" />
</MudScrollToTop>
} }
@code { @code {
@ -117,11 +124,18 @@
private readonly string[] notePositionStrings = new string[] { "-5", "-4", "-3", "-2", "-1", "0", "+1", "+2", "+3", "+4", "+5"}; private readonly string[] notePositionStrings = new string[] { "-5", "-4", "-3", "-2", "-1", "0", "+1", "+2", "+3", "+4", "+5"};
private List<BreadcrumbItem> _breadcrumbs = new List<BreadcrumbItem>
{
new BreadcrumbItem("Dashboard", href: "Dashboard"),
};
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await base.OnInitializedAsync(); await base.OnInitializedAsync();
isSavingOptions = false; isSavingOptions = false;
response = await Client.GetFromJsonAsync<UserSetting>($"api/UserSettings/{Baid}"); response = await Client.GetFromJsonAsync<UserSetting>($"api/UserSettings/{Baid}");
_breadcrumbs.Add(new BreadcrumbItem($"Card: {Baid}", href: null, disabled: true));
} }
private async Task SaveOptions() private async Task SaveOptions()
@ -129,6 +143,5 @@
isSavingOptions = true; isSavingOptions = true;
await Client.PostAsJsonAsync($"api/UserSettings/{Baid}", response); await Client.PostAsJsonAsync($"api/UserSettings/{Baid}", response);
isSavingOptions = false; isSavingOptions = false;
} }
} }

View File

@ -3,37 +3,42 @@
@inject NavigationManager UriHelper @inject NavigationManager UriHelper
@page "/Dashboard" @page "/Dashboard"
<MudContainer>
@if (response is null) <h1>Dashboard</h1>
{
<MudText>No Data</MudText> @if (response is null)
} {
else <MudText Align="Align.Center" Class="my-8">
{ No Data
<MudGrid> </MudText>
@foreach (var user in response.Users) }
{ else
<MudItem> {
<MudCard> <MudGrid Class="my-8">
<MudCardHeader> @foreach (var user in response.Users)
<CardHeaderContent> {
<MudText Typo="Typo.h5">Baid @user.Baid</MudText> <MudItem xs="12" md="6" lg="4">
</CardHeaderContent> <MudCard Outlined="true">
<CardHeaderActions> <MudCardHeader>
<MudIconButton OnClick="() => NavigateToProfile(user.Baid)" Icon="@Icons.Material.Filled.Settings" Color="Color.Default" /> <CardHeaderContent>
</CardHeaderActions> <MudText Typo="Typo.h6" Style="font-weight:bold">@user.Baid</MudText>
</MudCardHeader> </CardHeaderContent>
<MudCardContent> </MudCardHeader>
<MudText Typo="Typo.h6">Access Code</MudText> <MudCardContent>
<MudText>@user.AccessCode</MudText> <MudText Style="font-weight:bold">Access Code</MudText>
</MudCardContent> <MudText Style="font-family:monospace">@user.AccessCode</MudText>
</MudCard> </MudCardContent>
</MudItem> <MudCardActions>
} <MudStack Row="true" Style="width:100%" Spacing="4" Justify="Justify.FlexEnd">
</MudGrid> <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>
</MudContainer> </MudCardActions>
</MudCard>
</MudItem>
}
</MudGrid>
}
@code { @code {
private DashboardResponse? response; private DashboardResponse? response;

View File

@ -15,7 +15,7 @@
<NavMenu/> <NavMenu/>
</MudDrawer> </MudDrawer>
<MudMainContent> <MudMainContent>
<MudContainer MaxWidth="MaxWidth.Large" Class="my-8 pt-8"> <MudContainer MaxWidth="MaxWidth.Large" Class="my-8">
@Body @Body
</MudContainer> </MudContainer>
</MudMainContent> </MudMainContent>