step 3 compiled

This commit is contained in:
filipriec
2025-03-28 14:35:16 +01:00
parent 48b2658b55
commit f21953147b
2 changed files with 7 additions and 16 deletions

View File

@@ -15,14 +15,16 @@ pub struct ModeManager;
impl ModeManager { impl ModeManager {
// Determine current mode based on app state // Determine current mode based on app state
pub fn derive_mode(app_state: &AppState, event_handler: &EventHandler) -> AppMode { pub fn derive_mode(app_state: &AppState, event_handler: &EventHandler) -> AppMode {
// Command mode takes precedence if active
if event_handler.command_mode { if event_handler.command_mode {
return AppMode::Command; return AppMode::Command;
} }
// Check UI state flags if app_state.ui.show_login { // NEW: Check auth visibility
if app_state.ui.show_intro || app_state.ui.show_admin { if event_handler.is_edit_mode {
AppMode::General AppMode::Edit
} else {
AppMode::ReadOnly
}
} else if app_state.ui.show_form { } else if app_state.ui.show_form {
if event_handler.is_edit_mode { if event_handler.is_edit_mode {
AppMode::Edit AppMode::Edit
@@ -30,7 +32,6 @@ impl ModeManager {
AppMode::ReadOnly AppMode::ReadOnly
} }
} else { } else {
// Fallback
AppMode::General AppMode::General
} }
} }

View File

@@ -22,16 +22,6 @@ impl AuthState {
current_cursor_pos: 0, current_cursor_pos: 0,
} }
} }
// These methods are now redundant since we implement CanvasState
// but we'll keep them for backward compatibility
pub fn get_current_input_mut(&mut self) -> &mut String {
self.get_current_input_mut()
}
pub fn get_current_input(&self) -> &str {
self.get_current_input()
}
} }
impl CanvasState for AuthState { impl CanvasState for AuthState {