1
0
mirror of synced 2025-02-17 11:18:32 +01:00

Change tabs from genre to difficulty, add genre column

This commit is contained in:
shiibe 2022-09-10 15:43:01 -04:00
parent 3b1f8e120e
commit 00eecb8ebd

View File

@ -26,11 +26,13 @@
else
{
<MudItem xs="12">
<MudTabs Elevation="2" Rounded="true" ApplyEffectsToContainer="true" PanelClass="pa-6">
@foreach (var genre in Enum.GetValues<SongGenre>())
<MudTabs Elevation="0" Border="true" Rounded="true" ApplyEffectsToContainer="true" PanelClass="py-6">
@foreach (var difficulty in Enum.GetValues<Difficulty>())
{
<MudTabPanel Text="@genre.ToString()">
<MudDataGrid Items="@response.SongBestData.Where(data => GameDataService.GetMusicGenreBySongId(data.SongId) == genre)"
@if (difficulty is not Difficulty.None)
{
<MudTabPanel Text="@difficulty.ToString()" Icon="@getDifficultyIcon(difficulty)">
<MudDataGrid Items="@response.SongBestData.Where(data => data.Difficulty == difficulty)"
ColumnResizeMode="ResizeMode.Container">
<Columns>
<Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Song" StickyLeft="true" Class="clm-row-large">
@ -57,11 +59,12 @@
</MudGrid>
</CellTemplate>
</Column>
<Column T="SongBestData" Field="@nameof(SongBestData.Difficulty)" Title="Course">
<Column T="SongBestData" Field="@nameof(SongBestData.SongId)" Title="Genre">
<CellTemplate>
<MudTooltip Text="@(context.Item.Difficulty.ToString())" Arrow="true" Placement="Placement.Top">
<img src="@($"/images/{context.Item.Difficulty}.png")" alt="@(context.Item.Difficulty)" style="@ICON_STYLE"/>
</MudTooltip>
<MudChip Style="@getGenreStyle(GameDataService.GetMusicGenreBySongId(context.Item.SongId))"
Size="Size.Small">
@getGenreTitle(GameDataService.GetMusicGenreBySongId(context.Item.SongId))
</MudChip>
</CellTemplate>
</Column>
<Column T="SongBestData" Field="@nameof(SongBestData.BestScore)" Title="Best Score"/>
@ -95,6 +98,7 @@
</MudDataGrid>
</MudTabPanel>
}
}
</MudTabs>
</MudItem>
}
@ -173,4 +177,40 @@
};
}
private string getDifficultyIcon(Difficulty difficulty)
{
return $"<image href='/images/{difficulty}.png' alt='{difficulty}' width='24' height='24'/>";
}
private string getGenreTitle(SongGenre genre)
{
return genre switch
{
SongGenre.Pop => "Pop",
SongGenre.Anime => "Anime",
SongGenre.Kids => "Kids",
SongGenre.Vocaloid => "Vocaloid",
SongGenre.GameMusic => "Game Music",
SongGenre.NamcoOriginal => "NAMCO Original",
SongGenre.Variety => "Variety",
SongGenre.Classical => "Classical",
_ => ""
};
}
private string getGenreStyle(SongGenre genre)
{
return genre switch
{
SongGenre.Pop => "background: #42c0d2; color: #fff",
SongGenre.Anime => "background: #ff90d3; color: #fff",
SongGenre.Kids => "background: #fec000; color: #fff",
SongGenre.Vocaloid => "background: #ddd",
SongGenre.GameMusic => "background: #cc8aea; color: #fff",
SongGenre.NamcoOriginal => "background: #ff7027; color: #fff",
SongGenre.Variety => "background: #1dc83b; color: #fff",
SongGenre.Classical => "background: #bfa356",
_ => ""
};
}
}