removing highlightmode from the app, handled by the library now

This commit is contained in:
Priec
2025-08-21 10:33:52 +02:00
parent 1320884409
commit 11b073c2fd
11 changed files with 54 additions and 131 deletions

View File

@@ -2,8 +2,8 @@
use crate::state::app::state::AppState;
use crate::modes::handlers::event::EventHandler;
use crate::state::pages::add_logic::AddLogicFocus;
use crate::state::app::highlight::HighlightState;
use crate::state::pages::admin::AdminState;
use canvas::AppMode as CanvasMode;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AppMode {
@@ -31,8 +31,11 @@ impl ModeManager {
return AppMode::Command;
}
if !matches!(event_handler.highlight_state, HighlightState::Off) {
return AppMode::Highlight;
// NEW: delegate highlight detection to FormEditor
if let Some(editor) = &app_state.form_editor {
if editor.mode() == CanvasMode::Highlight {
return AppMode::Highlight;
}
}
let is_canvas_view = app_state.ui.show_login
@@ -42,39 +45,33 @@ impl ModeManager {
|| app_state.ui.show_add_logic;
if app_state.ui.show_add_logic {
// Specific logic for AddLogic view
match admin_state.add_logic_state.current_focus {
AddLogicFocus::InputLogicName
| AddLogicFocus::InputTargetColumn
| AddLogicFocus::InputDescription => {
// These are canvas inputs
if event_handler.is_edit_mode {
AppMode::Edit
} else {
AppMode::ReadOnly
| AddLogicFocus::InputTargetColumn
| AddLogicFocus::InputDescription => {
if event_handler.is_edit_mode {
AppMode::Edit
} else {
AppMode::ReadOnly
}
}
}
_ => AppMode::General,
}
} else if app_state.ui.show_add_table {
if app_state.ui.focus_outside_canvas {
AppMode::General
} else if event_handler.is_edit_mode {
AppMode::Edit
} else {
if event_handler.is_edit_mode {
AppMode::Edit
} else {
AppMode::ReadOnly
}
AppMode::ReadOnly
}
} else if is_canvas_view {
if app_state.ui.focus_outside_canvas {
AppMode::General
} else if event_handler.is_edit_mode {
AppMode::Edit
} else {
if event_handler.is_edit_mode {
AppMode::Edit
} else {
AppMode::ReadOnly
}
AppMode::ReadOnly
}
} else {
AppMode::General