add Logic fully decoupled
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
// src/pages/admin/admin/state.rs
|
// src/pages/admin/admin/state.rs
|
||||||
use ratatui::widgets::ListState;
|
use ratatui::widgets::ListState;
|
||||||
use crate::pages::admin_panel::add_table::state::AddTableState;
|
use crate::pages::admin_panel::add_table::state::AddTableState;
|
||||||
use crate::pages::admin_panel::add_logic::state::AddLogicState;
|
|
||||||
use crate::movement::{move_focus, MovementAction};
|
use crate::movement::{move_focus, MovementAction};
|
||||||
use crate::state::app::state::AppState;
|
use crate::state::app::state::AppState;
|
||||||
|
|
||||||
@@ -28,7 +27,6 @@ pub struct AdminState {
|
|||||||
pub selected_table_index: Option<usize>,
|
pub selected_table_index: Option<usize>,
|
||||||
pub current_focus: AdminFocus,
|
pub current_focus: AdminFocus,
|
||||||
pub add_table_state: AddTableState,
|
pub add_table_state: AddTableState,
|
||||||
pub add_logic_state: AddLogicState,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AdminState {
|
impl AdminState {
|
||||||
|
|||||||
@@ -426,15 +426,9 @@ pub async fn run_ui() -> Result<()> {
|
|||||||
}
|
}
|
||||||
AppView::AddTable => router.navigate(Page::AddTable(admin_state.add_table_state.clone())),
|
AppView::AddTable => router.navigate(Page::AddTable(admin_state.add_table_state.clone())),
|
||||||
AppView::AddLogic => {
|
AppView::AddLogic => {
|
||||||
// Create once, like Login/Register
|
if let Page::AddLogic(page) = &mut router.current {
|
||||||
if let Page::AddLogic(_) = &router.current {
|
// Ensure keymap is set once
|
||||||
// already on page
|
|
||||||
} else {
|
|
||||||
let mut page = add_logic::state::AddLogicFormState::from_state(
|
|
||||||
admin_state.add_logic_state.clone(),
|
|
||||||
);
|
|
||||||
page.editor.set_keymap(config.build_canvas_keymap());
|
page.editor.set_keymap(config.build_canvas_keymap());
|
||||||
router.navigate(Page::AddLogic(page));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppView::Form(path) => {
|
AppView::Form(path) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user