@inherits FnzComponentBase

<h3>PlaylistTableItemMissingReference</h3>

@code {
    [Parameter, Required] public Guid PlaylistId { get; set; }
    [Parameter, Required] public int TrackIndex { get; set; }
    [Parameter, Required] public string Path { get; set; }
}

@{
    var uri = new Uri(Path);
    var paths = uri.AbsolutePath.Split('/').Skip(2).ToArray();
}

<tr @attribute="@InputAttributes">
    <td><img src="blazor-192.png" style="height:50px" /></td>
    <td colspan="6" class="align-middle w-100">
        <div class="text-nowrap">- broken reference -</div>
        @foreach (var p in paths)
        {
            <span style="display:inline-block" class="text-nowrap text-muted border border-1 m-1 p-1 rounded">@Uri.UnescapeDataString(p)</span>
        }
    </td>
    <td>
        <div class="dropstart">
            <button type="button" class="btn btn-danger p-2" data-bs-toggle="dropdown">
                <i class="bi bi-folder-minus"></i>
            </button>
            <ul class="dropdown-menu mx-2">
                <li><button class="dropdown-item text-danger" @onclick="()=>PlaylistHelper.RemoveTrackInPlaylist(PlaylistId, TrackIndex,Path)">Confirm Remove</button></li>
            </ul>
        </div>
    </td>
</tr>
