ui: volume mute state

This commit is contained in:
krolxon 2024-06-11 23:09:08 +05:30
parent a6fa8add79
commit a63845bae8
1 changed files with 22 additions and 9 deletions

View File

@ -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(match app.conn.volume_status {
VolumeStatus::Unmuted => {
Title::from(format!("Volume: {}%", app.conn.status.volume).green())
.alignment(Alignment::Right),
)
.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(match app.conn.volume_status {
VolumeStatus::Unmuted => {
Title::from(format!("Volume: {}%", app.conn.status.volume).green())
.alignment(Alignment::Right),
)
.alignment(Alignment::Right)
}
VolumeStatus::Muted(_v) => {
Title::from(format!("Muted").red()).alignment(Alignment::Right)
}
})
.borders(Borders::ALL),
)
.highlight_style(