From c92ced2c74e72bfc123c880c047462dc969cde34 Mon Sep 17 00:00:00 2001 From: Caleb Allen Date: Sat, 28 Feb 2026 14:15:24 -0500 Subject: [PATCH] feat(quick-3): wire playlist context menu for batch delete of selected playlists - Update handlePlaylistContextMenu to respect multi-selection on right-click - Make onPlaylistContextAction async with batch delete support - Show 'Delete N Playlists' in context menu when multiple playlists selected - Hide 'Rename' option when multiple playlists are selected - Clear playlist selection after any context action completes --- .../components/playlist-view/playlist-view.ts | 71 ++++++++++++++----- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/playlist-view/playlist-view.ts b/frontend/src/components/playlist-view/playlist-view.ts index 8ea7fdc..d7710ae 100644 --- a/frontend/src/components/playlist-view/playlist-view.ts +++ b/frontend/src/components/playlist-view/playlist-view.ts @@ -1659,6 +1659,14 @@ export class PlaylistView e.stopPropagation(); this.ctxMenu.close(); + + // If the right-clicked playlist is NOT in the current + // multi-selection, replace the selection with just that one. + if (!this.selectedPlaylists.has(index)) { + this.selectedPlaylists = new Set([index]); + this.lastSelectedPlaylistIndex = index; + } + this.playlistContextMenuIndex = index; this.playlistContextMenuOpen = true; @@ -1696,7 +1704,7 @@ export class PlaylistView } } - private onPlaylistContextAction( + private async onPlaylistContextAction( action: string, ) { const index = @@ -1723,13 +1731,32 @@ export class PlaylistView }, ); break; - case 'delete': - void this.handleDeletePlaylist( - entry.summary.ID, - ); + case 'delete': { + if (this.selectedPlaylists.size > 1) { + const ids = [...this.selectedPlaylists] + .map(i => this.entries[i]) + .filter((e): e is PlaylistEntry => e !== undefined) + .map(e => e.summary.ID); + + for (const id of ids) { + await DeletePlaylist(id); + } + + this.selectedPlaylists = new Set(); + this.lastSelectedPlaylistIndex = null; + await this.refreshPlaylists(); + } else { + await this.handleDeletePlaylist( + entry.summary.ID, + ); + } + break; + } } + this.selectedPlaylists = new Set(); + this.lastSelectedPlaylistIndex = null; this.closePlaylistContextMenu(); } @@ -2311,21 +2338,25 @@ export class PlaylistView
+ ${this.selectedPlaylists.size <= 1 + ? html` + + void this.onPlaylistContextAction( + 'rename', + )} + > + + Rename + + ` + : nothing} - this.onPlaylistContextAction( - 'rename', - )} - > - - Rename - - - this.onPlaylistContextAction( + void this.onPlaylistContextAction( 'delete', )} > @@ -2333,7 +2364,9 @@ export class PlaylistView slot="icon" name="trash" > - Delete Playlist + ${this.selectedPlaylists.size > 1 + ? `Delete ${this.selectedPlaylists.size} Playlists` + : 'Delete Playlist'}
`