add table and add logic removal from ui.rs and event.rs

This commit is contained in:
filipriec
2025-08-30 19:47:26 +02:00
parent 9ed558562b
commit c7d524c76a
6 changed files with 179 additions and 76 deletions

View File

@@ -460,22 +460,6 @@ impl EventHandler {
// Let the current page handle decoupled movement first
if let Some(ma) = movement_action {
match &mut router.current {
// LOGIN: From buttons (general) back into the canvas with 'k' (Up),
// but ONLY from the left-most "Login" button.
Page::AddTable(state) => {
if state.handle_movement(ma) {
// Keep UI focus consistent with inputs vs. outer elements
use crate::pages::admin_panel::add_table::state::AddTableFocus;
let is_canvas_input = matches!(
state.current_focus,
AddTableFocus::InputTableName
| AddTableFocus::InputColumnName
| AddTableFocus::InputColumnType
);
app_state.ui.focus_outside_canvas = !is_canvas_input;
return Ok(EventOutcome::Ok(String::new()));
}
}
Page::Intro(state) => {
if state.handle_movement(ma) {
return Ok(EventOutcome::Ok(String::new()));
@@ -506,8 +490,9 @@ impl EventHandler {
if let Page::AddTable(add_table_state) = &mut router.current {
let client_clone = self.grpc_client.clone();
let sender_clone = self.save_table_result_sender.clone();
if add_table::nav::handle_add_table_navigation(
if crate::pages::admin_panel::add_table::event::handle_add_table_event(
key_event,
movement_action, // wrapper handles both movement + nav
config,
app_state,
add_table_state,
@@ -515,9 +500,7 @@ impl EventHandler {
sender_clone,
&mut self.command_message,
) {
return Ok(EventOutcome::Ok(
self.command_message.clone(),
));
return Ok(EventOutcome::Ok(self.command_message.clone()));
}
}