diff --git a/client/src/components/handlers.rs b/client/src/components/handlers.rs index d0095f5..300bde9 100644 --- a/client/src/components/handlers.rs +++ b/client/src/components/handlers.rs @@ -1,6 +1,5 @@ // src/components/handlers.rs pub mod form; -pub mod preview_card; pub mod command_line; pub mod status_line; pub mod canvas; @@ -8,7 +7,6 @@ pub mod sidebar; pub use command_line::render_command_line; pub use form::*; -pub use preview_card::render_preview_card; pub use status_line::render_status_line; pub use canvas::*; pub use sidebar::*; diff --git a/client/src/components/handlers/preview_card.rs b/client/src/components/handlers/preview_card.rs deleted file mode 100644 index 5f0000b..0000000 --- a/client/src/components/handlers/preview_card.rs +++ /dev/null @@ -1,33 +0,0 @@ -// src/client/components/preview_card.rs -use ratatui::{ - widgets::{Block, Borders, List, ListItem}, - layout::Rect, - style::Style, - text::Text, - Frame, -}; -use crate::config::colors::Theme; - -pub fn render_preview_card(f: &mut Frame, area: Rect, fields: &[&String], theme: &Theme) { - let card = Block::default() - .borders(Borders::ALL) - .border_style(Style::default().fg(theme.border)) - .title(" Preview Card ") - .style(Style::default().bg(theme.bg).fg(theme.fg)); - - let items = vec![ - ListItem::new(Text::from(format!("Firma: {}", fields[0]))), - ListItem::new(Text::from(format!("Ulica: {}", fields[1]))), - ListItem::new(Text::from(format!("Mesto: {}", fields[2]))), - ListItem::new(Text::from(format!("PSC: {}", fields[3]))), - ListItem::new(Text::from(format!("ICO: {}", fields[4]))), - ListItem::new(Text::from(format!("Kontakt: {}", fields[5]))), - ListItem::new(Text::from(format!("Telefon: {}", fields[6]))), - ]; - - let list = List::new(items) - .block(card) - .style(Style::default().bg(theme.bg).fg(theme.fg)); - - f.render_widget(list, area); -} diff --git a/client/src/ui/handlers/render.rs b/client/src/ui/handlers/render.rs index 2d8d401..b774a5a 100644 --- a/client/src/ui/handlers/render.rs +++ b/client/src/ui/handlers/render.rs @@ -1,6 +1,6 @@ // src/ui/handlers/render.rs -use crate::components::{render_command_line, render_preview_card, render_status_line}; +use crate::components::{render_command_line, render_status_line}; use crate::config::colors::Theme; use ratatui::layout::{Constraint, Direction, Layout}; use ratatui::Frame; @@ -66,15 +66,6 @@ pub fn render_ui( current_position, ); - // Render preview card in the right content area - let preview_values: Vec<&String> = form_state.values.iter().collect(); - render_preview_card( - f, - content_chunks[1], - &preview_values, - theme, - ); - // Render sidebar if enabled if let Some(sidebar_rect) = sidebar_area { crate::components::handlers::sidebar::render_sidebar(f, sidebar_rect, theme); diff --git a/client/src/ui/handlers/ui.rs b/client/src/ui/handlers/ui.rs index 0a21bb2..2780885 100644 --- a/client/src/ui/handlers/ui.rs +++ b/client/src/ui/handlers/ui.rs @@ -13,14 +13,14 @@ use crate::state::state::AppState; pub async fn run_ui() -> Result<(), Box> { let config = Config::load()?; - let mut terminal = TerminalCore::new()?; // Remove .await + 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); // Fetch table structure at startup (one-time) // TODO: Later, consider implementing a live update for table structure changes. - let table_structure = grpc_client.get_table_structure().await?; // Changed + let table_structure = grpc_client.get_table_structure().await?; // Extract the column names from the response let column_names: Vec = table_structure