compiled but the readonly and edit mode is not working

This commit is contained in:
filipriec
2025-05-23 15:22:21 +02:00
parent 58fdaa8298
commit 667eb4809d
10 changed files with 643 additions and 17 deletions

View File

@@ -5,11 +5,12 @@ use crate::state::pages::{
auth::{LoginState, RegisterState},
canvas_state::CanvasState,
};
use crate::state::pages::add_logic::AddLogicState;
use crate::state::pages::form::FormState;
use crate::state::pages::add_table::AddTableState;
use crate::state::pages::admin::AdminState;
use crate::modes::handlers::event::EventOutcome;
use crate::functions::modes::edit::{auth_e, form_e};
use crate::functions::modes::edit::add_table_e;
use crate::functions::modes::edit::{add_logic_e, auth_e, form_e, add_table_e};
use crate::state::app::state::AppState;
use anyhow::Result;
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
@@ -26,7 +27,7 @@ pub async fn handle_edit_event(
form_state: &mut FormState,
login_state: &mut LoginState,
register_state: &mut RegisterState,
add_table_state: &mut AddTableState,
admin_state: &mut AdminState,
ideal_cursor_column: &mut usize,
current_position: &mut u64,
total_count: u64,
@@ -73,6 +74,11 @@ pub async fn handle_edit_event(
"Action '{}' not fully implemented for Add Table view here.",
action
)
} else if app_state.ui.show_add_logic {
format!(
"Action '{}' not fully implemented for Add Logic view here.",
action
)
} else {
let outcome = form_e::execute_common_action(
action,
@@ -101,14 +107,14 @@ pub async fn handle_edit_event(
.as_deref() {
// Handle enter_decider first
if action == "enter_decider" {
let effective_action = if app_state.ui.show_register
&& register_state.in_suggestion_mode
let effective_action = if app_state.ui.show_register
&& register_state.in_suggestion_mode
&& register_state.current_field() == 4 {
"select_suggestion"
} else {
"next_field"
};
let msg = if app_state.ui.show_login {
auth_e::execute_edit_action(
effective_action,
@@ -121,7 +127,15 @@ pub async fn handle_edit_event(
add_table_e::execute_edit_action(
effective_action,
key,
add_table_state,
&mut admin_state.add_table_state,
ideal_cursor_column,
)
.await?
} else if app_state.ui.show_add_logic {
add_logic_e::execute_edit_action(
effective_action,
key,
&mut admin_state.add_logic_state,
ideal_cursor_column,
)
.await?
@@ -209,7 +223,15 @@ pub async fn handle_edit_event(
add_table_e::execute_edit_action(
action,
key,
add_table_state,
&mut admin_state.add_table_state,
ideal_cursor_column,
)
.await?
} else if app_state.ui.show_add_logic {
add_logic_e::execute_edit_action(
action,
key,
&mut admin_state.add_logic_state,
ideal_cursor_column,
)
.await?
@@ -252,7 +274,15 @@ pub async fn handle_edit_event(
add_table_e::execute_edit_action(
"insert_char",
key,
add_table_state,
&mut admin_state.add_table_state,
ideal_cursor_column,
)
.await?
} else if app_state.ui.show_add_logic {
add_logic_e::execute_edit_action(
"insert_char",
key,
&mut admin_state.add_logic_state,
ideal_cursor_column,
)
.await?