1
0
mirror of synced 2025-02-17 19:19:18 +01:00

More style changes

This commit is contained in:
shiibe 2024-06-03 11:27:18 -04:00
parent b5598f4995
commit ee41dc59c0
3 changed files with 32 additions and 12 deletions

View File

@ -11,7 +11,7 @@
@if (Items.Count > 0)
{
<MudCardContent Class="pa-0">
<MudTable Items="Items" Elevation="0" Striped="true">
<MudTable Items="Items" Elevation="0" Striped="true" Dense="true">
<HeaderContent>
<MudTh>
<MudTableSortLabel InitialDirection="SortDirection.Descending" T="SongHistoryData" SortBy="x => x.PlayTime">

View File

@ -6,26 +6,28 @@
<MudCard Outlined="true" Elevation="0">
<MudCardHeader>
<MudGrid Spacing="2" Class="align-center pb-2">
<MudItem xs="12" md="6">
<MudItem xs="6">
<MudText Typo="Typo.h6">@Localizer["Leaderboard"]</MudText>
</MudItem>
<MudItem xs="12" md="6">
<MudToggleGroup T="string" Label="@Localizer["Difficulty"]" Variant="Variant.Outlined" Dense="true" ValueChanged="(value) => OnDifficultyChange(value)" Value="SelectedDifficulty">
@foreach (var difficulty in Enum.GetValues(typeof(Difficulty)))
{
<MudItem xs="6">
<MudStack Justify="Justify.FlexEnd" Row="true">
<MudToggleGroup T="string" Label="@Localizer["Difficulty"]" Variant="Variant.Outlined" Dense="true" ValueChanged="(value) => OnDifficultyChange(value)" Value="SelectedDifficulty" Style="width:300px">
@foreach (var difficulty in Enum.GetValues(typeof(Difficulty)))
{
if ((Difficulty)difficulty == Difficulty.None)
{
continue;
continue;
}
<MudToggleItem Value="@difficulty.ToString()">
<div class="d-flex align-center">
<img src="@($"/images/difficulty_{difficulty}.png")" alt="@difficulty.ToString()" title="@difficulty.ToString()" style="@Constants.ICON_STYLE"/>
</div>
</MudToggleItem>
}
</MudToggleGroup>
}
</MudToggleGroup>
</MudStack>
</MudItem>
</MudGrid>
</MudCardHeader>

View File

@ -12,9 +12,9 @@ public partial class SongLeaderboardCard
public int Baid { get; set; }
[Parameter]
public Difficulty Difficulty { get; set; } = Difficulty.Hard;
public Difficulty Difficulty { get; set; } = Difficulty.None;
private string SelectedDifficulty { get; set; } = "Hard";
private string SelectedDifficulty { get; set; } = "None";
private bool isLoading = true;
@ -22,6 +22,21 @@ public partial class SongLeaderboardCard
{
await base.OnInitializedAsync();
// get highScoresTab from LocalStorage
var songPageDifficulty = await LocalStorage.GetItemAsync<string>("songPageDifficulty");
if (songPageDifficulty != null)
{
SelectedDifficulty = songPageDifficulty;
Difficulty = Enum.Parse<Difficulty>(SelectedDifficulty);
}
else
{
// set default difficulty to Easy
SelectedDifficulty = Difficulty.Easy.ToString();
Difficulty = Difficulty.Easy;
}
response = await Client.GetFromJsonAsync<SongLeaderboardResponse>($"api/SongLeaderboard/{(uint)Baid}/{(uint)SongId}/{(uint)Difficulty}");
response.ThrowIfNull();
@ -33,6 +48,9 @@ public partial class SongLeaderboardCard
isLoading = true;
SelectedDifficulty = difficulty;
Difficulty = Enum.Parse<Difficulty>(SelectedDifficulty);
await LocalStorage.SetItemAsync("songPageDifficulty", SelectedDifficulty);
response = await Client.GetFromJsonAsync<SongLeaderboardResponse>($"api/SongLeaderboard/{(uint)Baid}/{(uint)SongId}/{(uint)Difficulty}");
response.ThrowIfNull();
isLoading = false;