DONE we have now intro state separate from others completely
This commit is contained in:
@@ -13,6 +13,7 @@ use crate::state::pages::auth::AuthState;
|
||||
use crate::state::pages::auth::LoginState;
|
||||
use crate::state::pages::auth::RegisterState;
|
||||
use crate::state::pages::admin::AdminState;
|
||||
use crate::state::pages::intro::IntroState;
|
||||
use crate::state::app::state::AppState;
|
||||
// Import SaveOutcome
|
||||
use crate::tui::terminal::{EventReader, TerminalCore};
|
||||
@@ -21,30 +22,27 @@ use crossterm::cursor::SetCursorStyle;
|
||||
|
||||
pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = Config::load()?;
|
||||
let theme = Theme::from_str(&config.colors.theme);
|
||||
let mut terminal = TerminalCore::new()?;
|
||||
let mut grpc_client = GrpcClient::new().await?;
|
||||
let mut command_handler = CommandHandler::new();
|
||||
let theme = Theme::from_str(&config.colors.theme);
|
||||
let mut auth_state = AuthState::default();
|
||||
let mut register_state = RegisterState::default();
|
||||
let mut login_state = LoginState::default();
|
||||
let mut admin_state = AdminState::default();
|
||||
|
||||
// Initialize app_state first
|
||||
let mut event_handler = EventHandler::new().await?;
|
||||
let event_reader = EventReader::new();
|
||||
|
||||
let mut auth_state = AuthState::default();
|
||||
let mut login_state = LoginState::default();
|
||||
let mut register_state = RegisterState::default();
|
||||
let mut intro_state = IntroState::default();
|
||||
let mut admin_state = AdminState::default();
|
||||
let mut app_state = AppState::new()?;
|
||||
|
||||
// Initialize app state with profile tree and table structure
|
||||
let column_names =
|
||||
UiService::initialize_app_state(&mut grpc_client, &mut app_state)
|
||||
.await?;
|
||||
|
||||
// Initialize FormState with dynamic fields
|
||||
let mut form_state = FormState::new(column_names);
|
||||
|
||||
// Initialize EventHandler (which now contains AuthClient)
|
||||
let mut event_handler = EventHandler::new().await?;
|
||||
let event_reader = EventReader::new();
|
||||
|
||||
// Fetch the total count of Adresar entries
|
||||
UiService::initialize_adresar_count(&mut grpc_client, &mut app_state)
|
||||
.await?;
|
||||
@@ -61,6 +59,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
&mut auth_state,
|
||||
&login_state,
|
||||
®ister_state,
|
||||
&intro_state,
|
||||
&mut admin_state,
|
||||
&theme,
|
||||
is_edit_mode,
|
||||
@@ -121,6 +120,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
&mut auth_state,
|
||||
&mut login_state,
|
||||
&mut register_state,
|
||||
&mut intro_state,
|
||||
&mut admin_state,
|
||||
&mut app_state,
|
||||
total_count,
|
||||
|
||||
Reference in New Issue
Block a user