145 lines
7.1 KiB
Plaintext
145 lines
7.1 KiB
Plaintext
@inject IGameDataService GameDataService
|
|
@inject HttpClient Client
|
|
@inject LoginService LoginService
|
|
@inject IJSRuntime JSRuntime
|
|
@inject NavigationManager NavigationManager
|
|
@using TaikoWebUI.Utilities;
|
|
@using TaikoWebUI.Shared.Models;
|
|
@using SharedProject.Enums;
|
|
|
|
@page "/Users/{baid:int}/Songs"
|
|
|
|
<MudBreadcrumbs Items="breadcrumbs" Class="p-0 mb-2"></MudBreadcrumbs>
|
|
<MudText Typo="Typo.h4">@Localizer["Key_01"]</MudText>
|
|
|
|
<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
|
|
{
|
|
@if (LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin)))
|
|
{
|
|
if (!LoginService.IsLoggedIn)
|
|
{
|
|
NavigationManager.NavigateTo("/Login");
|
|
}
|
|
else
|
|
{
|
|
NavigationManager.NavigateTo("/");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<MudItem xs="12">
|
|
<MudTable Items="musicMap" Elevation="0" Outlined="true" Filter="@FilterSongs">
|
|
<ToolBarContent>
|
|
<MudGrid Spacing="2">
|
|
<MudItem xs="12" md="8">
|
|
<MudTextField @bind-Value="Search"
|
|
Placeholder="@Localizer["Search by Title or Artist"]"
|
|
Variant="Variant.Outlined"
|
|
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)
|
|
</MudSelectItem>
|
|
}
|
|
</MudSelect>
|
|
</MudItem>
|
|
</MudGrid>
|
|
</ToolBarContent>
|
|
<HeaderContent>
|
|
<MudTh>
|
|
<MudTableSortLabel T="MusicDetail" SortBy="context => GameDataService.GetMusicNameBySongId(context.SongId, CurrentLanguage)">
|
|
Song Title / Artist
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel T="MusicDetail" SortBy="context => context.Genre">
|
|
Genre
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
@foreach (var difficulty in Enum.GetValues<Difficulty>())
|
|
{
|
|
@if (difficulty is not Difficulty.None)
|
|
{
|
|
<MudTh>
|
|
<MudTableSortLabel T="MusicDetail" SortBy="context => GameDataService.GetMusicStarLevel(context.SongId, difficulty)">
|
|
<img src="@ScoreUtils.GetDifficultyIcon(difficulty)" alt="@ScoreUtils.GetDifficultyTitle(difficulty)" style="@Constants.ICON_STYLE" />
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
}
|
|
}
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
<MudTd Style="width:400px">
|
|
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
|
<div>
|
|
<a href="@($"/Users/{Baid}/Songs/{context.SongId}")">
|
|
<MudText Typo="Typo.body2" Style="font-weight:bold">
|
|
@GameDataService.GetMusicNameBySongId(context.SongId, CurrentLanguage)
|
|
</MudText>
|
|
<MudText Typo="Typo.caption">
|
|
@GameDataService.GetMusicArtistBySongId(context.SongId, CurrentLanguage)
|
|
</MudText>
|
|
</a>
|
|
</div>
|
|
<div>
|
|
<MudToggleIconButton
|
|
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>
|
|
</MudStack>
|
|
</MudTd>
|
|
<MudTd>
|
|
<MudChip Style="@ScoreUtils.GetGenreStyle(context.Genre)" Size="Size.Small">
|
|
@ScoreUtils.GetGenreTitle(context.Genre)
|
|
</MudChip>
|
|
</MudTd>
|
|
@foreach (var difficulty in Enum.GetValues<Difficulty>())
|
|
{
|
|
@if (difficulty is not Difficulty.None)
|
|
{
|
|
var starLevel = GameDataService.GetMusicStarLevel(context.SongId, difficulty);
|
|
<MudTd>
|
|
@if (starLevel > 0)
|
|
{
|
|
<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;">@starLevel</MudText>
|
|
</MudStack>
|
|
}
|
|
else
|
|
{
|
|
<MudText Typo="Typo.body2" Style="font-weight:bold">
|
|
-
|
|
</MudText>
|
|
}
|
|
</MudTd>
|
|
}
|
|
}
|
|
</RowTemplate>
|
|
<PagerContent>
|
|
<MudTablePager />
|
|
</PagerContent>
|
|
</MudTable>
|
|
</MudItem>
|
|
}
|
|
}
|
|
</MudGrid> |