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

89 lines
4.3 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.LeaderboardData.Count == 0)
2024-06-03 17:03:09 +02:00
{
<MudGrid>
<MudItem xs="12">
<MudText Align="Align.Center" Class="my-16">
2024-06-05 15:59:33 +02:00
@Localizer["No Data"]
2024-06-03 17:03:09 +02:00
</MudText>
</MudItem>
</MudGrid>
}
2024-06-03 03:00:54 +02:00
else
{
<MudTable RowClassFunc="@GetActiveRowClass" Loading="isLoading" Items="@response.LeaderboardData" 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>
2024-06-05 05:44:09 +02:00
<MudText Typo="Typo.caption" Style="color: #9E9E9E">(@Localizer["ID"]: @context.Baid)</MudText>
2024-06-03 03:00:54 +02:00
</MudStack>
</MudTd>
<MudTd>@context.BestScore</MudTd>
<MudTd>
@if (context.BestScoreRank is not ScoreRank.None)
{
2024-06-05 04:33:52 +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>
2024-06-05 04:33:52 +02:00
<PagerContent>
@if (TotalPages > 1)
{
<div class="d-flex flex-column align-center">
2024-06-05 05:01:42 +02:00
<MudPagination Class="pa-4" Rectangular="true" DisableElevation="true" Count="@TotalPages" Selected="currentPage" SelectedChanged="(page) => OnPageChange(page)" BoundaryCount="1" MiddleCount="3" />
</div>
}
2024-06-05 04:33:52 +02:00
</PagerContent>
2024-06-03 03:00:54 +02:00
</MudTable>
}
</MudCardContent>
2024-06-03 01:55:44 +02:00
</MudCard>