Вынесена логика формирования обложки

This commit is contained in:
FrigaT
2026-04-14 19:03:11 +03:00
parent e0fca7e55e
commit acf02c85a7
5 changed files with 24 additions and 22 deletions

View File

@@ -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}");
}
}