status line finished

This commit is contained in:
filipriec
2025-02-16 23:17:57 +01:00
parent f81befccf3
commit cc5f7398d0
3 changed files with 49 additions and 3 deletions

View File

@@ -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], &current_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 {