mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +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};
|
use ratatui::widgets::{Row, Table};
|
||||||
|
|
||||||
pub enum FooterParams<'a> {
|
pub enum FooterParams<'a> {
|
||||||
Normal(UiPage),
|
Normal { page: UiPage },
|
||||||
FilterInput(&'a str),
|
FilterInput { page: UiPage, filter: &'a str },
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn footer<'a>(app: &App<'a>, params: FooterParams<'a>) -> Table<'a> {
|
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);
|
.fg(tailwind::GREEN.c600);
|
||||||
|
|
||||||
match params {
|
match params {
|
||||||
FooterParams::Normal(page) => {
|
FooterParams::Normal { page } => {
|
||||||
let widths = [
|
let widths = [
|
||||||
Constraint::Percentage(100),
|
Constraint::Percentage(100),
|
||||||
Constraint::Min(25),
|
Constraint::Min(25),
|
||||||
|
|
@ -34,8 +34,8 @@ pub fn footer<'a>(app: &App<'a>, params: FooterParams<'a>) -> Table<'a> {
|
||||||
)
|
)
|
||||||
.style(footer_style)
|
.style(footer_style)
|
||||||
}
|
}
|
||||||
FooterParams::FilterInput(filter_input) => {
|
FooterParams::FilterInput { filter, page } => {
|
||||||
let help = "«Esc» Clear - «Left» Back";
|
let help = filter_help(page);
|
||||||
let widths = [
|
let widths = [
|
||||||
Constraint::Min(u16::try_from(help.chars().count()).unwrap()),
|
Constraint::Min(u16::try_from(help.chars().count()).unwrap()),
|
||||||
Constraint::Percentage(100),
|
Constraint::Percentage(100),
|
||||||
|
|
@ -44,7 +44,7 @@ pub fn footer<'a>(app: &App<'a>, params: FooterParams<'a>) -> Table<'a> {
|
||||||
Table::new(
|
Table::new(
|
||||||
[Row::new([
|
[Row::new([
|
||||||
Text::from(help),
|
Text::from(help),
|
||||||
Text::from(format!("- Filter: {}█", filter_input)),
|
Text::from(format!("- Filter: {}█", filter)),
|
||||||
])],
|
])],
|
||||||
widths,
|
widths,
|
||||||
)
|
)
|
||||||
|
|
@ -62,3 +62,10 @@ fn help(page: UiPage) -> &'static str {
|
||||||
UiPage::Errors => "«Q» Exit - «Esc» Back - «C» Copy log line",
|
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 {
|
pub fn footer_params(&self) -> FooterParams {
|
||||||
match self.mode() {
|
match self.mode() {
|
||||||
Mode::Normal => FooterParams::Normal(self.page()),
|
Mode::Normal => FooterParams::Normal { page: self.page() },
|
||||||
Mode::FilterInput => FooterParams::FilterInput(self.filter().unwrap_or_default()),
|
Mode::FilterInput => FooterParams::FilterInput {
|
||||||
|
filter: self.filter().unwrap_or_default(),
|
||||||
|
page: self.page(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue