complete redesign
This commit is contained in:
53
client/src/ui/handlers/render.rs
Normal file
53
client/src/ui/handlers/render.rs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user