diff --git a/allstarr/wwwroot/index.html b/allstarr/wwwroot/index.html index 1cb57ba..87046c6 100644 --- a/allstarr/wwwroot/index.html +++ b/allstarr/wwwroot/index.html @@ -1400,7 +1400,7 @@ return; } - tbody.innerHTML = data.mappings.map(m => { + tbody.innerHTML = data.mappings.map((m, index) => { const typeColor = m.type === 'jellyfin' ? 'var(--accent)' : 'var(--success)'; const typeBadge = `${m.type}`; @@ -1421,11 +1421,20 @@ ${targetDisplay} ${createdDate} - + `; }).join(''); + + // Add event listeners to all delete buttons + document.querySelectorAll('.delete-mapping-btn').forEach(btn => { + btn.addEventListener('click', function() { + const playlist = this.getAttribute('data-playlist'); + const spotifyId = this.getAttribute('data-spotify-id'); + deleteTrackMapping(playlist, spotifyId); + }); + }); } catch (error) { console.error('Failed to fetch track mappings:', error); showToast('Failed to fetch track mappings', 'error');