Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
feat(browse): streamline browse presets to 4 categories and clear modal backdrop
Samir Hossainsc40516542e17
diff --git a/src/tui/app/run.rs b/src/tui/app/run.rsindex cef76a8..9591511 100644--- a/src/tui/app/run.rs+++ b/src/tui/app/run.rs@@ -361,6 +361,7 @@ impl App {.iter().map(|s| s.to_string()).collect();+ crate::tui::clear_area(frame, area, &self.theme);crate::tui::overlay::picker(frame,area,diff --git a/src/tui/app/search.rs b/src/tui/app/search.rsindex 7e99b9e..b2ffe73 100644--- a/src/tui/app/search.rs+++ b/src/tui/app/search.rs@@ -876,7 +876,7 @@ mod tests {]});- let subjects = App::extract_browse_subjects(&payload, BrowsePreset::TrendingDesc);+ let subjects = App::extract_browse_subjects(&payload, BrowsePreset::Trending);assert_eq!(subjects.len(), 1);assert_eq!(subjects[0]["subjectId"], "trending-1");assert_eq!(subjects[0]["__browse_rank"], 1.0);@@ -897,7 +897,7 @@ mod tests {]});- let subjects = App::extract_browse_subjects(&payload, BrowsePreset::PopularDesc);+ let subjects = App::extract_browse_subjects(&payload, BrowsePreset::MostWatched);assert_eq!(subjects.len(), 1);assert_eq!(subjects[0]["subjectId"], "watched-1");assert!(subjects[0].get("__browse_rank").is_none());diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rsindex 61e61a4..830e08c 100644--- a/src/tui/screens/home.rs+++ b/src/tui/screens/home.rs@@ -1064,15 +1064,16 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme).iter().map(|preset| preset.label().to_string()).collect();+ crate::tui::clear_area(frame, area, theme);crate::tui::overlay::picker(frame,area,&items,&mut state.browse_list_state,crate::tui::overlay::PickerSpec {- title: "Browse Movies",+ title: "Browse",confirm_label: "Open",- minimum_width: 42,+ minimum_width: 36,},theme,state.basic_terminal,diff --git a/src/tui/state.rs b/src/tui/state.rsindex efdd70e..eee231a 100644--- a/src/tui/state.rs+++ b/src/tui/state.rs@@ -83,58 +83,40 @@ pub enum BrowseMetric {#[derive(Debug, Clone, Copy, PartialEq, Eq)]pub enum BrowsePreset {- TrendingDesc,- TrendingAsc,- TopRatedAllTimeDesc,- TopRatedAllTimeAsc,- TopRatedRecentDesc,- TopRatedRecentAsc,- PopularDesc,- PopularAsc,+ Trending,+ TopRatedAllTime,+ TopRatedRecent,+ MostWatched,}impl BrowsePreset {- pub const ALL: [Self; 8] = [- Self::TrendingDesc,- Self::TrendingAsc,- Self::TopRatedAllTimeDesc,- Self::TopRatedAllTimeAsc,- Self::TopRatedRecentDesc,- Self::TopRatedRecentAsc,- Self::PopularDesc,- Self::PopularAsc,+ pub const ALL: [Self; 4] = [+ Self::Trending,+ Self::TopRatedAllTime,+ Self::TopRatedRecent,+ Self::MostWatched,];pub fn label(self) -> &'static str {match self {- Self::TrendingDesc => "Trending · High to low",- Self::TrendingAsc => "Trending · Low to high",- Self::TopRatedAllTimeDesc => "Top Rated · All-time · High to low",- Self::TopRatedAllTimeAsc => "Top Rated · All-time · Low to high",- Self::TopRatedRecentDesc => "Top Rated · Recent releases · High to low",- Self::TopRatedRecentAsc => "Top Rated · Recent releases · Low to high",- Self::PopularDesc => "Most Watched · High to low",- Self::PopularAsc => "Most Watched · Low to high",+ Self::Trending => "Trending Now",+ Self::TopRatedAllTime => "Top Rated (All-Time)",+ Self::TopRatedRecent => "Top Rated (Recent Releases)",+ Self::MostWatched => "Most Watched",}}pub fn metric(self) -> BrowseMetric {match self {- Self::TrendingDesc | Self::TrendingAsc => BrowseMetric::Trending,- Self::TopRatedAllTimeDesc | Self::TopRatedAllTimeAsc => BrowseMetric::Rating,- Self::TopRatedRecentDesc | Self::TopRatedRecentAsc => BrowseMetric::RecentRating,- Self::PopularDesc | Self::PopularAsc => BrowseMetric::Popularity,+ Self::Trending => BrowseMetric::Trending,+ Self::TopRatedAllTime => BrowseMetric::Rating,+ Self::TopRatedRecent => BrowseMetric::RecentRating,+ Self::MostWatched => BrowseMetric::Popularity,}}pub fn descending(self) -> bool {- matches!(- self,- Self::TrendingDesc- | Self::TopRatedAllTimeDesc- | Self::TopRatedRecentDesc- | Self::PopularDesc- )+ true}}