rmptuia459eec
ui: volume mute state
+22 −9
1 file changed
- M src/ui.rs +22 −9
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | use std::time::Duration; | |
| 2 | 2 | ||
| 3 | − | use crate::app::{App, SelectedTab}; | |
| 3 | + | use crate::{ | |
| 4 | + | app::{App, SelectedTab}, | |
| 5 | + | connection::VolumeStatus, | |
| 6 | + | }; | |
| 4 | 7 | use ratatui::{ | |
| 5 | 8 | prelude::*, | |
| 6 | 9 | widgets::{block::Title, *}, | |
| @@ -124,10 +127,15 @@ fn draw_directory_browser(frame: &mut Frame, app: &mut App, size: Rect) { | |||
| 124 | 127 | Title::from(format!("Total Songs: {}", total_songs).green()) | |
| 125 | 128 | .alignment(Alignment::Center), | |
| 126 | 129 | ) | |
| 127 | − | .title( | |
| 128 | − | Title::from(format!("Volume: {}%", app.conn.status.volume).green()) | |
| 129 | − | .alignment(Alignment::Right), | |
| 130 | − | ) | |
| 130 | + | .title(match app.conn.volume_status { | |
| 131 | + | VolumeStatus::Unmuted => { | |
| 132 | + | Title::from(format!("Volume: {}%", app.conn.status.volume).green()) | |
| 133 | + | .alignment(Alignment::Right) | |
| 134 | + | } | |
| 135 | + | VolumeStatus::Muted(_v) => { | |
| 136 | + | Title::from(format!("Muted").red()).alignment(Alignment::Right) | |
| 137 | + | } | |
| 138 | + | }) | |
| 131 | 139 | .borders(Borders::ALL), | |
| 132 | 140 | ) | |
| 133 | 141 | .highlight_style( | |
| @@ -217,10 +225,15 @@ fn draw_queue(frame: &mut Frame, app: &mut App, size: Rect) { | |||
| 217 | 225 | .title(Title::from( | |
| 218 | 226 | format!("({} items)", app.queue_list.list.len()).bold(), | |
| 219 | 227 | )) | |
| 220 | − | .title( | |
| 221 | − | Title::from(format!("Volume: {}%", app.conn.status.volume).green()) | |
| 222 | − | .alignment(Alignment::Right), | |
| 223 | − | ) | |
| 228 | + | .title(match app.conn.volume_status { | |
| 229 | + | VolumeStatus::Unmuted => { | |
| 230 | + | Title::from(format!("Volume: {}%", app.conn.status.volume).green()) | |
| 231 | + | .alignment(Alignment::Right) | |
| 232 | + | } | |
| 233 | + | VolumeStatus::Muted(_v) => { | |
| 234 | + | Title::from(format!("Muted").red()).alignment(Alignment::Right) | |
| 235 | + | } | |
| 236 | + | }) | |
| 224 | 237 | .borders(Borders::ALL), | |
| 225 | 238 | ) | |
| 226 | 239 | .highlight_style( | |