moving the state from general to each page owning its own state of button or canvas focus

This commit is contained in:
Priec
2025-09-04 17:36:13 +02:00
parent 6891631b8d
commit d9d8562539
24 changed files with 286 additions and 168 deletions

View File

@@ -16,32 +16,27 @@ pub fn logout(
auth_state.user_id = None;
auth_state.role = None;
auth_state.decoded_username = None;
// Delete stored auth data
if let Err(e) = delete_auth_data() {
error!("Failed to delete stored auth data: {}", e);
// Continue anyway - user is logged out in memory
}
// Navigate to intro screen
buffer_state.history = vec![AppView::Intro];
buffer_state.active_index = 0;
// Reset UI state
app_state.ui.focus_outside_canvas = false;
app_state.focused_button_index = 0;
// Hide any open dialogs
app_state.hide_dialog();
// Show logout confirmation dialog
app_state.show_dialog(
"Logged Out",
"You have been successfully logged out.",
vec!["OK".to_string()],
DialogPurpose::LoginSuccess, // Reuse or create a new purpose
DialogPurpose::LoginSuccess,
);
info!("User logged out successfully.");
"Logged out successfully".to_string()
}