diff --git a/Cargo.lock b/Cargo.lock index a8f2d4e..89a4aff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -421,7 +421,7 @@ dependencies = [ [[package]] name = "client" -version = "0.3.5" +version = "0.3.13" dependencies = [ "async-trait", "common", @@ -462,7 +462,7 @@ dependencies = [ [[package]] name = "common" -version = "0.3.5" +version = "0.3.13" dependencies = [ "prost", "serde", @@ -2593,7 +2593,7 @@ dependencies = [ [[package]] name = "server" -version = "0.3.5" +version = "0.3.13" dependencies = [ "bcrypt", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 306bdcf..70c2d33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" [workspace.package] # TODO: idk how to do the name, fix later # name = "Multieko2" -version = "0.3.5" +version = "0.3.13" edition = "2021" license = "GPL-3.0-or-later" authors = ["Filip Priečinský "] diff --git a/client/src/modes/general/dialog.rs b/client/src/modes/general/dialog.rs index 55fc89a..ed309a5 100644 --- a/client/src/modes/general/dialog.rs +++ b/client/src/modes/general/dialog.rs @@ -4,6 +4,7 @@ use crossterm::event::{Event, KeyCode}; use crate::config::binds::config::Config; use crate::ui::handlers::context::DialogPurpose; use crate::state::app::state::AppState; +use crate::state::app::buffer::{AppView, BufferState}; use crate::state::pages::auth::AuthState; use crate::state::pages::auth::LoginState; use crate::state::pages::auth::RegisterState; @@ -20,6 +21,7 @@ pub async fn handle_dialog_event( auth_state: &mut AuthState, login_state: &mut LoginState, register_state: &mut RegisterState, + buffer_state: &mut BufferState, ) -> Option>> { if let Event::Key(key) = event { // Always allow Esc to dismiss @@ -62,7 +64,7 @@ pub async fn handle_dialog_event( match selected_index { 0 => { // "Menu" button selected app_state.hide_dialog(); - let message = login::back_to_main(login_state, app_state).await; + let message = login::back_to_main(login_state, app_state, buffer_state).await; return Some(Ok(EventOutcome::Ok(message))); } 1 => { diff --git a/client/src/modes/handlers/event.rs b/client/src/modes/handlers/event.rs index e631f6b..a185cc4 100644 --- a/client/src/modes/handlers/event.rs +++ b/client/src/modes/handlers/event.rs @@ -111,7 +111,7 @@ impl EventHandler { // --- DIALOG MODALITY --- if app_state.ui.dialog.dialog_show { if let Some(dialog_result) = dialog::handle_dialog_event( - &event, config, app_state, auth_state, login_state, register_state + &event, config, app_state, auth_state, login_state, register_state, buffer_state ).await { return dialog_result; } @@ -189,7 +189,7 @@ impl EventHandler { UiContext::Login => { message = match index { 0 => login::save(auth_state, login_state, &mut self.auth_client, app_state).await?, - 1 => login::back_to_main(login_state, app_state).await, + 1 => login::back_to_main(login_state, app_state, buffer_state).await, _ => "Invalid Login Option".to_string(), }; } diff --git a/client/src/tui/functions/common/login.rs b/client/src/tui/functions/common/login.rs index 2d69c2a..2848d21 100644 --- a/client/src/tui/functions/common/login.rs +++ b/client/src/tui/functions/common/login.rs @@ -4,6 +4,7 @@ use crate::services::auth::AuthClient; use crate::state::pages::auth::AuthState; use crate::state::pages::auth::LoginState; use crate::state::app::state::AppState; +use crate::state::app::buffer::{AppView, BufferState}; use crate::state::pages::canvas_state::CanvasState; use crate::ui::handlers::context::DialogPurpose; @@ -87,6 +88,7 @@ pub async fn revert( pub async fn back_to_main( login_state: &mut LoginState, app_state: &mut AppState, + buffer_state: &mut BufferState, ) -> String { // Clear the input fields login_state.username.clear(); @@ -98,8 +100,7 @@ pub async fn back_to_main( app_state.hide_dialog(); // Uncomment if needed // Navigation logic (currently disabled in original code) - app_state.ui.show_login = false; - app_state.ui.show_intro = true; + buffer_state.update_history(AppView::Intro); // Reset focus state app_state.ui.focus_outside_canvas = false;