Add base project
Some checks failed
Deploy to VPS / deploy (push) Failing after 5s

This commit is contained in:
2025-11-06 19:42:12 +01:00
parent 29c60e4824
commit c0688ca363
8 changed files with 504 additions and 33 deletions

35
src/input.rs Normal file
View File

@@ -0,0 +1,35 @@
use crossterm::event::{Event, KeyCode};
use crate::app::App;
pub fn handle_input(app: &mut App, event: Event) -> bool {
if app.show_welcome {
if let Event::Key(_) = event {
app.show_welcome = false;
}
} else if app.show_help {
if let Event::Key(key) = event {
match key.code {
KeyCode::Char('q')
| KeyCode::Esc
| KeyCode::Char('?')
| KeyCode::Enter
| KeyCode::Backspace => app.show_help = false,
_ => {}
}
}
} else {
if let Event::Key(key) = event {
match key.code {
KeyCode::Char('h') | KeyCode::Left => app.move_left(),
KeyCode::Char('l') | KeyCode::Right => app.move_right(),
KeyCode::Char('j') | KeyCode::Down => app.move_down(),
KeyCode::Char('k') | KeyCode::Up => app.move_up(),
KeyCode::Char('?') => app.show_help = true,
KeyCode::Char('q') | KeyCode::Esc => return false,
_ => {}
}
}
}
true
}