mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
don't show "back" option in main page filter
This commit is contained in:
parent
e4fd6fc0f0
commit
a0624c4493
2 changed files with 18 additions and 8 deletions
|
|
@ -7,8 +7,8 @@ use ratatui::text::Text;
|
|||
use ratatui::widgets::{Row, Table};
|
||||
|
||||
pub enum FooterParams<'a> {
|
||||
Normal(UiPage),
|
||||
FilterInput(&'a str),
|
||||
Normal { page: UiPage },
|
||||
FilterInput { page: UiPage, filter: &'a str },
|
||||
}
|
||||
|
||||
pub fn footer<'a>(app: &App<'a>, params: FooterParams<'a>) -> Table<'a> {
|
||||
|
|
@ -17,7 +17,7 @@ pub fn footer<'a>(app: &App<'a>, params: FooterParams<'a>) -> Table<'a> {
|
|||
.fg(tailwind::GREEN.c600);
|
||||
|
||||
match params {
|
||||
FooterParams::Normal(page) => {
|
||||
FooterParams::Normal { page } => {
|
||||
let widths = [
|
||||
Constraint::Percentage(100),
|
||||
Constraint::Min(25),
|
||||
|
|
@ -34,8 +34,8 @@ pub fn footer<'a>(app: &App<'a>, params: FooterParams<'a>) -> Table<'a> {
|
|||
)
|
||||
.style(footer_style)
|
||||
}
|
||||
FooterParams::FilterInput(filter_input) => {
|
||||
let help = "«Esc» Clear - «Left» Back";
|
||||
FooterParams::FilterInput { filter, page } => {
|
||||
let help = filter_help(page);
|
||||
let widths = [
|
||||
Constraint::Min(u16::try_from(help.chars().count()).unwrap()),
|
||||
Constraint::Percentage(100),
|
||||
|
|
@ -44,7 +44,7 @@ pub fn footer<'a>(app: &App<'a>, params: FooterParams<'a>) -> Table<'a> {
|
|||
Table::new(
|
||||
[Row::new([
|
||||
Text::from(help),
|
||||
Text::from(format!("- Filter: {}█", filter_input)),
|
||||
Text::from(format!("- Filter: {}█", filter)),
|
||||
])],
|
||||
widths,
|
||||
)
|
||||
|
|
@ -62,3 +62,10 @@ fn help(page: UiPage) -> &'static str {
|
|||
UiPage::Errors => "«Q» Exit - «Esc» Back - «C» Copy log line",
|
||||
}
|
||||
}
|
||||
|
||||
fn filter_help(page: UiPage) -> &'static str {
|
||||
match page {
|
||||
UiPage::MatchList => "«Esc» Clear",
|
||||
_ => "«Esc» Clear - «Left» Back",
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -466,8 +466,11 @@ impl<'a> UiState<'a> {
|
|||
|
||||
pub fn footer_params(&self) -> FooterParams {
|
||||
match self.mode() {
|
||||
Mode::Normal => FooterParams::Normal(self.page()),
|
||||
Mode::FilterInput => FooterParams::FilterInput(self.filter().unwrap_or_default()),
|
||||
Mode::Normal => FooterParams::Normal { page: self.page() },
|
||||
Mode::FilterInput => FooterParams::FilterInput {
|
||||
filter: self.filter().unwrap_or_default(),
|
||||
page: self.page(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue