improved help
This commit is contained in:
48
src/ui.rs
48
src/ui.rs
@@ -219,10 +219,10 @@ pub fn draw_main(f: &mut Frame, main: &MainView) {
|
||||
);
|
||||
|
||||
// ── Right panel ──
|
||||
let right_content = if main.loading_page_content {
|
||||
"Loading page content…".to_string()
|
||||
let right_text = if main.loading_page_content {
|
||||
ratatui::text::Text::raw("Loading page content…")
|
||||
} else if let Some(err) = &main.error {
|
||||
format!("Error: {err}")
|
||||
ratatui::text::Text::styled(format!("Error: {err}"), Style::default().fg(Color::Red))
|
||||
} else {
|
||||
let space_name = main
|
||||
.spaces
|
||||
@@ -234,13 +234,47 @@ pub fn draw_main(f: &mut Frame, main: &MainView) {
|
||||
.get(main.selected_page)
|
||||
.and_then(|p| p.title.as_deref())
|
||||
.unwrap_or("-");
|
||||
format!(
|
||||
"Space: {space_name}\nPage: {page_title}\n\n_______________________\nEnter open editor\nTab switch panel\n↑↓/j k navigate\nq/Esc quit\n//Ctrl+F search\n n +new page\n Ctrl+n New Space"
|
||||
)
|
||||
|
||||
let key_style = Style::default().fg(Color::Cyan).add_modifier(Modifier::BOLD);
|
||||
let dim_style = Style::default().fg(Color::DarkGray);
|
||||
let sep = "─".repeat(28);
|
||||
|
||||
let row = |key: &'static str, desc: &'static str| {
|
||||
Line::from(vec![
|
||||
Span::styled(format!("{key:<14}"), key_style),
|
||||
Span::raw(desc),
|
||||
])
|
||||
};
|
||||
|
||||
ratatui::text::Text::from(vec![
|
||||
Line::from(vec![
|
||||
Span::styled("Space ", dim_style),
|
||||
Span::raw(space_name),
|
||||
]),
|
||||
Line::from(vec![
|
||||
Span::styled("Page ", dim_style),
|
||||
Span::raw(page_title),
|
||||
]),
|
||||
Line::raw(""),
|
||||
Line::styled(sep.clone(), dim_style),
|
||||
Line::from(vec![
|
||||
Span::styled(format!("{:<14}", "Key"), dim_style),
|
||||
Span::styled("Action", dim_style),
|
||||
]),
|
||||
Line::styled(sep, dim_style),
|
||||
row("Enter", "Open editor"),
|
||||
row("Tab", "Switch panel"),
|
||||
row("↑↓ / j k", "Navigate"),
|
||||
row("d", "Delete (to trash)"),
|
||||
row("n", "New page"),
|
||||
row("Ctrl+N", "New space"),
|
||||
row("/ Ctrl+F", "Search"),
|
||||
row("q / Esc", "Quit"),
|
||||
])
|
||||
};
|
||||
|
||||
f.render_widget(
|
||||
Paragraph::new(right_content).block(Block::default().title("Info").borders(Borders::ALL)),
|
||||
Paragraph::new(right_text).block(Block::default().title(" Info ").borders(Borders::ALL)),
|
||||
layout[1],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user