2024-05-27 00:06:51 +02:00
|
|
|
@using Blazored.LocalStorage
|
|
|
|
|
2024-05-01 17:13:47 +02:00
|
|
|
@inject IGameDataService GameDataService
|
|
|
|
@inject HttpClient Client
|
2024-05-17 00:32:46 +02:00
|
|
|
@inject AuthService AuthService
|
2024-05-25 19:12:30 +02:00
|
|
|
@inject IJSRuntime JsRuntime
|
2024-05-01 17:13:47 +02:00
|
|
|
@inject NavigationManager NavigationManager
|
2024-05-27 00:06:51 +02:00
|
|
|
@inject ILocalStorageService LocalStorage
|
2024-08-13 17:07:39 +02:00
|
|
|
@inject BreadcrumbsStateContainer BreadcrumbsStateContainer
|
2024-05-01 17:13:47 +02:00
|
|
|
|
|
|
|
@page "/Users/{baid:int}/PlayHistory"
|
|
|
|
|
|
|
|
<MudGrid Class="my-8">
|
|
|
|
@if (response is null)
|
|
|
|
{
|
|
|
|
<MudContainer Style="display:flex;margin:50px 0;align-items:center;justify-content:center;">
|
|
|
|
<MudProgressCircular Indeterminate="true" Size="Size.Large" Color="Color.Primary" />
|
|
|
|
</MudContainer>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-05-17 00:32:46 +02:00
|
|
|
@if (AuthService.LoginRequired && (!AuthService.IsLoggedIn || (AuthService.GetLoggedInBaid() != Baid && !AuthService.IsAdmin)))
|
2024-05-01 17:13:47 +02:00
|
|
|
{
|
2024-05-17 03:15:21 +02:00
|
|
|
if (!AuthService.IsLoggedIn)
|
|
|
|
{
|
|
|
|
NavigationManager.NavigateTo("/Login");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NavigationManager.NavigateTo("/");
|
|
|
|
}
|
2024-05-01 17:13:47 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<MudItem xs="12">
|
2024-10-31 15:39:45 +01:00
|
|
|
<MudTable Class="mud-table-outlined" Items="@songHistoryDataMap.Values.ToList()" Elevation="0" Filter=@FilterSongs RowsPerPage="25" Striped="false" Hover="false" Bordered="false" Dense="true" Breakpoint=Breakpoint.None>
|
2024-05-01 17:13:47 +02:00
|
|
|
<ToolBarContent>
|
2024-05-17 03:15:21 +02:00
|
|
|
<MudGrid Spacing="2" Justify="Justify.SpaceBetween">
|
2024-10-29 14:33:03 +01:00
|
|
|
<MudItem xs="12" md="4" Style="align-content: center;">
|
|
|
|
<MudText Typo="Typo.body2">@Localizer["Total Credits Played"]: @songHistoryDataMap.Values.Count</MudText>
|
2024-05-01 17:13:47 +02:00
|
|
|
</MudItem>
|
|
|
|
<MudItem xs="12" md="8">
|
|
|
|
<MudTextField @bind-Value="Search"
|
|
|
|
Placeholder=@Localizer["Search by Title, Artist or Date"]
|
|
|
|
Variant="Variant.Outlined"
|
|
|
|
Clearable="true"
|
|
|
|
Immediate="true"
|
|
|
|
Margin="Margin.Dense"
|
|
|
|
Adornment="Adornment.Start"
|
|
|
|
AdornmentIcon="@Icons.Material.Filled.Search"
|
2024-10-29 14:33:03 +01:00
|
|
|
IconSize="Size.Medium" />
|
2024-05-01 17:13:47 +02:00
|
|
|
</MudItem>
|
|
|
|
</MudGrid>
|
|
|
|
</ToolBarContent>
|
|
|
|
<HeaderContent>
|
2024-10-29 14:33:03 +01:00
|
|
|
<MudTh Style="text-align: initial !important;">
|
2024-05-01 17:13:47 +02:00
|
|
|
<MudTableSortLabel InitialDirection="SortDirection.Descending" T="List<SongHistoryData>" SortBy="x => x[0].PlayTime">
|
|
|
|
@Localizer["Play Time"]
|
|
|
|
</MudTableSortLabel>
|
|
|
|
</MudTh>
|
|
|
|
</HeaderContent>
|
|
|
|
<RowTemplate>
|
2024-10-31 15:39:45 +01:00
|
|
|
<MudTable Items="@context" T="SongHistoryData" Context="songHistoryData" Elevation="0" Class="tagged-toolbar" Striped="false" Hover="false" ReadOnly="true" Outlined="true" Breakpoint=Breakpoint.None>
|
|
|
|
<ToolBarContent>
|
|
|
|
<MudText Typo="Typo.body1">@CultureInfo.CurrentCulture.TextInfo.ToTitleCase(context[0].PlayTime.ToString(Localizer["DateFormat"]))</MudText>
|
|
|
|
</ToolBarContent>
|
2024-05-01 17:13:47 +02:00
|
|
|
<HeaderContent>
|
2024-10-31 15:39:45 +01:00
|
|
|
<MudTh Style="width:300px; background-color: var(--mud-palette-table-striped);">@Localizer["Song Title / Artist"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["Genre"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["Level"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["Score"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["Crown"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["Rank"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["Good"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["OK"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["Bad"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["Drumroll"]</MudTh>
|
|
|
|
<MudTh Style="background-color: var(--mud-palette-table-striped);">@Localizer["MAX Combo"]</MudTh>
|
2024-05-01 17:13:47 +02:00
|
|
|
</HeaderContent>
|
|
|
|
<RowTemplate>
|
|
|
|
@* Song title *@
|
2024-10-29 14:33:03 +01:00
|
|
|
<MudTd DataLabel="Song" Style="text-align: initial !important;">
|
2024-05-17 03:15:21 +02:00
|
|
|
<MudStack Row="true" Spacing="1" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween">
|
2024-10-31 15:39:45 +01:00
|
|
|
<div style="margin: 4px; display: flex;">
|
|
|
|
<MudIcon Style=@IconStyle Icon="@GetDifficultyIcon(songHistoryData.Difficulty)" />
|
|
|
|
</div>
|
|
|
|
<div style="width:300px; padding-left: 4px;">
|
2024-05-17 03:15:21 +02:00
|
|
|
<a href="@($"/Users/{Baid}/Songs/{songHistoryData.SongId}")">
|
|
|
|
<MudText Typo="Typo.body2" Style="font-weight:bold">@songHistoryData.MusicName</MudText>
|
|
|
|
<MudText Typo="Typo.caption">@songHistoryData.MusicArtist</MudText>
|
|
|
|
</a>
|
|
|
|
</div>
|
2024-05-25 19:12:30 +02:00
|
|
|
</MudStack>
|
2024-05-01 17:13:47 +02:00
|
|
|
</MudTd>
|
|
|
|
|
|
|
|
@* Genre display *@
|
2024-10-31 12:40:30 +01:00
|
|
|
<MudTd DataLabel="Genre" Style="width: 150px;">
|
2024-05-01 17:13:47 +02:00
|
|
|
<MudChip Style=@GetGenreStyle(songHistoryData.Genre) Size="Size.Small">@GetGenreTitle(songHistoryData.Genre)</MudChip>
|
|
|
|
</MudTd>
|
|
|
|
|
2024-10-31 12:40:30 +01:00
|
|
|
@* Star rating *@
|
|
|
|
<MudTd DataLabel="Stars" Style="text-align:center">
|
|
|
|
<MudStack Row="true" Spacing="1" AlignItems="AlignItems.Center">
|
|
|
|
<MudIcon Icon="@Icons.Material.Filled.Star" Size="Size.Small" />
|
|
|
|
<MudText Typo="Typo.caption" Style="line-height:1;margin-top:2px;margin-right:2px;">@songHistoryData.Stars</MudText>
|
|
|
|
</MudStack>
|
|
|
|
</MudTd>
|
|
|
|
|
2024-05-01 17:13:47 +02:00
|
|
|
<MudTd>@(songHistoryData.Score)</MudTd>
|
2024-10-25 10:06:14 +02:00
|
|
|
<MudTd Style="text-align:center"><img src="@($"/images/crown_{songHistoryData.Crown}.webp")" alt="@(GetCrownText(songHistoryData.Crown))" title="@(GetCrownText(songHistoryData.Crown))" style=@IconStyle /></MudTd>
|
2024-05-01 17:13:47 +02:00
|
|
|
<MudTd Style="text-align:center">
|
|
|
|
@if (songHistoryData.ScoreRank is not ScoreRank.None)
|
|
|
|
{
|
2024-10-29 14:33:03 +01:00
|
|
|
<img src="@($"/images/rank_{songHistoryData.ScoreRank}.webp")" alt="@(GetRankText(songHistoryData.ScoreRank))" title="@(GetRankText(songHistoryData.ScoreRank))" style=@IconStyle />
|
2024-05-01 17:13:47 +02:00
|
|
|
}
|
|
|
|
</MudTd>
|
|
|
|
<MudTd>@(songHistoryData.GoodCount)</MudTd>
|
|
|
|
<MudTd>@(songHistoryData.OkCount)</MudTd>
|
|
|
|
<MudTd>@(songHistoryData.MissCount)</MudTd>
|
|
|
|
<MudTd>@(songHistoryData.DrumrollCount)</MudTd>
|
|
|
|
<MudTd>@(songHistoryData.ComboCount)</MudTd>
|
|
|
|
</RowTemplate>
|
|
|
|
</MudTable>
|
2024-10-31 15:39:45 +01:00
|
|
|
</RowTemplate>
|
2024-05-01 17:13:47 +02:00
|
|
|
<PagerContent>
|
2024-05-17 00:32:46 +02:00
|
|
|
<MudTablePager RowsPerPageString=@Localizer["Rows Per Page:"] />
|
2024-05-01 17:13:47 +02:00
|
|
|
</PagerContent>
|
|
|
|
</MudTable>
|
|
|
|
</MudItem>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</MudGrid>
|
|
|
|
|