Skip to content

Commit

Permalink
add selection persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
annierusu committed Jun 1, 2024
1 parent 65f2ff0 commit cf6d97b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Milestone3/csvManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,14 @@ function displayList(data) {
updateSelectedSong(song);
updateAttributeBars(song);
const track = await getTrackById(song.id);


//Make selected song appear selected, but remove selection if another song is selected
const allSongBoxes = document.querySelectorAll('.song-box');
allSongBoxes.forEach(box => {
box.classList.remove('selected');
});
songBox.classList.add('selected');

// If the track exists and has a preview URL, show the audio player and play the song
if (track && track.preview_url) {
document.getElementById('audio-player-container').style.display = 'block';
Expand Down Expand Up @@ -562,7 +569,6 @@ function resetAllFilters(){
function setHighlight(element){
element.style.color = '#ff7332';
setTimeout(function(){ element.style.color = '#1B1141'; }, 1500);

}

/** When clicking on a bar, set the respective filter on the DJ board and apply it */
Expand Down
5 changes: 5 additions & 0 deletions Milestone3/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ body {
box-shadow: 1px 1px var(--accent-color);
}

.song-box.selected {
background-color: var(--accent-color); /* Change background color when selected */
box-shadow: 1px 1px var(--accent-color);
}

/* Styling the scrollbar for the song container
.song-container-scrollable::-webkit-scrollbar {
width: 8px;
Expand Down

0 comments on commit cf6d97b

Please sign in to comment.