Refactor to use view state

This commit is contained in:
2025-10-14 13:58:51 +08:00
parent 97ff7011e8
commit 8142d542f6
5 changed files with 187 additions and 115 deletions

17
src/widgets/views/mod.rs Normal file
View File

@@ -0,0 +1,17 @@
use std::any::Any;
use crossterm::event::{Event, KeyEvent};
pub mod main_view;
#[derive(Debug, Clone, Copy)]
pub enum AppStatus {
Running,
Exiting,
Input
}
pub trait View {
fn handle_input(&mut self, event: &Event) -> color_eyre::Result<()>;
fn handle_key_input(&mut self, key: &KeyEvent) -> color_eyre::Result<()>;
fn is_running(&self) -> bool;
}