diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-06-11 23:09:08 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-06-11 23:09:08 +0530 |
| commit | a63845bae8dec8499237c67d9136f89632565bbe (patch) | |
| tree | 0f2c3886d8ab048497dba944de490422e71903a4 /src/ui.rs | |
| parent | a6fa8add79f4d67ef1d4cb904eb0c0166c96b107 (diff) | |
ui: volume mute state
Diffstat (limited to 'src/ui.rs')
| -rwxr-xr-x | src/ui.rs | 31 |
1 files changed, 22 insertions, 9 deletions
@@ -1,6 +1,9 @@ use std::time::Duration; -use crate::app::{App, SelectedTab}; +use crate::{ + app::{App, SelectedTab}, + connection::VolumeStatus, +}; use ratatui::{ prelude::*, widgets::{block::Title, *}, @@ -124,10 +127,15 @@ fn draw_directory_browser(frame: &mut Frame, app: &mut App, size: Rect) { Title::from(format!("Total Songs: {}", total_songs).green()) .alignment(Alignment::Center), ) - .title( - Title::from(format!("Volume: {}%", app.conn.status.volume).green()) - .alignment(Alignment::Right), - ) + .title(match app.conn.volume_status { + VolumeStatus::Unmuted => { + Title::from(format!("Volume: {}%", app.conn.status.volume).green()) + .alignment(Alignment::Right) + } + VolumeStatus::Muted(_v) => { + Title::from(format!("Muted").red()).alignment(Alignment::Right) + } + }) .borders(Borders::ALL), ) .highlight_style( @@ -217,10 +225,15 @@ fn draw_queue(frame: &mut Frame, app: &mut App, size: Rect) { .title(Title::from( format!("({} items)", app.queue_list.list.len()).bold(), )) - .title( - Title::from(format!("Volume: {}%", app.conn.status.volume).green()) - .alignment(Alignment::Right), - ) + .title(match app.conn.volume_status { + VolumeStatus::Unmuted => { + Title::from(format!("Volume: {}%", app.conn.status.volume).green()) + .alignment(Alignment::Right) + } + VolumeStatus::Muted(_v) => { + Title::from(format!("Muted").red()).alignment(Alignment::Right) + } + }) .borders(Borders::ALL), ) .highlight_style( |
