1
0
mirror of synced 2024-11-23 22:41:01 +01:00

Move Play History table to a component

This commit is contained in:
shiibe 2024-03-13 11:23:22 -04:00
parent 18a933e327
commit f0e99c15a2
4 changed files with 65 additions and 55 deletions

View File

@ -5,13 +5,13 @@ VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TaikoLocalServer", "TaikoLocalServer\TaikoLocalServer.csproj", "{98FDA12C-CD3C-42D0-BEBE-4E809E6E41AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedProject", "SharedProject\SharedProject.csproj", "{34BAE5CA-D46B-489B-8617-3CEB2C0C614F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharedProject", "SharedProject\SharedProject.csproj", "{34BAE5CA-D46B-489B-8617-3CEB2C0C614F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaikoWebUI", "TaikoWebUI\TaikoWebUI.csproj", "{3F02C2B8-D970-4E8D-89AA-1B938DA6E2FE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TaikoWebUI", "TaikoWebUI\TaikoWebUI.csproj", "{3F02C2B8-D970-4E8D-89AA-1B938DA6E2FE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameDatabase", "GameDatabase\GameDatabase.csproj", "{76F2B4D1-C05E-40F4-B577-095CA7DF0528}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameDatabase", "GameDatabase\GameDatabase.csproj", "{76F2B4D1-C05E-40F4-B577-095CA7DF0528}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalSaveModScoreMigrator", "LocalSaveModScoreMigrator\LocalSaveModScoreMigrator.csproj", "{72FAD857-4791-4925-8536-22FABD5976EE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocalSaveModScoreMigrator", "LocalSaveModScoreMigrator\LocalSaveModScoreMigrator.csproj", "{72FAD857-4791-4925-8536-22FABD5976EE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -0,0 +1,59 @@
@using TaikoWebUI.Utilities;
@using SharedProject.Entities;
<MudCard Outlined="true" Elevation="0">
<MudCardHeader>
<MudText Typo="Typo.h6">Play History</MudText>
</MudCardHeader>
@if (Items != null && Items.Count > 0)
{
<MudCardContent Class="p-0">
<MudTable Items="Items" Elevation="0" Striped="true">
<HeaderContent>
<MudTh>@Localizer["Play Time"]</MudTh>
<MudTh>@Localizer["Difficulty"]</MudTh>
<MudTh>@Localizer["Crown"]</MudTh>
<MudTh>@Localizer["Rank"]</MudTh>
<MudTh>@Localizer["Score"]</MudTh>
<MudTh>@Localizer["Good"]</MudTh>
<MudTh>@Localizer["Ok"]</MudTh>
<MudTh>@Localizer["Bad"]</MudTh>
<MudTh>@Localizer["Drumroll"]</MudTh>
<MudTh>@Localizer["Max Combo"]</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.PlayTime</MudTd>
<MudTd>
<img src="@ScoreUtils.GetDifficultyIcon(context.Difficulty)" alt="@context.Difficulty" title="@context.Difficulty" style="@IconStyle" />
</MudTd>
<MudTd>
<img src="@($"/images/crown_{context.Crown}.png")" alt="@(ScoreUtils.GetCrownText(context.Crown))" title="@(ScoreUtils.GetCrownText(context.Crown))" style="@IconStyle" />
</MudTd>
<MudTd>
<img src="@($"/images/rank_{context.ScoreRank}.png")" alt="@(ScoreUtils.GetRankText(context.ScoreRank))" title="@(ScoreUtils.GetRankText(context.ScoreRank))" style="@IconStyle" />
</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>
}
else
{
<MudCardContent>
<MudText Typo="Typo.body2" Class="pt-4 pb-8" Color="Color.Surface" Align="Align.Center">
@Localizer["No play history found."]
</MudText>
</MudCardContent>
}
</MudCard>
@code {
[Parameter] public List<SongPlayDatum> Items { get; set; } = new List<SongPlayDatum>();
private const string IconStyle = "width:25px; height:25px;";
}

View File

@ -7,6 +7,7 @@
@inject IJSRuntime JSRuntime
@using TaikoWebUI.Utilities;
@using TaikoWebUI.Pages.Components.Song;
@if (LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin)))
{
@ -28,55 +29,7 @@ else
<MudText Typo="Typo.body2">@SongArtist</MudText>
<MudGrid Class="my-4 pb-10">
<MudItem xs="12">
<MudCard Outlined="true" Elevation="0">
<MudCardHeader>
<MudText Typo="Typo.h6">Play History</MudText>
</MudCardHeader>
@if (SongBestData is not null && SongBestData.RecentPlayData is not null && SongBestData.RecentPlayData.Count > 0)
{
<MudCardContent Class="p-0">
<MudTable Items="@SongBestData.RecentPlayData" Elevation="0" Striped="true">
<HeaderContent>
<MudTh>Play Time</MudTh>
<MudTh>Difficulty</MudTh>
<MudTh>Crown</MudTh>
<MudTh>Rank</MudTh>
<MudTh>Score</MudTh>
<MudTh>Good</MudTh>
<MudTh>Ok</MudTh>
<MudTh>Bad</MudTh>
<MudTh>Drumroll</MudTh>
<MudTh>Max Combo</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.PlayTime</MudTd>
<MudTd>
<img src="@ScoreUtils.GetDifficultyIcon(context.Difficulty)" alt="@context.Difficulty" title="@context.Difficulty" style="@IconStyle" />
</MudTd>
<MudTd>
<img src="@($"/images/crown_{context.Crown}.png")" alt="@(ScoreUtils.GetCrownText(context.Crown))" title="@(ScoreUtils.GetCrownText(context.Crown))" style="@IconStyle" />
</MudTd>
<MudTd>
<img src="@($"/images/rank_{context.ScoreRank}.png")" alt="@(ScoreUtils.GetRankText(context.ScoreRank))" title="@(ScoreUtils.GetRankText(context.ScoreRank))" style="@IconStyle" />
</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>
}
else
{
<MudCardContent>
<MudText Typo="Typo.body2" Class="pb-8" Color="Color.Surface" Align="Align.Center">No recent play data.</MudText>
</MudCardContent>
}
</MudCard>
<PlayHistoryCard Items="@SongBestData?.RecentPlayData" />
</MudItem>
</MudGrid>
}

View File

@ -18,8 +18,6 @@ namespace TaikoWebUI.Pages
private string SongTitle = string.Empty;
private string SongArtist = string.Empty;
private const string IconStyle = "width:25px; height:25px;";
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();