1
0
mirror of synced 2024-11-28 16:40:57 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Songs.razor

89 lines
4.0 KiB
Plaintext
Raw Normal View History

2022-09-11 18:28:12 +02:00
@inject IGameDataService GameDataService
@inject HttpClient Client
2023-10-16 11:38:27 +02:00
@inject LoginService LoginService
@inject IJSRuntime JSRuntime
2024-03-09 20:13:56 +01:00
@inject NavigationManager NavigationManager
2024-03-14 05:38:26 +01:00
@using TaikoWebUI.Utilities;
@using TaikoWebUI.Shared.Models;
@using SharedProject.Enums;
2024-03-10 04:48:26 +01:00
@page "/Users/{baid:int}/Songs"
2024-03-09 20:13:56 +01:00
<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)
{
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>
}
else
{
@if (LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin)))
2023-10-16 11:38:27 +02:00
{
2024-03-09 20:13:56 +01:00
if (!LoginService.IsLoggedIn)
{
NavigationManager.NavigateTo("/Login");
}
else
{
NavigationManager.NavigateTo("/");
}
2023-10-16 11:38:27 +02:00
}
else
{
<MudItem xs="12">
2024-03-14 05:38:26 +01:00
<MudTable Items="musicMap" Elevation="0" Outlined="true" Filter="@FilterSongs" Striped="true">
<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>
2024-03-14 03:27:55 +01:00
<HeaderContent>
2024-03-14 05:38:26 +01:00
<MudTh>
<MudTableSortLabel T="MusicDetail" SortBy="context => GameDataService.GetMusicNameBySongId(context.SongId, CurrentLanguage)">
Song Title / Artist
</MudTableSortLabel>
</MudTh>
2024-03-14 03:27:55 +01:00
</HeaderContent>
<RowTemplate>
2024-03-14 05:38:26 +01:00
<MudTd>
2024-03-14 03:27:55 +01:00
<a href="@($"/Users/{Baid}/Songs/{context.SongId}")">
2024-03-14 05:38:26 +01:00
<MudText Typo="Typo.body2">
@GameDataService.GetMusicNameBySongId(context.SongId, CurrentLanguage)
</MudText>
<MudText Typo="Typo.caption">
@GameDataService.GetMusicArtistBySongId(context.SongId, CurrentLanguage)
</MudText>
2024-03-14 03:27:55 +01:00
</a>
2024-03-14 05:38:26 +01:00
</MudTd>
2024-03-14 03:27:55 +01:00
</RowTemplate>
2024-03-14 05:38:26 +01:00
<PagerContent>
<MudTablePager />
</PagerContent>
2024-03-14 03:27:55 +01:00
</MudTable>
2023-10-16 11:38:27 +02:00
</MudItem>
}
}
2022-09-11 18:28:12 +02:00
</MudGrid>