complete redesign

This commit is contained in:
filipriec
2025-02-22 23:23:07 +01:00
parent d9e812ac1b
commit 5a81a37678
83 changed files with 3578 additions and 152 deletions

View File

@@ -0,0 +1,53 @@
// src/client/ui/handlers/render.rs
use crate::client::components1::{render_command_line, render_preview_card, render_status_line};
use crate::client::colors::Theme;
use ratatui::layout::{Constraint, Direction, Layout};
use ratatui::Frame;
use super::form::FormState;
pub fn render_ui(
f: &mut Frame,
form_state: &mut FormState,
theme: &Theme,
is_edit_mode: bool,
total_count: u64,
current_position: u64,
current_dir: &str,
command_input: &str,
command_mode: bool,
command_message: &str,
) {
let root = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Min(10), // Main content area
Constraint::Length(1), // Status line
Constraint::Length(1), // Command line
])
.split(f.area());
// Main content area
let main_chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints([Constraint::Percentage(60), Constraint::Percentage(40)])
.split(root[0]);
// Left panel - Form
form_state.render(f, main_chunks[0], theme, is_edit_mode, total_count, current_position);
// Right panel - Preview Card
let preview_values: Vec<&String> = form_state.values.iter().collect();
render_preview_card(
f,
main_chunks[1],
&preview_values, // Pass dynamic values as &[&String]
&theme,
);
// Status line
render_status_line(f, root[1], current_dir, theme, is_edit_mode);
// Command line
render_command_line(f, root[2], command_input, command_mode, theme, command_message);
}