buffer logic going hard, we are killing buffers from login and register now
This commit is contained in:
@@ -93,8 +93,7 @@ pub async fn handle_dialog_event(
|
||||
match selected_index {
|
||||
0 => { // "OK" button for RegisterSuccess
|
||||
app_state.hide_dialog();
|
||||
// Go back to intro after successful registration dialog
|
||||
let message = register::back_to_main(register_state, app_state).await;
|
||||
let message = register::back_to_login(register_state, app_state, buffer_state).await;
|
||||
return Some(Ok(EventOutcome::Ok(message)));
|
||||
}
|
||||
_ => { // Default for RegisterSuccess
|
||||
|
||||
@@ -196,7 +196,7 @@ impl EventHandler {
|
||||
UiContext::Register => {
|
||||
message = match index {
|
||||
0 => register::save(register_state, &mut self.auth_client, app_state).await?,
|
||||
1 => register::back_to_main(register_state, app_state).await,
|
||||
1 => register::back_to_login(register_state, app_state, buffer_state).await,
|
||||
_ => "Invalid Login Option".to_string(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ pub async fn back_to_main(
|
||||
// Ensure dialog is hidden if revert is called
|
||||
app_state.hide_dialog(); // Uncomment if needed
|
||||
|
||||
// Navigation logic (currently disabled in original code)
|
||||
let closed = buffer_state.close_active_buffer();
|
||||
// Navigation logic
|
||||
buffer_state.close_active_buffer();
|
||||
buffer_state.update_history(AppView::Intro);
|
||||
|
||||
// Reset focus state
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// src/tui/functions/common/register.rs
|
||||
|
||||
use crate::{
|
||||
services::auth::AuthClient,
|
||||
state::{
|
||||
use crate::services::auth::AuthClient;
|
||||
use crate::state::{
|
||||
pages::auth::RegisterState,
|
||||
app::state::AppState,
|
||||
pages::canvas_state::CanvasState,
|
||||
},
|
||||
ui::handlers::context::DialogPurpose,
|
||||
};
|
||||
use crate::ui::handlers::context::DialogPurpose;
|
||||
use crate::state::app::buffer::{AppView, BufferState};
|
||||
|
||||
/// Attempts to register the user using the provided details via gRPC.
|
||||
/// Updates RegisterState and AppState on success or failure.
|
||||
@@ -131,9 +130,10 @@ pub async fn revert(
|
||||
}
|
||||
|
||||
/// Clears the form and returns to the intro screen.
|
||||
pub async fn back_to_main(
|
||||
pub async fn back_to_login(
|
||||
register_state: &mut RegisterState,
|
||||
app_state: &mut AppState,
|
||||
buffer_state: &mut BufferState,
|
||||
) -> String {
|
||||
// Clear fields first
|
||||
let _ = revert(register_state, app_state).await;
|
||||
@@ -142,8 +142,8 @@ pub async fn back_to_main(
|
||||
app_state.hide_dialog();
|
||||
|
||||
// Navigation logic
|
||||
app_state.ui.show_register = false;
|
||||
app_state.ui.show_intro = true;
|
||||
buffer_state.close_active_buffer();
|
||||
buffer_state.update_history(AppView::Login);
|
||||
|
||||
// Reset focus state
|
||||
app_state.ui.focus_outside_canvas = false;
|
||||
|
||||
Reference in New Issue
Block a user