pub mod connection_list; pub mod database_list; pub mod query; pub mod record_table; pub mod structure_table; use crate::app::{App, FocusBlock}; use crate::components::tab::Tab; use crate::components::Component as _; use crate::event::Key; pub async fn handle_app(key: Key, app: &mut App) -> anyhow::Result<()> { match key { Key::Ctrl('e') => app.focus_block = FocusBlock::Query, Key::Esc if app.error.error.is_some() => { app.error.error = None; return Ok(()); } key => app.tab.event(key)?, } match app.focus_block { FocusBlock::ConnectionList => connection_list::handler(key, app).await?, FocusBlock::DabataseList => database_list::handler(key, app).await?, FocusBlock::Table => match app.tab.selected_tab { Tab::Records => record_table::handler(key, app).await?, Tab::Structure => structure_table::handler(key, app).await?, }, FocusBlock::Query => query::handler(key, app).await?, } Ok(()) }