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::components::{render_command_line, render_preview_card, render_status_line};
|
||||||
use crate::config::colors::Theme;
|
use crate::config::colors::Theme;
|
||||||
@@ -20,6 +20,7 @@ pub fn render_ui(
|
|||||||
command_message: &str,
|
command_message: &str,
|
||||||
ui_state: &UiState,
|
ui_state: &UiState,
|
||||||
) {
|
) {
|
||||||
|
// Root layout - vertical split for main content, status, and command line
|
||||||
let root = Layout::default()
|
let root = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
.constraints([
|
.constraints([
|
||||||
@@ -29,31 +30,72 @@ pub fn render_ui(
|
|||||||
])
|
])
|
||||||
.split(f.area());
|
.split(f.area());
|
||||||
|
|
||||||
// Main content area
|
// Main content area layout
|
||||||
let main_chunks = Layout::default()
|
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)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([Constraint::Percentage(60), Constraint::Percentage(40)])
|
.constraints([
|
||||||
.split(root[0]);
|
Constraint::Percentage(60),
|
||||||
|
Constraint::Percentage(40),
|
||||||
|
])
|
||||||
|
.split(content_area);
|
||||||
|
|
||||||
// Left panel - Form
|
// Render form in the left content area
|
||||||
form_state.render(f, main_chunks[0], theme, is_edit_mode, total_count, current_position);
|
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();
|
let preview_values: Vec<&String> = form_state.values.iter().collect();
|
||||||
render_preview_card(
|
render_preview_card(
|
||||||
f,
|
f,
|
||||||
main_chunks[1],
|
content_chunks[1],
|
||||||
&preview_values, // Pass dynamic values as &[&String]
|
&preview_values,
|
||||||
&theme,
|
theme,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ui_state.show_sidebar {
|
// Render sidebar if enabled
|
||||||
crate::components::handlers::sidebar::render_sidebar(f, main_chunks[0], theme);
|
if let Some(sidebar_rect) = sidebar_area {
|
||||||
|
crate::components::handlers::sidebar::render_sidebar(f, sidebar_rect, theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status line
|
// 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
|
// 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