31 lines
849 B
Rust
31 lines
849 B
Rust
// src/tui/functions/intro.rs
|
|
use crate::state::app::state::AppState;
|
|
use crate::buffer::state::{AppView, BufferState};
|
|
|
|
/// Handles intro screen selection by updating view history and managing focus state.
|
|
/// 0: Continue (restores last form or default)
|
|
/// 1: Admin view
|
|
/// 2: Login view
|
|
/// 3: Register view (with focus reset)
|
|
pub fn handle_intro_selection(
|
|
app_state: &mut AppState,
|
|
buffer_state: &mut BufferState,
|
|
index: usize,
|
|
) {
|
|
let target_view = match index {
|
|
0 => AppView::Form,
|
|
1 => AppView::Admin,
|
|
2 => AppView::Login,
|
|
3 => AppView::Register,
|
|
_ => return,
|
|
};
|
|
|
|
buffer_state.update_history(target_view);
|
|
|
|
// Register view requires focus reset
|
|
if index == 3 {
|
|
app_state.ui.focus_outside_canvas = false;
|
|
app_state.focused_button_index = 0;
|
|
}
|
|
}
|