sidebar takes now alot of space
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// src/client/ui/handlers/render.rs
|
||||
// src/ui/handlers/render.rs
|
||||
|
||||
use crate::components::{render_command_line, render_preview_card, render_status_line};
|
||||
use crate::config::colors::Theme;
|
||||
@@ -20,6 +20,7 @@ pub fn render_ui(
|
||||
command_message: &str,
|
||||
ui_state: &UiState,
|
||||
) {
|
||||
// Root layout - vertical split for main content, status, and command line
|
||||
let root = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([
|
||||
@@ -29,31 +30,72 @@ pub fn render_ui(
|
||||
])
|
||||
.split(f.area());
|
||||
|
||||
// Main content area
|
||||
let main_chunks = Layout::default()
|
||||
// Main content area layout
|
||||
let main_content_area = root[0];
|
||||
|
||||
// Split into sidebar + content or just content
|
||||
let (sidebar_area, content_area) = if ui_state.show_sidebar {
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([
|
||||
Constraint::Min(10), // Sidebar minimum width
|
||||
Constraint::Fill(1), // Remaining space for form/preview
|
||||
])
|
||||
.split(main_content_area);
|
||||
(Some(chunks[0]), chunks[1])
|
||||
} else {
|
||||
(None, main_content_area)
|
||||
};
|
||||
|
||||
// Split content area into form and preview
|
||||
let content_chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([Constraint::Percentage(60), Constraint::Percentage(40)])
|
||||
.split(root[0]);
|
||||
.constraints([
|
||||
Constraint::Percentage(60),
|
||||
Constraint::Percentage(40),
|
||||
])
|
||||
.split(content_area);
|
||||
|
||||
// Left panel - Form
|
||||
form_state.render(f, main_chunks[0], theme, is_edit_mode, total_count, current_position);
|
||||
// Render form in the left content area
|
||||
form_state.render(
|
||||
f,
|
||||
content_chunks[0],
|
||||
theme,
|
||||
is_edit_mode,
|
||||
total_count,
|
||||
current_position,
|
||||
);
|
||||
|
||||
// Right panel - Preview Card
|
||||
// Render preview card in the right content area
|
||||
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,
|
||||
content_chunks[1],
|
||||
&preview_values,
|
||||
theme,
|
||||
);
|
||||
|
||||
if ui_state.show_sidebar {
|
||||
crate::components::handlers::sidebar::render_sidebar(f, main_chunks[0], theme);
|
||||
// Render sidebar if enabled
|
||||
if let Some(sidebar_rect) = sidebar_area {
|
||||
crate::components::handlers::sidebar::render_sidebar(f, sidebar_rect, theme);
|
||||
}
|
||||
|
||||
// Status line
|
||||
render_status_line(f, root[1], current_dir, theme, is_edit_mode);
|
||||
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);
|
||||
render_command_line(
|
||||
f,
|
||||
root[2],
|
||||
command_input,
|
||||
command_mode,
|
||||
theme,
|
||||
command_message,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user