buffer logic going hard, we are killing buffers from login and register now

This commit is contained in:
filipriec
2025-04-15 18:56:11 +02:00
parent e8b585dc07
commit 921059bed8
4 changed files with 15 additions and 16 deletions

View File

@@ -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

View File

@@ -1,14 +1,13 @@
// src/tui/functions/common/register.rs
use crate::{
services::auth::AuthClient,
state::{
pages::auth::RegisterState,
app::state::AppState,
pages::canvas_state::CanvasState,
},
ui::handlers::context::DialogPurpose,
use crate::services::auth::AuthClient;
use crate::state::{
pages::auth::RegisterState,
app::state::AppState,
pages::canvas_state::CanvasState,
};
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;