KeybindingsWidget now accepts actions

Views now pass a list of `Action` values to `KeybindingsWidget` instead
of
pre‑resolved `KeyBinding` references. The widget resolves the bindings
internally using `binding_for`, simplifying import statements and view
logic.
This commit is contained in:
2026-03-15 22:00:00 +01:00
parent acc6ba08f3
commit 9d4ff19b6e
4 changed files with 27 additions and 40 deletions
+8 -12
View File
@@ -1,8 +1,4 @@
use crate::app::{
App, View,
keybindings::{Action, KeyBinding, binding_for},
widgets::KeybindingsWidget,
};
use crate::app::{App, View, keybindings::Action, widgets::KeybindingsWidget};
use clap::ValueEnum;
use ratatui::{
buffer::Buffer,
@@ -87,14 +83,14 @@ pub fn main_menu_view(app: &App, area: Rect, buf: &mut Buffer) {
}
{
let keybindings: Vec<Option<&'static KeyBinding>> = vec![
binding_for(Action::Up),
binding_for(Action::Down),
binding_for(Action::Space),
binding_for(Action::Quit),
binding_for(Action::Quit2),
let actions: Vec<Action> = vec![
Action::Up,
Action::Down,
Action::Space,
Action::Quit,
Action::Quit2,
];
KeybindingsWidget::new(keybindings).render(keybindings_area, buf);
KeybindingsWidget::new(actions).render(keybindings_area, buf);
}
}