1
0
mirror of synced 2024-12-21 02:45:54 +01:00
TaikoLocalServer/TaikoWebUI/Components/Song/PlayHistoryCard.razor

110 lines
5.0 KiB
Plaintext
Raw Normal View History

2024-03-13 16:23:22 +01:00
@using TaikoWebUI.Utilities;
<MudCard Outlined="true" Elevation="0">
<MudCardHeader>
<MudGrid Spacing="2">
2024-06-03 01:55:44 +02:00
<MudItem xs="12">
<MudText Typo="Typo.h6">@Localizer["Play History"] (@Items.Count)</MudText>
</MudItem>
</MudGrid>
2024-03-13 16:23:22 +01:00
</MudCardHeader>
@if (Items.Count > 0)
2024-03-13 16:23:22 +01:00
{
<MudCardContent Class="pa-0">
2024-10-31 15:39:45 +01:00
<MudTable RowClassFunc="@GetActiveRowClass" Items="Items" Elevation="0" Striped="false" Dense="true" Breakpoint=Breakpoint.None>
2024-03-13 16:23:22 +01:00
<HeaderContent>
<MudTh>
2024-05-17 00:32:46 +02:00
<MudTableSortLabel InitialDirection="SortDirection.Descending" T="SongHistoryData" SortBy="x => x.PlayTime">
@Localizer["Play Time"]
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongHistoryData" SortBy="x => (int)x.Difficulty * 1000000 + x.Score">
@Localizer["Difficulty"]
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongHistoryData" SortBy="x => (int)x.Crown * 1000000 + x.Score">
@Localizer["Crown"]
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel T="SongHistoryData" SortBy="x => (int)x.ScoreRank * 1000000 + x.Score">
@Localizer["Rank"]
</MudTableSortLabel>
</MudTh>
<MudTh>
2024-05-17 00:32:46 +02:00
<MudTableSortLabel T="SongHistoryData" SortBy="x => x.Score">
@Localizer["Score"]
</MudTableSortLabel>
</MudTh>
<MudTh>
2024-05-17 00:32:46 +02:00
<MudTableSortLabel T="SongHistoryData" SortBy="x => x.GoodCount">
@Localizer["Good"]
</MudTableSortLabel>
</MudTh>
<MudTh>
2024-05-17 00:32:46 +02:00
<MudTableSortLabel T="SongHistoryData" SortBy="x => x.OkCount">
@Localizer["OK"]
</MudTableSortLabel>
</MudTh>
<MudTh>
2024-05-17 00:32:46 +02:00
<MudTableSortLabel T="SongHistoryData" SortBy="x => x.MissCount">
@Localizer["Bad"]
</MudTableSortLabel>
</MudTh>
<MudTh>
2024-05-17 00:32:46 +02:00
<MudTableSortLabel T="SongHistoryData" SortBy="x => x.DrumrollCount">
@Localizer["Drumroll"]
</MudTableSortLabel>
</MudTh>
<MudTh>
2024-05-17 00:32:46 +02:00
<MudTableSortLabel T="SongHistoryData" SortBy="x => x.ComboCount">
@Localizer["MAX Combo"]
</MudTableSortLabel>
</MudTh>
2024-03-13 16:23:22 +01:00
</HeaderContent>
<RowTemplate>
2024-03-13 16:36:06 +01:00
<MudTd>@context.PlayTime.ToString(Localizer["DateFormat"])</MudTd>
<MudTd>
2024-06-03 17:03:09 +02:00
<img src="@ScoreUtils.GetDifficultyIcon(context.Difficulty)" alt="@context.Difficulty" title="@context.Difficulty" style="@Constants.ICON_STYLE"/>
2024-03-13 16:36:06 +01:00
</MudTd>
<MudTd>
<img src="@($"/images/crown_{context.Crown}.webp")" alt="@(ScoreUtils.GetCrownText(context.Crown))" title="@(ScoreUtils.GetCrownText(context.Crown))" style="@Constants.ICON_STYLE"/>
2024-03-13 16:36:06 +01:00
</MudTd>
<MudTd>
@if (context.ScoreRank is not ScoreRank.None)
{
<img src="@($"/images/rank_{context.ScoreRank}.webp")" alt="@(ScoreUtils.GetRankText(context.ScoreRank))" title="@(ScoreUtils.GetRankText(context.ScoreRank))" style="@Constants.ICON_STYLE"/>
}
2024-03-13 16:36:06 +01:00
</MudTd>
<MudTd>@context.Score</MudTd>
<MudTd>@context.GoodCount</MudTd>
<MudTd>@context.OkCount</MudTd>
<MudTd>@context.MissCount</MudTd>
<MudTd>@context.DrumrollCount</MudTd>
<MudTd>@context.ComboCount</MudTd>
</RowTemplate>
</MudTable>
</MudCardContent>
2024-03-13 16:23:22 +01:00
}
else
{
<MudCardContent Class="pa-0">
2024-03-13 16:23:22 +01:00
<MudText Typo="Typo.body2" Class="pt-4 pb-8" Color="Color.Surface" Align="Align.Center">
@Localizer["No Play History Found"]
2024-03-13 16:23:22 +01:00
</MudText>
</MudCardContent>
}
</MudCard>
@code {
2024-06-03 17:03:09 +02:00
[Parameter]
public List<SongHistoryData> Items { get; set; } = new();
2024-10-31 15:39:45 +01:00
private string GetActiveRowClass(SongHistoryData songHistory, int index)
{
return Items!.MaxBy(x => x.Score)!.Score == songHistory.Score ? "is-current-user" : "";
}
}