@@ -8,12 +8,12 @@ use crate::{
88 key:: { Key , KeySequence } ,
99 state:: {
1010 ActionListItem , Album , AlbumId , Artist , ArtistFocusState , ArtistId , ArtistPopupAction ,
11- BrowsePageUIState , Context , ContextId , ContextPageType , ContextPageUIState , DataReadGuard ,
12- Focusable , Id , Item , ItemId , LibraryFocusState , LibraryPageUIState , PageState , PageType ,
13- PlayableId , Playback , PlaylistCreateCurrentField , PlaylistFolderItem , PlaylistId ,
14- PlaylistPopupAction , PopupState , SearchFocusState , SearchPageUIState , SharedState , ShowId ,
15- Track , TrackId , TrackOrder , TracksId , UIStateGuard , USER_LIKED_TRACKS_ID ,
16- USER_RECENTLY_PLAYED_TRACKS_ID , USER_TOP_TRACKS_ID ,
11+ BrowsePageUIState , ConfirmableAction , Context , ContextId , ContextPageType ,
12+ ContextPageUIState , DataReadGuard , Focusable , Id , Item , ItemId , LibraryFocusState ,
13+ LibraryPageUIState , PageState , PageType , PlayableId , Playback , PlaylistCreateCurrentField ,
14+ PlaylistFolderItem , PlaylistId , PlaylistPopupAction , PopupState , SearchFocusState ,
15+ SearchPageUIState , SharedState , ShowId , Track , TrackId , TrackOrder , TracksId , UIStateGuard ,
16+ USER_LIKED_TRACKS_ID , USER_RECENTLY_PLAYED_TRACKS_ID , USER_TOP_TRACKS_ID ,
1717 } ,
1818 ui:: { single_line_input:: LineInput , Orientation } ,
1919 utils:: parse_uri,
@@ -289,12 +289,14 @@ pub fn handle_action_in_context(
289289 ..
290290 } = ui. current_page ( )
291291 {
292- client_pub. send ( ClientRequest :: DeleteTrackFromPlaylist (
293- playlist_id. clone_static ( ) ,
294- track. id ,
295- ) ) ?;
292+ ui. popup = Some ( PopupState :: ConfirmAction {
293+ message : format ! ( "Delete {} from this playlist?" , track. name) ,
294+ action : ConfirmableAction :: DeleteTrackFromPlaylist {
295+ playlist_id : playlist_id. clone_static ( ) ,
296+ track_id : track. id ,
297+ } ,
298+ } ) ;
296299 }
297- ui. popup = None ;
298300 Ok ( true )
299301 }
300302 _ => Ok ( false ) ,
@@ -318,8 +320,10 @@ pub fn handle_action_in_context(
318320 Ok ( true )
319321 }
320322 Action :: DeleteFromLibrary => {
321- client_pub. send ( ClientRequest :: DeleteFromLibrary ( ItemId :: Album ( album. id ) ) ) ?;
322- ui. popup = None ;
323+ ui. popup = Some ( PopupState :: ConfirmAction {
324+ message : format ! ( "Delete {} from your library?" , album. name) ,
325+ action : ConfirmableAction :: DeleteFromLibrary ( ItemId :: Album ( album. id ) ) ,
326+ } ) ;
323327 Ok ( true )
324328 }
325329 Action :: CopyLink => {
@@ -376,10 +380,10 @@ pub fn handle_action_in_context(
376380 Ok ( true )
377381 }
378382 Action :: DeleteFromLibrary => {
379- client_pub . send ( ClientRequest :: DeleteFromLibrary ( ItemId :: Playlist (
380- playlist. id ,
381- ) ) ) ? ;
382- ui . popup = None ;
383+ ui . popup = Some ( PopupState :: ConfirmAction {
384+ message : format ! ( "Delete {} from your library?" , playlist. name ) ,
385+ action : ConfirmableAction :: DeleteFromLibrary ( ItemId :: Playlist ( playlist . id ) ) ,
386+ } ) ;
383387 Ok ( true )
384388 }
385389 _ => Ok ( false ) ,
@@ -397,8 +401,10 @@ pub fn handle_action_in_context(
397401 Ok ( true )
398402 }
399403 Action :: DeleteFromLibrary => {
400- client_pub. send ( ClientRequest :: DeleteFromLibrary ( ItemId :: Show ( show. id ) ) ) ?;
401- ui. popup = None ;
404+ ui. popup = Some ( PopupState :: ConfirmAction {
405+ message : format ! ( "Delete {} from your library?" , show. name) ,
406+ action : ConfirmableAction :: DeleteFromLibrary ( ItemId :: Show ( show. id ) ) ,
407+ } ) ;
402408 Ok ( true )
403409 }
404410 _ => Ok ( false ) ,
0 commit comments