intro page working properly well

This commit is contained in:
filipriec
2025-03-21 23:07:10 +01:00
parent 1b0aaa55c9
commit c592dfc7f5
6 changed files with 54 additions and 19 deletions

View File

@@ -1,9 +1,9 @@
// src/ui/handlers/render.rs
use crate::components::{
render_background,
render_command_line,
render_background,
render_command_line,
render_status_line,
handlers::sidebar::{self, calculate_sidebar_layout}
handlers::{sidebar::{self, calculate_sidebar_layout}, intro},
};
use crate::config::colors::Theme;
use ratatui::layout::{Constraint, Direction, Layout};
@@ -23,9 +23,15 @@ pub fn render_ui(
command_mode: bool,
command_message: &str,
app_state: &AppState,
intro_state: &intro::IntroState,
) {
render_background(f, f.area(), theme);
if app_state.ui.show_intro {
intro_state.render(f, f.area(), theme);
return;
}
let root = Layout::default()
.direction(Direction::Vertical)
.constraints([

View File

@@ -9,7 +9,7 @@ use crate::config::config::Config;
use crate::ui::handlers::{form::FormState, render::render_ui};
use crate::modes::handlers::event::EventHandler;
use crate::state::state::AppState;
use crate::components::handlers::intro::IntroState;
pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::load()?;
@@ -17,6 +17,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
let mut grpc_client = GrpcClient::new().await?;
let mut command_handler = CommandHandler::new();
let theme = Theme::from_str(&config.colors.theme);
let mut intro_state = IntroState::new();
// Fetch table structure at startup (one-time)
// TODO: Later, consider implementing a live update for table structure changes.
@@ -63,6 +64,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
event_handler.command_mode,
&event_handler.command_message,
&app_state,
&intro_state,
);
})?;
@@ -80,6 +82,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
&mut app_state,
total_count,
&mut current_position,
&mut intro_state,
).await?;
app_state.current_position = current_position;