2024-05-27 00:06:51 +02:00
|
|
|
@using Blazored.LocalStorage
|
|
|
|
@using TaikoWebUI.Utilities;
|
|
|
|
|
|
|
|
@inject IGameDataService GameDataService
|
2022-09-09 14:31:45 +02:00
|
|
|
@inject HttpClient Client
|
2024-05-17 00:32:46 +02:00
|
|
|
@inject AuthService AuthService
|
2024-05-27 00:06:51 +02:00
|
|
|
@inject ILocalStorageService LocalStorage
|
2024-03-09 20:13:56 +01:00
|
|
|
@inject NavigationManager NavigationManager
|
2024-08-13 17:07:39 +02:00
|
|
|
@inject BreadcrumbsStateContainer BreadcrumbsStateContainer
|
2022-09-09 14:31:45 +02:00
|
|
|
|
2024-03-10 04:48:26 +01:00
|
|
|
@page "/Users/{baid:int}/Songs"
|
2022-09-09 14:31:45 +02:00
|
|
|
|
2022-09-10 06:56:53 +02:00
|
|
|
<MudGrid Class="my-8">
|
2022-09-10 17:45:18 +02:00
|
|
|
@if (response is null)
|
|
|
|
{
|
2024-03-14 03:27:55 +01:00
|
|
|
<MudContainer Style="display:flex;margin:50px 0;align-items:center;justify-content:center;">
|
|
|
|
<MudProgressCircular Indeterminate="true" Size="Size.Large" Color="Color.Primary" />
|
|
|
|
</MudContainer>
|
2022-09-10 17:45:18 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-05-17 00:32:46 +02:00
|
|
|
@if (AuthService.LoginRequired && (!AuthService.IsLoggedIn || (AuthService.GetLoggedInBaid() != Baid && !AuthService.IsAdmin)))
|
2023-10-16 11:38:27 +02:00
|
|
|
{
|
2024-05-17 00:32:46 +02:00
|
|
|
NavigationManager.NavigateTo(AuthService.IsLoggedIn ? "/" : "/Login");
|
2023-10-16 11:38:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<MudItem xs="12">
|
2024-10-29 14:33:03 +01:00
|
|
|
<MudTable Items="musicDetailDictionary.Values" Elevation="0" RowsPerPage="25" Outlined="true" Filter="@FilterSongs" Breakpoint=Breakpoint.None>
|
2024-03-14 05:38:26 +01:00
|
|
|
<ToolBarContent>
|
|
|
|
<MudGrid Spacing="2">
|
|
|
|
<MudItem xs="12" md="8">
|
|
|
|
<MudTextField @bind-Value="Search"
|
|
|
|
Placeholder="@Localizer["Search by Title or Artist"]"
|
|
|
|
Variant="Variant.Outlined"
|
2024-03-27 04:51:32 +01:00
|
|
|
Clearable="true"
|
|
|
|
Immediate="true"
|
2024-03-14 05:38:26 +01:00
|
|
|
Margin="Margin.Dense"
|
|
|
|
Adornment="Adornment.Start"
|
|
|
|
AdornmentIcon="@Icons.Material.Filled.Search"
|
|
|
|
IconSize="Size.Medium" />
|
|
|
|
</MudItem>
|
|
|
|
<MudItem xs="12" md="4">
|
|
|
|
<MudSelect @bind-Value="GenreFilter" T="string" Label="@Localizer["Filter by Genre"]" Variant="Variant.Outlined" Margin="Margin.Dense" Clearable="true">
|
|
|
|
@foreach (var genre in Enum.GetValues(typeof(SongGenre)))
|
|
|
|
{
|
|
|
|
var genreValue = (SongGenre)genre;
|
|
|
|
<MudSelectItem Value="@genreValue.ToString()" Label="@Localizer[$"Key_{genreValue}"]">
|
|
|
|
@ScoreUtils.GetGenreTitle(genreValue)
|
2024-03-17 20:46:47 +01:00
|
|
|
</MudSelectItem>
|
2024-03-14 05:38:26 +01:00
|
|
|
}
|
|
|
|
</MudSelect>
|
|
|
|
</MudItem>
|
|
|
|
</MudGrid>
|
|
|
|
</ToolBarContent>
|
2024-03-14 03:27:55 +01:00
|
|
|
<HeaderContent>
|
2024-10-31 12:40:30 +01:00
|
|
|
<MudTh Style="width: 400px">
|
2024-05-27 00:06:51 +02:00
|
|
|
<MudTableSortLabel T="MusicDetail" SortBy="context => GameDataService.GetMusicNameBySongId(musicDetailDictionary, context.SongId, SongNameLanguage)">
|
2024-05-01 17:13:47 +02:00
|
|
|
@Localizer["Song Title / Artist"]
|
2024-03-14 05:38:26 +01:00
|
|
|
</MudTableSortLabel>
|
|
|
|
</MudTh>
|
2024-10-31 12:40:30 +01:00
|
|
|
<MudTh Style="width: 150px;">
|
2024-03-27 04:08:12 +01:00
|
|
|
<MudTableSortLabel T="MusicDetail" SortBy="context => context.Genre">
|
2024-05-01 17:13:47 +02:00
|
|
|
@Localizer["Genre"]
|
2024-03-27 04:08:12 +01:00
|
|
|
</MudTableSortLabel>
|
|
|
|
</MudTh>
|
2024-03-27 04:48:41 +01:00
|
|
|
@foreach (var difficulty in Enum.GetValues<Difficulty>())
|
|
|
|
{
|
|
|
|
@if (difficulty is not Difficulty.None)
|
|
|
|
{
|
2024-10-29 14:33:03 +01:00
|
|
|
<MudTh>
|
|
|
|
<MudTableSortLabel T="MusicDetail" SortBy="context => GameDataService.GetMusicStarLevel(musicDetailDictionary, context.SongId, difficulty)">
|
|
|
|
<img src="@ScoreUtils.GetDifficultyIcon(difficulty)" alt="@ScoreUtils.GetDifficultyTitle(difficulty)" style="@Constants.ICON_STYLE" />
|
|
|
|
</MudTableSortLabel>
|
|
|
|
</MudTh>
|
2024-03-27 04:48:41 +01:00
|
|
|
}
|
|
|
|
}
|
2024-03-14 03:27:55 +01:00
|
|
|
</HeaderContent>
|
|
|
|
<RowTemplate>
|
2024-10-31 12:40:30 +01:00
|
|
|
<MudTd Style="text-align: initial !important;">
|
2024-10-29 14:33:03 +01:00
|
|
|
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
2024-10-31 15:39:45 +01:00
|
|
|
<div style="margin: 4px;">
|
2024-10-29 14:33:03 +01:00
|
|
|
<MudToggleIconButton Toggled="@context.IsFavorite"
|
|
|
|
ToggledChanged="@(async () => await OnFavoriteToggled(context))"
|
|
|
|
Icon="@Icons.Material.Filled.FavoriteBorder" Color="@Color.Secondary"
|
|
|
|
ToggledIcon="@Icons.Material.Filled.Favorite" ToggledColor="@Color.Secondary"
|
|
|
|
Size="Size.Small"
|
|
|
|
ToggledSize="Size.Small"
|
|
|
|
Title="Add to favorites" ToggledTitle="Remove from favorites" />
|
|
|
|
</div>
|
2024-10-31 12:40:30 +01:00
|
|
|
<div style="width:400px">
|
|
|
|
<a href="@($"/Users/{Baid}/Songs/{context.SongId}")">
|
|
|
|
<MudText Typo="Typo.body2" Style="font-weight:bold">@GameDataService.GetMusicNameBySongId(musicDetailDictionary, context.SongId, SongNameLanguage)</MudText>
|
|
|
|
<MudText Typo="Typo.caption">@GameDataService.GetMusicArtistBySongId(musicDetailDictionary, context.SongId, SongNameLanguage)</MudText>
|
|
|
|
</a>
|
|
|
|
</div>
|
2024-03-17 20:46:47 +01:00
|
|
|
</MudStack>
|
2024-03-14 05:38:26 +01:00
|
|
|
</MudTd>
|
2024-03-27 04:08:12 +01:00
|
|
|
<MudTd>
|
2024-10-29 14:33:03 +01:00
|
|
|
<MudChip Style="@ScoreUtils.GetGenreStyle(context.Genre)" Size="Size.Small">
|
|
|
|
@ScoreUtils.GetGenreTitle(context.Genre)
|
|
|
|
</MudChip>
|
2024-03-27 04:08:12 +01:00
|
|
|
</MudTd>
|
2024-03-27 04:48:41 +01:00
|
|
|
@foreach (var difficulty in Enum.GetValues<Difficulty>())
|
|
|
|
{
|
|
|
|
@if (difficulty is not Difficulty.None)
|
|
|
|
{
|
2024-05-25 19:12:30 +02:00
|
|
|
var starLevel = GameDataService.GetMusicStarLevel(musicDetailDictionary, context.SongId, difficulty);
|
2024-03-27 04:48:41 +01:00
|
|
|
<MudTd>
|
|
|
|
@if (starLevel > 0)
|
2024-10-29 14:33:03 +01:00
|
|
|
{
|
2024-10-31 12:40:30 +01:00
|
|
|
<MudStack Style="display: inline-flex !important;" Row="true" Spacing="1" AlignItems="AlignItems.Center">
|
2024-03-27 04:48:41 +01:00
|
|
|
<MudIcon Icon="@Icons.Material.Filled.Star" Size="Size.Small" />
|
|
|
|
<MudText Typo="Typo.caption" Style="line-height:1;margin-top:2px;margin-right:2px;">@starLevel</MudText>
|
|
|
|
</MudStack>
|
2024-10-29 14:33:03 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<MudText Typo="Typo.body2" Style="font-weight:bold">
|
|
|
|
-
|
|
|
|
</MudText>
|
|
|
|
}
|
2024-03-27 04:48:41 +01:00
|
|
|
</MudTd>
|
|
|
|
}
|
|
|
|
}
|
2024-03-14 03:27:55 +01:00
|
|
|
</RowTemplate>
|
2024-03-14 05:38:26 +01:00
|
|
|
<PagerContent>
|
2024-05-03 23:46:27 +02:00
|
|
|
<MudTablePager RowsPerPageString=@Localizer["Rows Per Page"] />
|
2024-03-14 05:38:26 +01:00
|
|
|
</PagerContent>
|
2024-03-14 03:27:55 +01:00
|
|
|
</MudTable>
|
2023-10-16 11:38:27 +02:00
|
|
|
</MudItem>
|
|
|
|
}
|
2022-09-10 17:45:18 +02:00
|
|
|
}
|
2022-09-11 18:28:12 +02:00
|
|
|
</MudGrid>
|