Изменено отображение треков

This commit is contained in:
FrigaT
2026-04-15 15:56:43 +03:00
parent e00b7a735c
commit 76c9b11a68
7 changed files with 118 additions and 253 deletions

View File

@@ -5,48 +5,14 @@
@inject ISnackbar Snackbar
@inject IDialogService DialogService
<MudTable Items="@_tracks" Hover="true" Breakpoint="Breakpoint.Sm" Loading="_loading">
<HeaderContent>
<MudTh>#</MudTh>
<MudTh>Обложка</MudTh>
<MudTh>Название</MudTh>
<MudTh>Исполнитель</MudTh>
<MudTh>Длительность</MudTh>
@if (CanRemove)
{
<MudTh></MudTh>
}
</HeaderContent>
<MudTable Items="@_tracks" Hover="true" Breakpoint="Breakpoint.Sm" Loading="@_loading">
<RowTemplate>
<MudTd DataLabel="#" Style="font-weight: normal;">@context.Index</MudTd>
<MudTd DataLabel="Обложка">
@if (!string.IsNullOrEmpty(context.CoverUri))
{
@if (CanPlay)
{
<TrackCoverWithPlay CoverUrl="@context.CoverUri"
TrackId="@context.TrackId"
TrackTitle="@context.Title"
PlaylistShareToken="@ShareToken"
Width="50" Height="50"/>
}
else
{
<MudImage Src="@context.CoverUri.FormatCoverUrl(50, 50)" Height="50" Width="50" Class="rounded" />
}
}
<MudTd Style="width: 100%;">
<TrackItem Track="@context" PlaylistShareToken="@ShareToken" />
</MudTd>
<MudTd DataLabel="Название">
<MudLink Href="@($"https://music.yandex.ru/track/{context.TrackId}")" Target="_blank" Underline="Underline.Hover">
@context.Title
<MudIcon Icon="@Icons.Material.Filled.OpenInNew" Size="Size.Small" Class="ml-1" />
</MudLink>
</MudTd>
<MudTd DataLabel="Исполнитель">@string.Join(", ", context.Artists)</MudTd>
<MudTd DataLabel="Длительность">@context.DurationMs.FormatDuration()</MudTd>
@if (CanRemove)
{
<MudTd DataLabel="">
<MudTd>
<MudIconButton Icon="@Icons.Material.Filled.Delete" Color="Color.Error" OnClick="() => RemoveTrack(context)" />
</MudTd>
}
@@ -57,7 +23,6 @@
[Parameter] public string ShareToken { get; set; } = string.Empty;
[Parameter] public bool CanPlay { get; set; }
[Parameter] public bool CanRemove { get; set; }
[Parameter] public string? CurrentPlayingTrackId { get; set; }
[Parameter] public bool IsPlaying { get; set; }
[Parameter] public EventCallback<string> OnPlayTrack { get; set; }