@* A name that links to Spotify when we know its id, and is plain text when we don't. *@
@* Plays recorded before an id was stored, or ones RVRB passed through without one, are *@
@* ordinary here rather than exceptional - hence one component instead of an @@if per table. *@
@if (string.IsNullOrEmpty(Id))
{
@Name
}
else
{
@Name
}
@code {
/// What the id identifies: track, artist, album.
[Parameter]
[EditorRequired]
public required string Kind { get; set; }
/// The Spotify id. Null or empty renders the name unlinked.
[Parameter]
public string? Id { get; set; }
[Parameter]
[EditorRequired]
public required string Name { get; set; }
private string Url => $"https://open.spotify.com/{Kind}/{Uri.EscapeDataString(Id!)}";
}