1
0
mirror of synced 2024-12-01 17:47:32 +01:00
TaikoLocalServer/TaikoWebUI/Components/Song/SongLeaderboardCard.razor

81 lines
3.7 KiB
Plaintext
Raw Normal View History

2024-06-03 01:55:44 +02:00
@inject HttpClient Client;
2024-06-03 03:00:54 +02:00
@inject Blazored.LocalStorage.ILocalStorageService LocalStorage;
2024-06-03 01:55:44 +02:00
@using TaikoWebUI.Utilities;
2024-06-03 01:29:33 +02:00
2024-06-03 01:55:44 +02:00
<MudCard Outlined="true" Elevation="0">
<MudCardHeader>
2024-06-03 17:03:09 +02:00
<MudGrid Spacing="2" Class="align-center pb-2">
2024-06-03 17:27:18 +02:00
<MudItem xs="6">
2024-06-03 01:55:44 +02:00
<MudText Typo="Typo.h6">@Localizer["Leaderboard"]</MudText>
</MudItem>
2024-06-03 03:00:54 +02:00
2024-06-03 17:27:18 +02:00
<MudItem xs="6">
<MudStack Justify="Justify.FlexEnd" Row="true">
2024-06-03 17:38:52 +02:00
<MudToggleGroup T="string" Label="@Localizer["Difficulty"]" Dense="true" ValueChanged="(value) => OnDifficultyChange(value)" Value="SelectedDifficulty" Style="width:300px">
2024-06-03 17:27:18 +02:00
@foreach (var difficulty in Enum.GetValues(typeof(Difficulty)))
{
2024-06-03 17:38:52 +02:00
if ((Difficulty)difficulty == Difficulty.None)
{
continue;
}
2024-06-03 17:27:18 +02:00
2024-06-03 17:38:52 +02:00
<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>
2024-06-03 17:27:18 +02:00
}
</MudToggleGroup>
</MudStack>
2024-06-03 03:00:54 +02:00
</MudItem>
2024-06-03 01:55:44 +02:00
</MudGrid>
</MudCardHeader>
<MudCardContent Class="pa-0">
@if (response == null || response.Leaderboard.Count == 0)
2024-06-03 17:03:09 +02:00
{
<MudGrid>
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-16">
@Localizer["NoData"]
</MudText>
</MudItem>
</MudGrid>
}
2024-06-03 03:00:54 +02:00
else
{
<MudTable Loading="isLoading" Items="@response.Leaderboard" Class="leaderboard-table" Elevation="0" Outlined="false" Dense="true" Striped="true">
2024-06-03 03:00:54 +02:00
<HeaderContent>
<MudTh>@Localizer["Rank"]</MudTh>
<MudTh>@Localizer["Player"]</MudTh>
<MudTh>@Localizer["Score"]</MudTh>
<MudTh>@Localizer["Rank"]</MudTh>
<MudTh>@Localizer["Crown"]</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.Rank</MudTd>
<MudTd>
<MudStack Row="true" AlignItems="AlignItems.Baseline">
<MudText Typo="Typo.body1">@context.UserName</MudText>
<MudText Typo="Typo.caption">(@Localizer["ID"]: @context.Baid)</MudText>
</MudStack>
</MudTd>
<MudTd>@context.BestScore</MudTd>
<MudTd>
@if (context.BestScoreRank is not ScoreRank.None)
{
2024-06-03 17:03:09 +02:00
<img src="@($"/images/rank_{context.BestScoreRank}.png")" alt="@(ScoreUtils.GetRankText(context.BestScoreRank))" title="@(ScoreUtils.GetRankText(context.BestScoreRank))" style="@Constants.ICON_STYLE"/>
2024-06-03 03:00:54 +02:00
}
else
{
<MudText Typo="Typo.body1">—</MudText>
}
</MudTd>
<MudTd>
2024-06-03 17:03:09 +02:00
<img src="@($"/images/crown_{context.BestCrown}.png")" alt="@(ScoreUtils.GetCrownText(context.BestCrown))" title="@(ScoreUtils.GetCrownText(context.BestCrown))" style="@Constants.ICON_STYLE"/>
2024-06-03 03:00:54 +02:00
</MudTd>
</RowTemplate>
</MudTable>
}
</MudCardContent>
2024-06-03 01:55:44 +02:00
</MudCard>