use crate::uis::new_transaction::NewTransactionTabState; pub type AppResult = std::result::Result>; pub enum FocusedBlock { Navigation, Body, } pub struct App<'a> { pub running: bool, pub tabs: Vec<&'a str>, pub tab_index: usize, pub focus: FocusedBlock, pub new_transaction_tab_state: NewTransactionTabState<'a>, } impl<'a> App<'a> { pub fn new() -> App<'a> { App { running: true, tabs: vec!["History", "Tab2", "Tab3"], tab_index: 0, focus: FocusedBlock::Navigation, new_transaction_tab_state: NewTransactionTabState::new(), } } pub fn next_tab(&mut self) { self.tab_index = (self.tab_index + 1) % self.tabs.len(); } pub fn prev_tab(&mut self) { if self.tab_index > 0 { self.tab_index -= 1; } else { self.tab_index = self.tabs.len() - 1; } } pub fn focus_navigation(&mut self) { self.focus = FocusedBlock::Navigation; } pub fn focus_body(&mut self) { self.focus = FocusedBlock::Body; } }