continuation of the fixes
This commit is contained in:
@@ -83,7 +83,7 @@ pub async fn handle_navigation_event(
|
|||||||
|
|
||||||
pub fn move_up(app_state: &mut AppState, login_state: &mut LoginState, register_state: &mut RegisterState, admin_state: &mut AdminState) {
|
pub fn move_up(app_state: &mut AppState, login_state: &mut LoginState, register_state: &mut RegisterState, admin_state: &mut AdminState) {
|
||||||
if app_state.ui.focus_outside_canvas && app_state.ui.show_login || app_state.ui.show_register{
|
if app_state.ui.focus_outside_canvas && app_state.ui.show_login || app_state.ui.show_register{
|
||||||
if app_state.button_focus_index == 0 {
|
if app_state.focused_button_index == 0 {
|
||||||
app_state.ui.focus_outside_canvas = false;
|
app_state.ui.focus_outside_canvas = false;
|
||||||
if app_state.ui.show_login {
|
if app_state.ui.show_login {
|
||||||
let last_field_index = login_state.fields().len().saturating_sub(1);
|
let last_field_index = login_state.fields().len().saturating_sub(1);
|
||||||
@@ -93,7 +93,7 @@ pub fn move_up(app_state: &mut AppState, login_state: &mut LoginState, register_
|
|||||||
register_state.set_current_field(last_field_index);
|
register_state.set_current_field(last_field_index);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
app_state.button_focus_index = app_state.general.selected_item.saturating_sub(1);
|
app_state.focused_button_index = app_state.general.selected_item.saturating_sub(1);
|
||||||
}
|
}
|
||||||
} else if app_state.ui.show_intro {
|
} else if app_state.ui.show_intro {
|
||||||
app_state.ui.intro_state.previous_option();
|
app_state.ui.intro_state.previous_option();
|
||||||
@@ -105,8 +105,8 @@ pub fn move_up(app_state: &mut AppState, login_state: &mut LoginState, register_
|
|||||||
pub fn move_down(app_state: &mut AppState, admin_state: &mut AdminState) {
|
pub fn move_down(app_state: &mut AppState, admin_state: &mut AdminState) {
|
||||||
if app_state.ui.focus_outside_canvas && app_state.ui.show_login || app_state.ui.show_register {
|
if app_state.ui.focus_outside_canvas && app_state.ui.show_login || app_state.ui.show_register {
|
||||||
let num_general_elements = 2;
|
let num_general_elements = 2;
|
||||||
if app_state.button_focus_index < num_general_elements - 1 {
|
if app_state.focused_button_index < num_general_elements - 1 {
|
||||||
app_state.button_focus_index += 1;
|
app_state.focused_button_index += 1;
|
||||||
}
|
}
|
||||||
} else if app_state.ui.show_intro {
|
} else if app_state.ui.show_intro {
|
||||||
app_state.ui.intro_state.next_option();
|
app_state.ui.intro_state.next_option();
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ use crate::state::pages::admin::AdminState;
|
|||||||
|
|
||||||
pub fn handle_admin_selection(app_state: &mut AppState, admin_state: &AdminState) {
|
pub fn handle_admin_selection(app_state: &mut AppState, admin_state: &AdminState) {
|
||||||
let profiles = &app_state.profile_tree.profiles;
|
let profiles = &app_state.profile_tree.profiles;
|
||||||
if !profiles.is_empty() && app_state.general.selected_item < profiles.len() {
|
if let Some(selected_index) = admin_state.get_selected_index() {
|
||||||
app_state.selected_profile = Some(profiles[app_state.general.selected_item].name.clone());
|
if let Some(profile) = profiles.get(selected_index) {
|
||||||
|
app_state.selected_profile = Some(profile.name.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ pub async fn back_to_main(
|
|||||||
|
|
||||||
// Reset focus state
|
// Reset focus state
|
||||||
app_state.ui.focus_outside_canvas = false;
|
app_state.ui.focus_outside_canvas = false;
|
||||||
app_state.button_focus_index = 0;
|
app_state.focused_button_index = 0;
|
||||||
|
|
||||||
"Returned to main menu".to_string()
|
"Returned to main menu".to_string()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub fn handle_intro_selection(app_state: &mut AppState, index: usize) { // Add i
|
|||||||
app_state.ui.show_intro = false;
|
app_state.ui.show_intro = false;
|
||||||
app_state.ui.show_register = true;
|
app_state.ui.show_register = true;
|
||||||
app_state.ui.focus_outside_canvas = false;
|
app_state.ui.focus_outside_canvas = false;
|
||||||
app_state.button_focus_index = 0;
|
app_state.focused_button_index = 0;
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user