Add add command for adding song to playlist (#1232)

* Add command for adding song to playlist

* edits for code style

* Return playlist dialog via `CommandResult::Modal`

---------

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
Flynn Duniho
2023-07-22 07:03:21 -07:00
committed by GitHub
parent 92cd4f1c8b
commit 924296ac52
3 changed files with 47 additions and 0 deletions

View File

@@ -272,6 +272,19 @@ impl CommandManager {
self.spotify.shutdown();
Ok(None)
}
Command::AddCurrent => {
if let Some(track) = self.queue.get_current() {
if let Some(track) = track.track() {
let dialog = ContextMenu::add_track_dialog(
self.library.clone(),
self.queue.get_spotify(),
track,
);
s.add_layer(dialog);
}
}
Ok(None)
}
Command::SaveCurrent => {
if let Some(mut track) = self.queue.get_current() {
track.save(&self.library);
@@ -284,6 +297,7 @@ impl CommandManager {
| Command::Play
| Command::Save
| Command::SaveQueue
| Command::Add
| Command::Delete
| Command::Focus(_)
| Command::Back