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

83 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 03:00:54 +02:00
<MudItem xs="12" md="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
<MudItem xs="12" md="6">
2024-06-03 17:03:09 +02:00
<MudToggleGroup T="string" Label="@Localizer["Difficulty"]" Variant="Variant.Outlined" Dense="true" ValueChanged="(value) => OnDifficultyChange(value)" Value="SelectedDifficulty">
2024-06-03 03:00:54 +02:00
@foreach (var difficulty in Enum.GetValues(typeof(Difficulty)))
{
2024-06-03 17:03:09 +02:00
if ((Difficulty)difficulty == Difficulty.None)
{
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>
2024-06-03 03:00:54 +02:00
}
2024-06-03 17:03:09 +02:00
</MudToggleGroup>
2024-06-03 03:00:54 +02:00
</MudItem>
2024-06-03 01:55:44 +02:00
</MudGrid>
</MudCardHeader>
<MudCardContent Class="pa-0">
2024-06-03 17:03:09 +02:00
@if (response == null || isLoading == true)
2024-06-03 03:00:54 +02:00
{
<MudCircularProgress />
}
2024-06-03 17:03:09 +02:00
else if (response.Leaderboard.Count == 0)
{
<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 Items="@response.Leaderboard" Class="leaderboard-table" Elevation="0" Outlined="false" Dense="true" Striped="true">
<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>