use crossterm::event::{KeyEvent, MouseEvent}; use ratatui::prelude::Frame; use tokio::sync::mpsc::UnboundedSender; use crate::state::{Action, State}; pub trait Component { fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self where Self: Sized; fn move_with_state(self, state: &State) -> Self where Self: Sized; fn name(&self) -> &str; fn handle_key_event(&mut self, _key: KeyEvent) {} fn handle_mouse_event(&mut self, _mouse: MouseEvent) {} } pub trait ComponentRender<Props> { fn render(&self, frame: &mut Frame, props: Props); }