moving add table to the same way as add logic

This commit is contained in:
Priec
2025-08-31 23:07:57 +02:00
parent 347802b2a4
commit 62c54dc1eb
5 changed files with 136 additions and 48 deletions

View File

@@ -4,7 +4,7 @@ use crate::config::binds::config::Config;
use crate::movement::MovementAction;
use crate::pages::admin_panel::add_table::nav;
use crate::pages::admin_panel::add_table::nav::SaveTableResultSender;
use crate::pages::admin_panel::add_table::state::{AddTableFocus, AddTableState};
use crate::pages::admin_panel::add_table::state::{AddTableFocus, AddTableFormState};
use crate::services::GrpcClient;
use crate::state::app::state::AppState;
use crossterm::event::KeyEvent;
@@ -19,31 +19,31 @@ pub fn handle_add_table_event(
movement_action: Option<MovementAction>,
config: &Config,
app_state: &mut AppState,
state: &mut AddTableState,
page: &mut AddTableFormState,
grpc_client: GrpcClient,
save_result_sender: SaveTableResultSender,
command_message: &mut String,
) -> bool {
// 1) Try movement first (keeps focus cycling consistent)
// 1) Try movement first
if let Some(ma) = movement_action {
if state.handle_movement(ma) {
if page.state.handle_movement(ma) {
let is_canvas_input = matches!(
state.current_focus,
page.current_focus(),
AddTableFocus::InputTableName
| AddTableFocus::InputColumnName
| AddTableFocus::InputColumnType
| AddTableFocus::InputColumnName
| AddTableFocus::InputColumnType
);
app_state.ui.focus_outside_canvas = !is_canvas_input;
return true;
}
}
// 2) Rich actions/navigation for AddTable
// 2) Rich actions/navigation
nav::handle_add_table_navigation(
key_event,
config,
app_state,
state,
&mut page.state,
grpc_client,
save_result_sender,
command_message,