refactor: extract FormNav trait, unify form key handling, decentralize view titles and hints

This commit is contained in:
2026-05-27 02:09:44 +08:00
parent d3bd4af634
commit 0d65be65d3
16 changed files with 238 additions and 316 deletions
+9
View File
@@ -24,6 +24,15 @@ const ACTIONS: &[(&str, &str)] = &[
pub struct ActionMenuView;
impl View for ActionMenuView {
fn title(&self) -> &'static str { "Actions" }
fn hints(&self) -> Vec<(&'static str, &'static str)> {
vec![
("j/k", "move"),
("Enter", "select"),
("Esc", "cancel"),
]
}
fn draw(&self, frame: &mut Frame<'_>, _app: &App, area: Rect) {
let list_width = 52u16.min(area.width.saturating_sub(4));
let list_height = (ACTIONS.len() as u16 + 4).min(area.height);