switched stuff in the state.rs

This commit is contained in:
filipriec
2025-03-21 22:46:50 +01:00
parent 44c5963c71
commit 1b0aaa55c9
5 changed files with 121 additions and 14 deletions

View File

@@ -9,7 +9,7 @@ use crate::config::colors::Theme;
use ratatui::layout::{Constraint, Direction, Layout};
use ratatui::Frame;
use super::form::FormState;
use crate::state::state::UiState;
use crate::state::state::AppState;
pub fn render_ui(
f: &mut Frame,
@@ -22,7 +22,7 @@ pub fn render_ui(
command_input: &str,
command_mode: bool,
command_message: &str,
ui_state: &UiState,
app_state: &AppState,
) {
render_background(f, f.area(), theme);
@@ -36,7 +36,7 @@ pub fn render_ui(
.split(f.area());
let main_content_area = root[0];
let (sidebar_area, form_area) = calculate_sidebar_layout(ui_state.show_sidebar, main_content_area);
let (sidebar_area, form_area) = calculate_sidebar_layout(app_state.ui.show_sidebar, main_content_area);
let available_width = form_area.width;
let form_constraint = if available_width >= 80 {
@@ -69,7 +69,7 @@ pub fn render_ui(
);
if let Some(sidebar_rect) = sidebar_area {
sidebar::render_sidebar(f, sidebar_rect, theme, &ui_state.profile_tree);
sidebar::render_sidebar(f, sidebar_rect, theme, &app_state.profile_tree);
}
render_status_line(f, root[1], current_dir, theme, is_edit_mode);

View File

@@ -38,7 +38,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
let mut event_handler = EventHandler::new();
let event_reader = EventReader::new();
let mut app_state = AppState::new()?;
app_state.ui.profile_tree = profile_tree;
app_state.profile_tree = profile_tree;
// Fetch the total count of Adresar entries
let total_count = grpc_client.get_adresar_count().await?;
@@ -62,7 +62,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
&event_handler.command_input,
event_handler.command_mode,
&event_handler.command_message,
&app_state.ui,
&app_state,
);
})?;