[feat] add keys description
This commit is contained in:
parent
fa3a2e60cd
commit
61c9fc623d
42
src/main.rs
42
src/main.rs
@ -70,11 +70,13 @@ impl<T> StatefulList<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq)]
|
||||||
enum PageState {
|
enum PageState {
|
||||||
Images,
|
Images,
|
||||||
Tags,
|
Tags,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq)]
|
||||||
enum LoadingState {
|
enum LoadingState {
|
||||||
Init,
|
Init,
|
||||||
Loading,
|
Loading,
|
||||||
@ -356,6 +358,46 @@ fn show_info<B: Backend>(f: &mut Frame<B>, app: &mut App, area: Rect) {
|
|||||||
|
|
||||||
let paragraph = Paragraph::new(texts).block(Block::default().borders(Borders::NONE));
|
let paragraph = Paragraph::new(texts).block(Block::default().borders(Borders::NONE));
|
||||||
f.render_widget(paragraph, chunks[0]);
|
f.render_widget(paragraph, chunks[0]);
|
||||||
|
|
||||||
|
{
|
||||||
|
// show keys
|
||||||
|
let chunks = Layout::default()
|
||||||
|
.direction(Direction::Horizontal)
|
||||||
|
.constraints(
|
||||||
|
[
|
||||||
|
Constraint::Percentage(30),
|
||||||
|
Constraint::Percentage(30),
|
||||||
|
Constraint::Percentage(20),
|
||||||
|
]
|
||||||
|
.as_ref(),
|
||||||
|
)
|
||||||
|
.split(chunks[1]);
|
||||||
|
|
||||||
|
let mut global_keys = vec![Spans::from(vec![
|
||||||
|
Span::styled("q", Style::default().fg(Color::Yellow)),
|
||||||
|
Span::raw(" quit"),
|
||||||
|
])];
|
||||||
|
|
||||||
|
let mut tags_keys: Vec<Spans> = vec![];
|
||||||
|
|
||||||
|
if app.page_state == PageState::Tags {
|
||||||
|
global_keys.push(Spans::from(vec![
|
||||||
|
Span::styled("esc", Style::default().fg(Color::Yellow)),
|
||||||
|
Span::raw(" back to images"),
|
||||||
|
]));
|
||||||
|
|
||||||
|
tags_keys.push(Spans::from(vec![
|
||||||
|
Span::styled("c", Style::default().fg(Color::Yellow)),
|
||||||
|
Span::raw(" copy docker image uri"),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
let paragraph = Paragraph::new(global_keys).block(Block::default().borders(Borders::NONE));
|
||||||
|
f.render_widget(paragraph, chunks[0]);
|
||||||
|
|
||||||
|
let paragraph = Paragraph::new(tags_keys).block(Block::default().borders(Borders::NONE));
|
||||||
|
f.render_widget(paragraph, chunks[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn page_images<B: Backend>(f: &mut Frame<B>, app: &mut App, area: Rect) {
|
fn page_images<B: Backend>(f: &mut Frame<B>, app: &mut App, area: Rect) {
|
||||||
|
Loading…
Reference in New Issue
Block a user