functions are now in the file dedicated to the functions belonging to the page

This commit is contained in:
filipriec
2025-03-26 00:26:36 +01:00
parent 92045a4e67
commit 11214734ae
5 changed files with 42 additions and 26 deletions

View File

@@ -0,0 +1,7 @@
// src/tui/functions.rs
pub mod admin;
pub mod intro;
pub use admin::*;
pub use intro::*;

View File

@@ -0,0 +1,8 @@
use crate::state::state::AppState;
pub fn handle_admin_selection(app_state: &mut AppState) {
let profiles = &app_state.profile_tree.profiles;
if !profiles.is_empty() && app_state.general.selected_item < profiles.len() {
app_state.selected_profile = Some(profiles[app_state.general.selected_item].name.clone());
}
}

View File

@@ -0,0 +1,23 @@
use crate::state::state::AppState;
pub fn handle_intro_selection(app_state: &mut AppState) {
match app_state.ui.intro_state.selected_option {
0 => { // Continue
app_state.ui.show_form = true;
app_state.ui.show_admin = false;
app_state.ui.show_login = false;
}
1 => { // Admin
app_state.ui.show_form = false;
app_state.ui.show_admin = true;
app_state.ui.show_login = false;
}
2 => { // Login
app_state.ui.show_form = false;
app_state.ui.show_admin = false;
app_state.ui.show_login = true;
}
_ => {}
}
app_state.ui.show_intro = false;
}

View File

@@ -1,4 +1,5 @@
// src/tui/mod.rs
pub mod terminal;
pub mod controls;
pub mod functions;