intro page working properly well
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
//
|
||||
|
||||
use crossterm::event::Event;
|
||||
// src/modes/handlers/event.rs
|
||||
use crossterm::event::{Event, KeyCode};
|
||||
use crossterm::cursor::SetCursorStyle;
|
||||
use crate::tui::terminal::{
|
||||
core::TerminalCore,
|
||||
@@ -48,21 +47,41 @@ impl EventHandler {
|
||||
app_state: &mut crate::state::state::AppState,
|
||||
total_count: u64,
|
||||
current_position: &mut u64,
|
||||
intro_state: &mut crate::components::handlers::intro::IntroState,
|
||||
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
||||
if app_state.ui.show_intro {
|
||||
if let Event::Key(key) = event {
|
||||
match key.code {
|
||||
KeyCode::Left => intro_state.previous_option(),
|
||||
KeyCode::Right => intro_state.next_option(),
|
||||
KeyCode::Enter => {
|
||||
if intro_state.selected_option == 0 {
|
||||
app_state.ui.show_intro = false;
|
||||
} else {
|
||||
self.command_message = "Admin panel coming soon".to_string();
|
||||
}
|
||||
return Ok((false, String::new()));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
return Ok((false, String::new()));
|
||||
}
|
||||
|
||||
if let Event::Key(key) = event {
|
||||
let key_code = key.code;
|
||||
let modifiers = key.modifiers;
|
||||
|
||||
if UiStateHandler::toggle_sidebar(
|
||||
&mut app_state.ui,
|
||||
config,
|
||||
key_code,
|
||||
modifiers,
|
||||
) {
|
||||
return Ok((false, format!("Sidebar {}",
|
||||
if app_state.ui.show_sidebar { "shown" } else { "hidden" }
|
||||
)));
|
||||
}
|
||||
if UiStateHandler::toggle_sidebar(
|
||||
&mut app_state.ui,
|
||||
config,
|
||||
key_code,
|
||||
modifiers,
|
||||
) {
|
||||
return Ok((false, format!("Sidebar {}",
|
||||
if app_state.ui.show_sidebar { "shown" } else { "hidden" }
|
||||
)));
|
||||
}
|
||||
|
||||
if let Some(action) = config.get_action_for_key_in_mode(
|
||||
&config.keybindings.common,
|
||||
|
||||
Reference in New Issue
Block a user