| 1 |
@* A track's artists, comma-separated, each linked to Spotify where we have its id. *@ |
| 2 |
@* Names and ids arrive positionally parallel from the bot, so an id is matched to a name *@ |
| 3 |
@* by index - a shorter id list (a play recorded before they were stored) just means the *@ |
| 4 |
@* trailing names go unlinked. *@ |
| 5 |
|
| 6 |
@for (var i = 0; i < Names.Count; i++) |
| 7 |
{ |
| 8 |
if (i > 0) |
| 9 |
{ |
| 10 |
<text>, </text> |
| 11 |
} |
| 12 |
|
| 13 |
<SpotifyLink Kind="artist" Id="@IdAt(i)" Name="@Names[i]"/> |
| 14 |
} |
| 15 |
|
| 16 |
@code { |
| 17 |
[Parameter] |
| 18 |
[EditorRequired] |
| 19 |
public required IReadOnlyList<string> Names { get; set; } |
| 20 |
|
| 21 |
[Parameter] |
| 22 |
public IReadOnlyList<string> Ids { get; set; } = []; |
| 23 |
|
| 24 |
private string? IdAt(int index) => index < Ids.Count ? Ids[index] : null; |
| 25 |
} |