Вынесена логика формирования обложки
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
@onmouseleave="HandleMouseLeave"
|
||||
style="position: relative; display: inline-block; cursor: pointer;">
|
||||
|
||||
<MudImage Src="@FormatCoverUrl(CoverUrl)" Height="@Height" Width="@Width" Class="rounded" Style="display: block;" />
|
||||
<MudImage Src="@CoverUrl.FormatCoverUrl(Width, Height)" Height="@Height" Width="@Width" Class="rounded" Style="display: block;" />
|
||||
|
||||
@if (_isHovered || IsCurrentTrackPlaying)
|
||||
{
|
||||
@@ -62,10 +62,4 @@
|
||||
{
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private string FormatCoverUrl(string? url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url)) return "";
|
||||
return "https://" + url.Replace("%%", $"{Width}x{Height}");
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
<div style="display: flex; gap: 16px; align-items: center;">
|
||||
@if (!string.IsNullOrEmpty(Playlist?.CoverUrl))
|
||||
{
|
||||
<MudImage Src="@FormatCoverUrl(Playlist.CoverUrl, "80x80")" Height="80" Width="80" Class="rounded" />
|
||||
<MudImage Src="@Playlist.CoverUrl.FormatCoverUrl(80, 80)" Height="80" Width="80" Class="rounded" />
|
||||
}
|
||||
<div>
|
||||
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
||||
@@ -144,10 +144,4 @@
|
||||
await OnPermissionsChanged.InvokeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private string FormatCoverUrl(string? url, string size)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url)) return "";
|
||||
return "https://" + url.Replace("%%", size);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudImage Src="@FormatCoverUrl(context.CoverUri, "50x50")" Height="50" Width="50" Class="rounded" />
|
||||
<MudImage Src="@context.CoverUri.FormatCoverUrl(50, 50)" Height="50" Width="50" Class="rounded" />
|
||||
}
|
||||
}
|
||||
</MudTd>
|
||||
@@ -141,12 +141,6 @@
|
||||
await OnPlayTrack.InvokeAsync(trackId);
|
||||
}
|
||||
|
||||
private string FormatCoverUrl(string? url, string size)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url)) return "";
|
||||
return "https://" + url.Replace("%%", size);
|
||||
}
|
||||
|
||||
private string FormatDuration(long ms)
|
||||
{
|
||||
var seconds = ms / 1000;
|
||||
|
||||
Reference in New Issue
Block a user