Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
fix(tui): dim resolution badges and unselected list items during active modal dialogs
Samir Hossains88fc702bdd29
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f7ef9f8..048d31d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -47,6 +47,8 @@### Fixed- **Global Modal Background Unfocus & Dimming**:- Automatically unfocused and dimmed all background components across Details, Home, and Runner views whenever any modal or popup dialog is active, replacing bright active borders, focus bullets, and selection highlight rectangles with dimmed styling (`theme.muted`).+ - Dimmed background resolution badges (`Multi`, `4K`, `1080p`, etc.) and provider origin tags to muted styling (`theme.muted` on surface backgrounds) during active modal popups, preventing neon badge colors from competing with foreground dialogs.+ - Dimmed unselected list items across Audio dubs, Seasons, Episodes, and Search Results to `theme.muted`, eliminating bright white text bleeds in the background.- Dimmed background footer shortcuts and download bar elements during open dialogs, ensuring visual focus remains strictly on the active foreground popup.- Suppressed terminal graphics protocol rendering for background posters when a modal dialog is open, preventing image pixels from bleeding over foreground confirmation dialogs.- **MovieBox DASH Progress Normalization, Throttling & Background Continuity**:diff --git a/src/tui/screens/details.rs b/src/tui/screens/details.rsindex 09faa01..dc2bce8 100644--- a/src/tui/screens/details.rs+++ b/src/tui/screens/details.rs@@ -810,7 +810,12 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let mut lang_items = Vec::new();for dub in &details.dubs {let name = clean_language_name(&dub.language);- lang_items.push(ListItem::new(name).style(theme.text));+ let item_style = if modal_active {+ theme.muted+ } else {+ theme.text+ };+ lang_items.push(ListItem::new(name).style(item_style));}let language_count = lang_items.len();@@ -857,7 +862,14 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let seasons_items: Vec<ListItem> = state.available_seasons.iter()- .map(|s| ListItem::new(format!("Season {}", s.number)).style(theme.text))+ .map(|s| {+ let item_style = if modal_active {+ theme.muted+ } else {+ theme.text+ };+ ListItem::new(format!("Season {}", s.number)).style(item_style)+ }).collect();let seasons_focused =@@ -939,7 +951,9 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)} else {format!("EP {ep:02}")};- if let Some(hist) =+ if modal_active {+ ListItem::new(format!("{unwatched_sym}{ep_base}")).style(theme.muted)+ } else if let Some(hist) =state.history.get_item(provider, subject_id, se_num, ep, Some(&title))@@ -1135,6 +1149,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)resolution,theme,state.basic_terminal,+ modal_active,));stream_spans.push(Span::styled(@@ -1760,7 +1775,11 @@ fn render_workflow(} else {" › "},- theme.overlay0,+ if modal_active {+ theme.muted+ } else {+ theme.overlay0+ },));}if *pane == state.details_pane && !modal_active {@@ -2921,12 +2940,36 @@ mod tests {duration: None,genres: vec![],seasons: vec![],- dubs: vec![],+ dubs: vec![+ AudioTrackOption {+ subject_id: "sample".to_string(),+ language: "Original".to_string(),+ label: "Original".to_string(),+ },+ AudioTrackOption {+ subject_id: "sample-hi".to_string(),+ language: "Hindi".to_string(),+ label: "Hindi".to_string(),+ },+ ],}),+ selected_resources: vec![Release {+ provider: ProviderKind::MovieBox,+ filename: "Sample Stream Multi-Res hevc".to_string(),+ quality: Some("Multi".to_string()),+ codec: Some("HEVC".to_string()),+ language: None,+ size_bytes: Some(1_600_000_000),+ season: None,+ episode: None,+ mirrors: vec![],+ resource_id: Some("res-1".to_string()),+ }],details_pane: crate::tui::state::DetailsPane::Streams,show_episode_download_confirm: true,..Default::default()};+ state.language_list_state.select(Some(0));let theme = Theme::mocha();terminal@@ -2944,5 +2987,31 @@ mod tests {assert!(content.contains("Confirm Episode Download"));assert!(!content.contains("● Streams"));+ assert!(content.contains("Multi"));+ assert!(content.contains("Hindi"));++ for y in 0..30 {+ for x in 0..120 {+ let cell = &buffer[(x, y)];+ if x < 20+ && cell.symbol() == "M"+ && x + 4 < 120+ && buffer[(x + 1, y)].symbol() == "u"+ {+ assert_eq!(+ cell.style().fg,+ theme.muted.fg,+ "Multi badge foreground should be muted"+ );+ }+ if cell.symbol() == "H" && x + 4 < 120 && buffer[(x + 1, y)].symbol() == "i" {+ assert_eq!(+ cell.style().fg,+ theme.muted.fg,+ "Hindi text foreground should be muted"+ );+ }+ }+ }}}diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rsindex 11bbb50..96701e0 100644--- a/src/tui/screens/home.rs+++ b/src/tui/screens/home.rs@@ -1031,7 +1031,7 @@ fn render_search_bar(format!("[{label} {sep} {ctrl_p}]")}};- (text, theme.text_dim)+ (text, theme.muted)} else if !is_query_empty {if is_ultra_compact {("[Enter]".to_string(), theme.accent)@@ -1782,7 +1782,9 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme).split(text_area)};- let title_style = if is_selected {+ let title_style = if modal_active {+ theme.muted+ } else if is_selected {if is_editing {theme.text} else {@@ -1827,6 +1829,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)r,theme,state.basic_terminal,+ modal_active,)});let badge_width = badge_spans.as_ref().map_or(0, |spans| {@@ -1848,7 +1851,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)if is_favorited {row1_spans.push(ratatui::text::Span::styled(if state.basic_terminal { "* " } else { "★ " },- theme.rating,+ if modal_active {+ theme.muted+ } else {+ theme.rating+ },));}row1_spans.push(ratatui::text::Span::styled(@@ -1958,6 +1965,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)res.provider,theme,state.basic_terminal,+ modal_active,));} else {let matching_meta = state@@ -1997,18 +2005,47 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)}let has_year = res.release_year != "Unknown" && !res.release_year.is_empty();if has_year {- row2_spans.push(ratatui::text::Span::styled(&res.release_year, theme.text));- row2_spans.push(ratatui::text::Span::styled(" • ", theme.text_dim));+ row2_spans.push(ratatui::text::Span::styled(+ &res.release_year,+ if modal_active {+ theme.muted+ } else {+ theme.text+ },+ ));+ row2_spans.push(ratatui::text::Span::styled(+ " • ",+ if modal_active {+ theme.muted+ } else {+ theme.text_dim+ },+ ));}if text_area.width >= 36 || !has_year {- row2_spans.push(ratatui::text::Span::styled(&type_tag, theme.text));- row2_spans.push(ratatui::text::Span::styled(" • ", theme.text_dim));+ row2_spans.push(ratatui::text::Span::styled(+ &type_tag,+ if modal_active {+ theme.muted+ } else {+ theme.text+ },+ ));+ row2_spans.push(ratatui::text::Span::styled(+ " • ",+ if modal_active {+ theme.muted+ } else {+ theme.text_dim+ },+ ));}row2_spans.push(crate::tui::widgets::badge::provider_badge_span(res.provider,theme,state.basic_terminal,+ modal_active,));}diff --git a/src/tui/widgets/badge.rs b/src/tui/widgets/badge.rsindex 2e543e3..c0aa00c 100644--- a/src/tui/widgets/badge.rs+++ b/src/tui/widgets/badge.rs@@ -23,7 +23,44 @@ pub fn resolution_badge_spans<'a>(resolution: i64,theme: &'a Theme,basic_terminal: bool,+ modal_active: bool,) -> Vec<Span<'a>> {+ if modal_active {+ if basic_terminal {+ let label = match resolution {+ -1 => "[Multi]",+ 2160 | 4320 => "[4K]",+ 1080 => "[1080p]",+ 720 => "[720p]",+ 480 | 540 | 576 => "[480p]",+ 360 => "[360p]",+ _ if resolution > 0 => "[HD]",+ _ => "[SD]",+ };+ return vec![+ Span::styled(format!("{:<7}", label), theme.muted),+ Span::raw(" "),+ ];+ }++ let label = match resolution {+ -1 => " Multi ",+ 2160 | 4320 => " 4K ",+ 1080 => " 1080p ",+ 720 => " 720p ",+ 480 | 540 | 576 => " 480p ",+ 360 => " 360p ",+ _ if resolution > 0 => " HD ",+ _ => " SD ",+ };+ let badge_bg = theme_color(theme.surface0, theme.base);+ let contrast_fg = theme_color(theme.muted, Color::DarkGray);+ return vec![+ Span::styled(label, Style::default().bg(badge_bg).fg(contrast_fg)),+ Span::raw(" "),+ ];+ }+if basic_terminal {let (label, style) = match resolution {-1 => ("[Multi]", theme.lavender.add_modifier(Modifier::BOLD)),@@ -123,9 +160,12 @@ pub fn provider_badge_span<'a>(provider: ProviderKind,theme: &'a Theme,basic_terminal: bool,+ modal_active: bool,) -> Span<'a> {let tag = provider_origin_tag(provider);- if basic_terminal {+ if modal_active {+ Span::styled(tag, theme.muted)+ } else if basic_terminal {Span::styled(tag, theme.text_dim)} else {let style = match provider {@@ -347,25 +387,30 @@ mod tests {#[test]fn test_resolution_badge_spans() {let theme = Theme::default();- let spans_4k = resolution_badge_spans(2160, &theme, false);+ let spans_4k = resolution_badge_spans(2160, &theme, false, false);assert_eq!(spans_4k[0].content, " 4K ");- let spans_1080 = resolution_badge_spans(1080, &theme, false);+ let spans_1080 = resolution_badge_spans(1080, &theme, false, false);assert_eq!(spans_1080[0].content, " 1080p ");- let spans_720 = resolution_badge_spans(720, &theme, false);+ let spans_720 = resolution_badge_spans(720, &theme, false, false);assert_eq!(spans_720[0].content, " 720p ");- let spans_sd = resolution_badge_spans(480, &theme, false);+ let spans_sd = resolution_badge_spans(480, &theme, false, false);assert_eq!(spans_sd[0].content, " 480p ");- let spans_multi = resolution_badge_spans(-1, &theme, false);+ let spans_multi = resolution_badge_spans(-1, &theme, false, false);assert_eq!(spans_multi[0].content, " Multi ");- let basic_4k = resolution_badge_spans(2160, &theme, true);+ let basic_4k = resolution_badge_spans(2160, &theme, true, false);assert_eq!(basic_4k[0].content.trim(), "[4K]");- let basic_multi = resolution_badge_spans(-1, &theme, true);+ let basic_multi = resolution_badge_spans(-1, &theme, true, false);assert_eq!(basic_multi[0].content.trim(), "[Multi]");++ let muted_multi = resolution_badge_spans(-1, &theme, false, true);+ assert_eq!(muted_multi[0].style.fg, theme.muted.fg);+ let muted_basic = resolution_badge_spans(-1, &theme, true, true);+ assert_eq!(muted_basic[0].style.fg, theme.muted.fg);}#[test]