status line finished
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
// src/client/ui.rs
|
||||
use crossterm::event::{Event, KeyCode, KeyModifiers};
|
||||
use crate::client::terminal::AppTerminal;
|
||||
use crate::client::components::{render_command_line, render_form, render_preview_card};
|
||||
use crate::client::components::{render_command_line, render_form, render_preview_card, render_status_line}; // Add `render_status_line`
|
||||
use crate::client::colors::Theme;
|
||||
use ratatui::layout::{Constraint, Direction, Layout, Rect};
|
||||
use std::env;
|
||||
|
||||
pub fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut app_terminal = AppTerminal::new()?;
|
||||
@@ -34,11 +35,20 @@ pub fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
"Ucet", "Skladm", "ICO", "Kontakt", "Telefon", "Skladu", "Fax",
|
||||
];
|
||||
|
||||
// Get the current directory
|
||||
let current_dir = env::current_dir()?
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
loop {
|
||||
app_terminal.draw(|f| {
|
||||
let root = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([Constraint::Min(10), Constraint::Length(1)])
|
||||
.constraints([
|
||||
Constraint::Min(10), // Main content area
|
||||
Constraint::Length(1), // Status line
|
||||
Constraint::Length(1), // Command line
|
||||
])
|
||||
.split(f.area());
|
||||
|
||||
// Main content area
|
||||
@@ -70,10 +80,14 @@ pub fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
&theme,
|
||||
);
|
||||
|
||||
// Status line
|
||||
render_status_line(f, root[1], ¤t_dir, &theme);
|
||||
|
||||
// Command line
|
||||
render_command_line(f, root[1], &command_input, command_mode, &theme);
|
||||
render_command_line(f, root[2], &command_input, command_mode, &theme);
|
||||
})?;
|
||||
|
||||
// Event handling (unchanged)
|
||||
if let Event::Key(key) = app_terminal.read_event()? {
|
||||
if command_mode {
|
||||
match key.code {
|
||||
|
||||
Reference in New Issue
Block a user