working main menu

This commit is contained in:
🪞👃🪞 2025-08-24 02:42:30 +03:00
parent 559d2fc4a1
commit f81f16b47b
7 changed files with 130 additions and 80 deletions

View file

@ -49,8 +49,15 @@ impl Default for AppCommand { fn default () -> Self { Self::Nop } }
def_command!(AppCommand: |app: App| {
Nop => Ok(None),
Confirm => todo!(),
Cancel => todo!(), // TODO delegate:
Confirm => Ok(match &app.dialog {
Dialog::Menu(index, items) => {
let callback = items.0[*index].1.clone();
callback(app)?;
None
},
_ => todo!(),
}),
Cancel => todo!(), // TODO delegate:
Inc { axis: Axis } => Ok(match (&app.dialog, axis) {
(Dialog::None, _) => todo!(),
(Dialog::Menu(_, _), Axis::Y) => AppCommand::SetDialog { dialog: app.dialog.menu_next() }