Skip to content

Commit

Permalink
feat: Update keymappings, update ui help texts
Browse files Browse the repository at this point in the history
  • Loading branch information
hackinghieser committed Jan 10, 2025
1 parent 28f66a7 commit 77b08aa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
32 changes: 19 additions & 13 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub fn render(app: &mut App, f: &mut Frame) {
let date_time = DateTime::parse_from_rfc3339(
line.time.clone().unwrap_or_default().as_ref(),
);

let row = Row::new(vec![
format!(
"[{}] {}",
Expand Down Expand Up @@ -148,20 +149,25 @@ pub fn render(app: &mut App, f: &mut Frame) {
let empty_log_paragraph = Paragraph::new(String::from("Nothing to show..."))
.style(Style::new().fg(Color::Gray));
f.render_widget(empty_log_paragraph, main[1]);
}
let stats = Block::default()
.borders(Borders::ALL)
.title_top(Line::from("Detail"))
.border_type(ratatui::widgets::BorderType::Rounded)
.title("Quit:'Q' Filter:'F")
.title_position(ratatui::widgets::block::Position::Bottom)
.title_style(Style::default().add_modifier(Modifier::BOLD))
.title_alignment(ratatui::layout::Alignment::Left)
.title_style(Style::default().fg(ratatui::style::Color::White))
.border_style(Style::default().fg(ratatui::style::Color::White))
.style(Style::default());
let date_time = DateTime::parse_from_rfc3339(&detail.timestap.clone());

f.render_widget(stats, main[1]);
let stats = Block::default()
.borders(Borders::ALL)
.title_top(Line::from(format!(
"{} | {}",
detail.level,
date_time.unwrap().format("%Y/%m/%d %H:%M:%S")
)))
.border_type(ratatui::widgets::BorderType::Rounded)
.title("Move:'↓↑/jk' Quit:'q' Filter:'f' Jump:'Tap' ")
.title_position(ratatui::widgets::block::Position::Bottom)
.title_style(Style::default().add_modifier(Modifier::BOLD))
.title_alignment(ratatui::layout::Alignment::Left)
.title_style(Style::default().fg(ratatui::style::Color::White))
.border_style(Style::default().fg(ratatui::style::Color::White))
.style(Style::default());
f.render_widget(stats, main[1]);
}
}
AppState::FILTERING => {
f.render_widget(Clear, f.area());
Expand Down
7 changes: 3 additions & 4 deletions src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ pub fn update(app: &mut App, key_event: KeyEvent) {
app.quit()
}
}
KeyCode::Right | KeyCode::Char('j') => app.move_row_down(10),
KeyCode::Left | KeyCode::Char('k') => app.move_row_up(10),
KeyCode::Up | KeyCode::Char('h') => app.move_row_up(1),
KeyCode::Down | KeyCode::Char('l') => app.move_row_down(1),
KeyCode::Down | KeyCode::Char('j') => app.move_row_down(1),
KeyCode::Up | KeyCode::Char('k') => app.move_row_up(1),
KeyCode::Tab => app.move_row_down(10),
KeyCode::Char('f') | KeyCode::Char('F') => match app.app_state {
AppState::ITERATING => app.app_state = AppState::FILTERING,
AppState::FILTERING => app.app_state = AppState::ITERATING,
Expand Down

0 comments on commit 77b08aa

Please sign in to comment.