diff options
author | Thang Pham <phamducthang1234@gmail.com> | 2021-05-18 23:52:14 +0900 |
---|---|---|
committer | Thang Pham <phamducthang1234@gmail.com> | 2021-05-18 23:52:14 +0900 |
commit | 8e7f589c59ce9f79737562f3439eadee343cfd9b (patch) | |
tree | a7a6fa945f6c865ac4240b42f3f47bbdcf7b3e6d | |
parent | d7f92899ccb06950a99124358e1ed9a64f160543 (diff) |
make status bar show only view name
-rw-r--r-- | src/config.rs | 4 | ||||
-rw-r--r-- | src/hn-tui-default.toml | 2 | ||||
-rw-r--r-- | src/utils.rs | 20 | ||||
-rw-r--r-- | src/view/async_view.rs | 2 |
4 files changed, 3 insertions, 25 deletions
diff --git a/src/config.rs b/src/config.rs index 05903cb..bd26ea6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -13,9 +13,6 @@ pub struct Config { pub scroll_offset: usize, pub url_open_command: String, - #[serde(default)] - pub hide_story_filters_in_status_bar: bool, - pub story_pooling: StoryPooling, pub client: Client, pub theme: Theme, @@ -180,7 +177,6 @@ impl Default for Config { page_scrolling: true, scroll_offset: 3, url_open_command: "xdg-open".to_string(), - hide_story_filters_in_status_bar: false, story_pooling: StoryPooling { enable: true, delay: 2, diff --git a/src/hn-tui-default.toml b/src/hn-tui-default.toml index 8bc6a92..b94e6c5 100644 --- a/src/hn-tui-default.toml +++ b/src/hn-tui-default.toml @@ -10,8 +10,6 @@ scroll_offset = 3 # "url_open_command" is a terminal command used to open url in browser url_open_command = "xdg-open" -hide_story_filters_in_status_bar = false - [story_pooling] # "story_pooling" is a feature that allows the application to fetch stories # in background and store them in cache memory. diff --git a/src/utils.rs b/src/utils.rs index 5dab851..91cde6e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -90,20 +90,9 @@ pub fn get_status_bar_with_desc(desc: &str) -> impl View { } /// Construct StoryView based on the filtering tag -pub fn get_story_view_desc_by_tag( - tag: &str, - by_date: bool, - page: usize, - numeric_filters: &hn_client::StoryNumericFilters, -) -> String { - let story_filters = format!( - "\nsort_by: {}, {}, page: {}", - if by_date { "date" } else { "popularity" }, - numeric_filters.desc(), - page + 1 - ); +pub fn get_story_view_desc_by_tag(tag: &str) -> String { format!( - "Story View - {}{}", + "Story View - {}", match tag { "front_page" => "Front Page", "story" => "All Stories", @@ -112,11 +101,6 @@ pub fn get_story_view_desc_by_tag( "show_hn" => "Show HN", _ => panic!("unknown tag: {}", tag), }, - if !get_config().hide_story_filters_in_status_bar { - story_filters - } else { - "".to_string() - }, ) } diff --git a/src/view/async_view.rs b/src/view/async_view.rs index 46437d3..ab302cc 100644 --- a/src/view/async_view.rs +++ b/src/view/async_view.rs @@ -79,7 +79,7 @@ pub fn get_story_view_async( move |result| { ErrorViewWrapper::new(match result { Ok(stories) => ErrorViewEnum::Ok(story_view::get_story_view( - &get_story_view_desc_by_tag(tag, by_date, page, &numeric_filters), + &get_story_view_desc_by_tag(tag), stories, &client, tag, |