centered form
This commit is contained in:
@@ -4,9 +4,11 @@ pub mod command_line;
|
|||||||
pub mod status_line;
|
pub mod status_line;
|
||||||
pub mod canvas;
|
pub mod canvas;
|
||||||
pub mod sidebar;
|
pub mod sidebar;
|
||||||
|
pub mod background;
|
||||||
|
|
||||||
pub use command_line::render_command_line;
|
pub use command_line::render_command_line;
|
||||||
pub use form::*;
|
pub use form::*;
|
||||||
pub use status_line::render_status_line;
|
pub use status_line::render_status_line;
|
||||||
pub use canvas::*;
|
pub use canvas::*;
|
||||||
pub use sidebar::*;
|
pub use sidebar::*;
|
||||||
|
pub use background::*;
|
||||||
|
|||||||
15
client/src/components/handlers/background.rs
Normal file
15
client/src/components/handlers/background.rs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// src/components/handlers/background.rs
|
||||||
|
use ratatui::{
|
||||||
|
widgets::{Block},
|
||||||
|
layout::Rect,
|
||||||
|
style::Style,
|
||||||
|
Frame,
|
||||||
|
};
|
||||||
|
use crate::config::colors::Theme;
|
||||||
|
|
||||||
|
pub fn render_background(f: &mut Frame, area: Rect, theme: &Theme) {
|
||||||
|
let background = Block::default()
|
||||||
|
.style(Style::default().bg(theme.bg));
|
||||||
|
|
||||||
|
f.render_widget(background, area);
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// src/ui/handlers/render.rs
|
// src/ui/handlers/render.rs
|
||||||
|
|
||||||
use crate::components::{render_command_line, render_status_line};
|
use crate::components::{render_background, render_command_line, render_status_line};
|
||||||
use crate::config::colors::Theme;
|
use crate::config::colors::Theme;
|
||||||
use ratatui::layout::{Constraint, Direction, Layout};
|
use ratatui::layout::{Constraint, Direction, Layout};
|
||||||
use ratatui::Frame;
|
use ratatui::Frame;
|
||||||
@@ -20,6 +20,8 @@ pub fn render_ui(
|
|||||||
command_message: &str,
|
command_message: &str,
|
||||||
ui_state: &UiState,
|
ui_state: &UiState,
|
||||||
) {
|
) {
|
||||||
|
render_background(f, f.size(), theme);
|
||||||
|
|
||||||
// Root layout - vertical split for main content, status, and command line
|
// 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)
|
||||||
@@ -47,19 +49,20 @@ pub fn render_ui(
|
|||||||
(None, main_content_area)
|
(None, main_content_area)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Split content area into form and preview
|
// Create centered form layout
|
||||||
let content_chunks = Layout::default()
|
let form_layout = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([
|
.constraints([
|
||||||
Constraint::Percentage(60),
|
Constraint::Min(0),
|
||||||
Constraint::Percentage(40),
|
Constraint::Max(80),
|
||||||
|
Constraint::Min(0),
|
||||||
])
|
])
|
||||||
.split(content_area);
|
.split(content_area);
|
||||||
|
|
||||||
// Render form in the left content area
|
// Render form in the left content area
|
||||||
form_state.render(
|
form_state.render(
|
||||||
f,
|
f,
|
||||||
content_chunks[0],
|
form_layout[1],
|
||||||
theme,
|
theme,
|
||||||
is_edit_mode,
|
is_edit_mode,
|
||||||
total_count,
|
total_count,
|
||||||
|
|||||||
Reference in New Issue
Block a user