restored functionality
This commit is contained in:
@@ -53,14 +53,29 @@ pub fn render_ui(
|
|||||||
sidebar::render_sidebar(f, sidebar_rect, theme, &app_state.profile_tree);
|
sidebar::render_sidebar(f, sidebar_rect, theme, &app_state.profile_tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
let form_constraint = Layout::default()
|
// This change makes the form stay stationary when toggling sidebar
|
||||||
|
let available_width = form_area.width;
|
||||||
|
let form_constraint = if available_width >= 80 {
|
||||||
|
// Use main_content_area for centering when enough space
|
||||||
|
Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([
|
.constraints([
|
||||||
Constraint::Min(0),
|
Constraint::Min(0),
|
||||||
Constraint::Length(80.min(form_area.width)),
|
Constraint::Length(80),
|
||||||
Constraint::Min(0),
|
Constraint::Min(0),
|
||||||
])
|
])
|
||||||
.split(form_area)[1];
|
.split(main_content_area)[1]
|
||||||
|
} else {
|
||||||
|
// Use form_area (post sidebar) when limited space
|
||||||
|
Layout::default()
|
||||||
|
.direction(Direction::Horizontal)
|
||||||
|
.constraints([
|
||||||
|
Constraint::Min(0),
|
||||||
|
Constraint::Length(80.min(available_width)),
|
||||||
|
Constraint::Min(0),
|
||||||
|
])
|
||||||
|
.split(form_area)[1]
|
||||||
|
};
|
||||||
|
|
||||||
// Convert fields to &[&str] and values to &[&String]
|
// Convert fields to &[&str] and values to &[&String]
|
||||||
let fields: Vec<&str> = form_state.fields.iter().map(|s| s.as_str()).collect();
|
let fields: Vec<&str> = form_state.fields.iter().map(|s| s.as_str()).collect();
|
||||||
|
|||||||
Reference in New Issue
Block a user