Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
refactor(tui): consolidate theme selection into settings hub and clean modal backdrop
Samir Hossains294908ef624b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c06df8c..59daf99 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,7 +12,7 @@- Enabled 24-bit TrueColor auto-detection by default on Windows 10/11 (`conhost.exe`, Windows Terminal, PowerShell, CMD), ensuring Windows users receive rich Catppuccin themes out of the box.- Overhauled 16-color ANSI dark fallback palette (`Theme::fallback`), replacing low-contrast dark blue and magenta with high-contrast cyan accents for borders, titles, headers, and highlights.- Added background row selection suppression in Settings Hub when modal popups (media player picker, theme picker, download directory input) are active, directing 100% of user focus to floating dialogs.- - Added solid opaque backdrops to `ModalFrame` and clamped popup picker minimum height to 7 rows, eliminating bleed-through and visual crowding on single-item selections.+ - Clamped popup picker minimum height to 7 rows, eliminating visual crowding on single-item selections.- Elevated active selection surface styling to `theme.surface1` with accent-highlighted cursor indicators (`▌ ` / `▸ `) across lists and settings rows.- **In-App Self-Update Engine Hardening**:- Added deterministic fallback download URL generation for GitHub release assets and `SHA256SUMS` when unauthenticated API requests encounter HTTP 403 rate limits.@@ -26,6 +26,9 @@- Scoped `Ctrl+P` strictly to Streaming Mode for provider cycling, eliminating redundant `Ctrl+P` handling in TV and Addon modes.- Streamlined `/config` as a direct alias for `/settings`.++- **Pruned Redundant Theme Slash Command**:+ - Removed standalone `/theme` slash command, parser routing, and auto-suggestions; theme selection and visual palette swatches are managed directly within the interactive Settings Hub (`/settings` $\to$ Appearance $\to$ Theme).- **Discover Categories Landing Card UX**:- Streamlined `Discover & Quick Categories` card: elevated `/browse` command to a right-aligned header badge (`[ /browse ]`), eliminated redundant `/browse ·` row prefixes, and adapted category rows dynamically between Streaming and Addon modes.- Added direct mouse click navigation to discover categories, routing clicks to preset browse queries or the addon catalog menu.@@ -62,6 +65,7 @@- Added compact button formatting (`[u] Update [o] Web [Esc] Back`) to Update Modal on terminals under 60 columns.- Added compact header formatting to Updating progress modal when inner width is under 42 columns.- Added title boundary protection to `ModalFrame`, truncating overly long titles to preserve border integrity.+ - Eliminated dark rectangular halo artifact around modal popups by removing block-level background color overrides from `ModalFrame`, allowing rounded borders to cleanly render against transparent and custom terminal backgrounds without pixel spillage.- **Resilient Configuration & Accurate Metadata**:- Safeguarded user TV playlists (`tv_config.json`) and HTTP addons (`addons_config.json`): replaced destructive error-swallowing deletion with timestamped `.corrupt.{timestamp}` file rotation and sanitized logging on JSON parse failures.- Eliminated fabricated S01E01 fallback in addon metadata adapter, accurately reporting empty series episodes when an upstream catalog entry lacks episode records instead of injecting unplayable dummy data.diff --git a/docs/controls.md b/docs/controls.mdindex 529ab9e..5cdbd36 100644--- a/docs/controls.md+++ b/docs/controls.md@@ -45,7 +45,7 @@ Text editing across Search, TV Playlist Manager, and Addon Manager uses a unifieAll popup dialogs (Theme picker, Browse categories, Settings Media Player picker, TV Manager, Addon Manager, Download Confirmation) support standard keyboard controls:-- **`↑` / `↓` / `k` / `j`**: Move selection up / down by one item (vim keys `k`/`j` supported in pickers such as `/theme`).+- **`↑` / `↓` / `k` / `j`**: Move selection up / down by one item (vim keys `k`/`j` supported in pickers such as theme selector in Settings).- **`Home` / `End`**: Jump immediately to the first or last item in the list.- **`PageUp` / `PageDown`**: Step up or down by 5 items.- **`Enter`**: Confirm selection, activate entry, or submit dialog.@@ -107,7 +107,6 @@ Type these commands directly into the search bar:| `/browse` | Streaming / Addon | Browse curated views (Trending, Popular) or Addon catalogs (Top Movies, Top Series) || `/history` | Streaming / Addon | View watch history with latest progress || `/favorites` | Streaming / Addon | View all starred titles |-| `/theme` | All | Open visual theme palette swatch picker || `/clear` | All | Clear search results and return to landing || `/help` | All | Open interactive keybinding help menu (alias `/?`) || `/list` | TV | View live TV channels |diff --git a/docs/tv-mode.md b/docs/tv-mode.mdindex 254a19c..6066765 100644--- a/docs/tv-mode.md+++ b/docs/tv-mode.md@@ -40,5 +40,5 @@ namespace.- `/list` — display all loaded TV channels.- `[r]` key — reload all active M3U playlist sources.-- Global commands (`/settings`, `/theme`, `/clear`, `/help`, `/exit`) are active across all modes.+- Global commands (`/settings`, `/clear`, `/help`, `/exit`) are active across all modes.- Streaming/Addon-only commands (e.g. `/browse`, `/history`, `/favorites`) display friendly guidance notifications prompting you to switch modes (`Ctrl+S` or `Ctrl+A`).diff --git a/src/tui/app/search.rs b/src/tui/app/search.rsindex f9c91cf..3b60d12 100644--- a/src/tui/app/search.rs+++ b/src/tui/app/search.rs@@ -141,10 +141,6 @@ impl App {self.action_sender.send(Action::ToggleHelp).ok();Some(true)}- crate::tui::commands::SlashCommand::Theme => {- self.action_sender.send(Action::ToggleThemePopup).ok();- Some(true)- }crate::tui::commands::SlashCommand::Browse => {if current_mode == crate::tui::state::AppMode::Tv {self.state.notify(diff --git a/src/tui/commands.rs b/src/tui/commands.rsindex 5ec6d8e..291153b 100644--- a/src/tui/commands.rs+++ b/src/tui/commands.rs@@ -6,7 +6,6 @@ pub enum SlashCommand {Browse,History,Favorites,- Theme,Clear,Help,List,@@ -14,24 +13,22 @@ pub enum SlashCommand {}impl SlashCommand {- pub const ALL: [Self; 9] = [+ pub const ALL: [Self; 8] = [Self::Settings,Self::Browse,Self::History,Self::Favorites,- Self::Theme,Self::Clear,Self::Help,Self::List,Self::Exit,];- pub const PRIMARY: [Self; 7] = [+ pub const PRIMARY: [Self; 6] = [Self::Settings,Self::Browse,Self::History,Self::Favorites,- Self::Theme,Self::Clear,Self::Help,];@@ -42,7 +39,6 @@ impl SlashCommand {Self::Browse => "/browse",Self::History => "/history",Self::Favorites => "/favorites",- Self::Theme => "/theme",Self::Clear => "/clear",Self::Help => "/help",Self::List => "/list",@@ -56,7 +52,6 @@ impl SlashCommand {Self::Browse => "Curated, rated & most-watched views",Self::History => "Watch history",Self::Favorites => "Starred titles",- Self::Theme => "Theme picker",Self::Clear => "Clear search results and return to landing",Self::Help => "Open interactive keybinding help menu",Self::List => "Show all TV channels",@@ -77,7 +72,7 @@ impl SlashCommand {}Self::Favorites => state.favorites_available(),Self::List => state.tv_enabled && state.is_tv_mode,- Self::Theme | Self::Clear | Self::Help | Self::Exit => true,+ Self::Clear | Self::Help | Self::Exit => true,}}@@ -85,12 +80,11 @@ impl SlashCommand {let lower = query.to_ascii_lowercase();let mut results = Vec::new();- let candidates: [(&str, Self); 8] = [+ let candidates: [(&str, Self); 7] = [("/settings", Self::Settings),("/browse", Self::Browse),("/history", Self::History),("/favorites", Self::Favorites),- ("/theme", Self::Theme),("/clear", Self::Clear),("/help", Self::Help),("/list", Self::List),@@ -131,7 +125,6 @@ impl SlashCommand {"/browse" => Some(Self::Browse.description(state)),"/history" => Some(Self::History.description(state)),"/favorites" => Some(Self::Favorites.description(state)),- "/theme" => Some(Self::Theme.description(state)),"/clear" => Some(Self::Clear.description(state)),"/help" => Some(Self::Help.description(state)),"/list" => Some(Self::List.description(state)),@@ -154,7 +147,6 @@ impl SlashCommand {"/browse" => Some(Self::Browse),"/history" => Some(Self::History),"/favorites" => Some(Self::Favorites),- "/theme" => Some(Self::Theme),"/clear" => Some(Self::Clear),"/help" | "/?" => Some(Self::Help),"/list" => Some(Self::List),@@ -179,7 +171,6 @@ mod tests {"/browse".to_string(),"/history".to_string(),"/favorites".to_string(),- "/theme".to_string(),"/clear".to_string(),"/help".to_string(),]@@ -191,6 +182,8 @@ mod tests {let c_sug = SlashCommand::suggest(&state, "/c");assert_eq!(c_sug, vec!["/clear".to_string()]);+ let t_sug = SlashCommand::suggest(&state, "/t");+ assert!(t_sug.is_empty());let p_sug = SlashCommand::suggest(&state, "/p");assert!(p_sug.is_empty());@@ -229,8 +222,8 @@ mod tests {#[test]fn test_core_commands_and_aliases_parse() {let state = AppState::default();- assert_eq!(SlashCommand::ALL.len(), 9);- assert_eq!(SlashCommand::PRIMARY.len(), 7);+ assert_eq!(SlashCommand::ALL.len(), 8);+ assert_eq!(SlashCommand::PRIMARY.len(), 6);assert_eq!(SlashCommand::parse("/exit"), Some(SlashCommand::Exit));assert_eq!(SlashCommand::parse("/quit"), Some(SlashCommand::Exit));assert_eq!(SlashCommand::parse("/q"), Some(SlashCommand::Exit));@@ -264,6 +257,8 @@ mod tests {assert_eq!(SlashCommand::parse("/list"), Some(SlashCommand::List));assert_eq!(SlashCommand::parse("/browse"), Some(SlashCommand::Browse));assert_eq!(SlashCommand::parse("/history"), Some(SlashCommand::History));+ assert_eq!(SlashCommand::parse("/theme"), None);+ assert_eq!(SlashCommand::parse("/themes"), None);assert_eq!(SlashCommand::parse("/toggle-tv"), None);assert_eq!(SlashCommand::parse("/enable-tv"), None);assert_eq!(SlashCommand::parse("/disable-tv"), None);@@ -301,5 +296,6 @@ mod tests {);assert_eq!(SlashCommand::description_for("/download-dir", &state), None);assert_eq!(SlashCommand::description_for("/toggle-tv", &state), None);+ assert_eq!(SlashCommand::description_for("/theme", &state), None);}}diff --git a/src/tui/screens/help.rs b/src/tui/screens/help.rsindex a36729f..8a7d4b3 100644--- a/src/tui/screens/help.rs+++ b/src/tui/screens/help.rs@@ -93,7 +93,7 @@ pub fn build_help_columns(right.push(Line::from(""));right.push(help_section_header("Commands & Shortcuts", theme));- right.push(help_row("/settings", "Preferences & Modes", theme));+ right.push(help_row("/settings", "Preferences, Themes & Modes", theme));if state.is_tv_mode {right.push(help_row("/list", "Show All TV Channels", theme));} else if state.is_addon_mode {@@ -109,7 +109,6 @@ pub fn build_help_columns());right.push(help_row("/favorites", "Starred Titles", theme));}- right.push(help_row("/theme", "Visual Theme Swatches", theme));right.push(help_row("/clear", "Clear Search Results", theme));right.push(help_row("/exit", "Exit App ([q] / Ctrl+C)", theme));right.push(help_row("[?]", "Toggle This Help Menu", theme));diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rsindex 98b22a8..bf2fd37 100644--- a/src/tui/screens/home.rs+++ b/src/tui/screens/home.rs@@ -800,11 +800,10 @@ pub(crate) fn dynamic_search_placeholder(state: &AppState) -> &'static str {const STREAMING_HINTS: &[&str] = &["Search movies, series & anime…","Try 'Interstellar', 'Dune', 'Breaking Bad'…",- "Type /settings for preferences & players…",+ "Type /settings for preferences & themes…","Type /browse for trending & top rated…","Type /history to resume your watch list…","Type /favorites for starred media…",- "Type /theme to switch color palettes…","Type /help for interactive keybindings…",];let idx = ((state.tick_count / 40) as usize) % STREAMING_HINTS.len();@@ -2914,7 +2913,7 @@ mod tests {state.tick_count = 80;assert_eq!(dynamic_search_placeholder(&state),- "Type /settings for preferences & players…"+ "Type /settings for preferences & themes…");state.tick_count = 120;assert_eq!(@@ -2932,16 +2931,11 @@ mod tests {"Type /favorites for starred media…");state.tick_count = 240;- assert_eq!(- dynamic_search_placeholder(&state),- "Type /theme to switch color palettes…"- );- state.tick_count = 280;assert_eq!(dynamic_search_placeholder(&state),"Type /help for interactive keybindings…");- state.tick_count = 320;+ state.tick_count = 280;assert_eq!(dynamic_search_placeholder(&state),"Search movies, series & anime…"diff --git a/src/tui/widgets/modal.rs b/src/tui/widgets/modal.rsindex 41aa1ab..1ef7790 100644--- a/src/tui/widgets/modal.rs+++ b/src/tui/widgets/modal.rs@@ -32,11 +32,6 @@ impl<'a> ModalFrame<'a> {pub fn render(&self, frame: &mut Frame, area: Rect, full_area: Rect) -> Rect {overlay::clear_modal_area(frame, full_area, area, self.theme);- let block_style = if self.basic_terminal {- Style::default()- } else {- Style::default().bg(self.theme.mantle.fg.unwrap_or(self.theme.base))- };let title_budget = (area.width as usize).saturating_sub(4);let display_title = crate::tui::text::truncate_width(self.title.trim(), title_budget);let block = Block::default()@@ -44,14 +39,12 @@ impl<'a> ModalFrame<'a> {.title_style(self.theme.title).borders(Borders::ALL).border_type(overlay::border_type(self.basic_terminal))- .border_style(self.border_style.unwrap_or(self.theme.lavender))- .style(block_style);+ .border_style(self.border_style.unwrap_or(self.theme.lavender));let inner = block.inner(area);frame.render_widget(block, area);inner}}-pub fn render_modal_footer(frame: &mut Frame,area: Rect,diff --git a/tests/settings_hub.rs b/tests/settings_hub.rsindex 5c5443e..d8c7d88 100644--- a/tests/settings_hub.rs+++ b/tests/settings_hub.rs@@ -32,6 +32,8 @@ fn test_settings_command_parsing_and_aliases() {Some(SlashCommand::Settings));assert_eq!(SlashCommand::parse("/config"), Some(SlashCommand::Settings));+ assert_eq!(SlashCommand::parse("/theme"), None);+ assert_eq!(SlashCommand::parse("/themes"), None);assert_eq!(SlashCommand::parse("/help"), Some(SlashCommand::Help));assert_eq!(SlashCommand::parse("/?"), Some(SlashCommand::Help));@@ -43,7 +45,6 @@ fn test_settings_command_parsing_and_aliases() {"/browse".to_string(),"/history".to_string(),"/favorites".to_string(),- "/theme".to_string(),"/clear".to_string(),"/help".to_string(),]@@ -60,6 +61,7 @@ fn test_settings_command_parsing_and_aliases() {let toggle_suggestions = SlashCommand::suggest(&state, "/toggle");assert!(toggle_suggestions.is_empty());+ assert!(SlashCommand::suggest(&state, "/t").is_empty());}#[test]@@ -262,6 +264,7 @@ async fn test_settings_appearance_theme_cycle_and_popup() {let mut app = App::new();app.handle_action(Action::ShowSettingsPopup).await;assert!(app.state().show_settings_popup);+ app.state_mut().poster_mode = "auto".to_string();app.handle_action(Action::SelectSettingsCategory(SettingsCategory::Appearance)).await;