Add feature to like a song from basic view
Add the feature to like a song with the 's' key when you are in the basic view.
-use crate::{app::App, event::Key};
+use crate::{app::App, event::Key, network::IoEvent};
-pub fn handler(_key: Key, _app: &mut App) {}
+pub fn handler(key: Key, app: &mut App) {
+ match key {
+ Key::Char('s') => {
+ if let Some(playing_context) = &app.current_playback_context {
+ if let Some(track) = &playing_context.clone().item {
+ if let Some(id) = &track.id {
+ app.dispatch(IoEvent::ToggleSaveTrack(id.to_string()));
+ }
+ }
+ }
+ }
+ _ => {}
+ };
+}
