Skip to content

Commit ab63a9e

Browse files
committed
feat: help bar
1 parent 8df9158 commit ab63a9e

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/app.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,35 @@ impl App {
153153

154154
fn ui<B: Backend>(&mut self, f: &mut Frame<B>) {
155155
// Layout
156+
157+
let content_help = Layout::default()
158+
.direction(Direction::Vertical)
159+
.constraints([Constraint::Min(0), Constraint::Length(1)].as_ref())
160+
.split(f.size());
161+
156162
let master_detail = Layout::default()
157163
.direction(Direction::Horizontal)
158164
.constraints([Constraint::Percentage(30), Constraint::Percentage(70)].as_ref())
159-
.split(f.size());
165+
.split(content_help[0]);
166+
167+
// Help
168+
169+
let help = Spans::from(vec![
170+
// ⏴⏵⏶⏷
171+
Span::styled("⏶/⏷", Style::default().fg(Color::Blue)),
172+
Span::styled(": navigate", Style::default().fg(Color::LightBlue)),
173+
Span::raw(" | "),
174+
Span::styled("pgup/pgdown", Style::default().fg(Color::Blue)),
175+
Span::styled(": scroll", Style::default().fg(Color::LightBlue)),
176+
Span::raw(" | "),
177+
Span::styled("ctrl", Style::default().fg(Color::Blue)),
178+
Span::styled(": fast scroll", Style::default().fg(Color::LightBlue)),
179+
Span::raw(" | "),
180+
Span::styled("q", Style::default().fg(Color::Blue)),
181+
Span::styled(": quit", Style::default().fg(Color::LightBlue)),
182+
]);
183+
let help = Paragraph::new(help);
184+
f.render_widget(help, content_help[1]);
160185

161186
// Jobs
162187
let max_user_len = self.jobs.iter().map(|j| j.user.len()).max().unwrap_or(0);

0 commit comments

Comments
 (0)