From 1a3beb7e6f0a4a268012693b931fb3f2738227bc Mon Sep 17 00:00:00 2001 From: Geert Rademakes Date: Thu, 24 Apr 2025 23:50:54 +0200 Subject: [PATCH] Details are working again --- packages/frontend/src/components/SongList.tsx | 61 +++++++++++++++---- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/components/SongList.tsx b/packages/frontend/src/components/SongList.tsx index a4a9828..c151de8 100644 --- a/packages/frontend/src/components/SongList.tsx +++ b/packages/frontend/src/components/SongList.tsx @@ -93,11 +93,6 @@ export const SongList: React.FC = ({ } }; - const handleSongClick = (e: MouseEvent, song: Song) => { - e.stopPropagation(); - onSongSelect(song); - }; - return ( {/* Search Bar */} @@ -181,7 +176,16 @@ export const SongList: React.FC = ({ {/* Song List */} {filteredSongs.map((song) => ( - + onSongSelect(song)} + > ) => { @@ -189,17 +193,50 @@ export const SongList: React.FC = ({ toggleSelection(song.id); }} mr={4} + onClick={(e) => e.stopPropagation()} /> - {song.title} - {song.artist} + + {song.title} + + + {song.artist} + - ⋮} variant="ghost" /> + } + variant="ghost" + onClick={(e) => e.stopPropagation()} + /> - ) => handleSongClick(e, song)}>Select - ) => handleSongClick(e, song)}>Add to Playlist - ) => handleSongClick(e, song)}>Remove from Playlist + {allPlaylists.map((playlist) => ( + { + e.stopPropagation(); + onAddToPlaylist([song.id], playlist.name); + }} + > + Add to {playlist.name} + + ))} + {currentPlaylist !== "All Songs" && onRemoveFromPlaylist && ( + <> + + { + e.stopPropagation(); + onRemoveFromPlaylist([song.id]); + }} + > + Remove from {currentPlaylist} + + + )}