This commit is contained in:
krolxon 2024-05-12 20:18:00 +05:30
parent 3d569cbf79
commit 8c4d19f849
1 changed files with 12 additions and 0 deletions

View File

@ -343,6 +343,18 @@ fn draw_playlist_viewer(frame: &mut Frame, app: &mut App, area: Rect) {
frame.render_stateful_widget(list, layouts[0], &mut state); frame.render_stateful_widget(list, layouts[0], &mut state);
// Playlist viewer // Playlist viewer
// Handle if there are no playlists in the mpd database
if app.pl_list.list.is_empty() {
let title = Block::default()
.title(Title::from("No Playlists Found".red().bold()))
.title_alignment(Alignment::Center)
.borders(Borders::ALL);
frame.render_widget(Clear, area); //this clears out the background
frame.render_widget(title, area);
return;
}
let pl_name = app.pl_list.list.get(app.pl_list.index).unwrap(); let pl_name = app.pl_list.list.get(app.pl_list.index).unwrap();
let songs = app.conn.conn.playlist(pl_name).unwrap(); let songs = app.conn.conn.playlist(pl_name).unwrap();
let rows = songs.iter().map(|song| { let rows = songs.iter().map(|song| {