split temp client
This commit is contained in:
@@ -5,7 +5,7 @@ use ratatui::{
|
||||
layout::Rect,
|
||||
Frame,
|
||||
};
|
||||
use crate::client::colors::Theme;
|
||||
use crate::colors::Theme;
|
||||
|
||||
pub fn render_command_line(f: &mut Frame, area: Rect, input: &str, active: bool, theme: &Theme, message: &str) {
|
||||
let prompt = if active {
|
||||
|
||||
@@ -6,7 +6,7 @@ use ratatui::{
|
||||
text::{Line, Span},
|
||||
Frame,
|
||||
};
|
||||
use crate::client::colors::Theme;
|
||||
use crate::colors::Theme;
|
||||
use crate::client::ui::form::FormState;
|
||||
|
||||
pub fn render_form(
|
||||
|
||||
@@ -6,7 +6,7 @@ use ratatui::{
|
||||
text::Text,
|
||||
Frame,
|
||||
};
|
||||
use crate::client::colors::Theme;
|
||||
use crate::colors::Theme;
|
||||
|
||||
pub fn render_preview_card(f: &mut Frame, area: Rect, fields: &[&String], theme: &Theme) {
|
||||
let card = Block::default()
|
||||
|
||||
@@ -6,7 +6,7 @@ use ratatui::{
|
||||
Frame,
|
||||
text::{Line, Span},
|
||||
};
|
||||
use crate::client::colors::Theme;
|
||||
use crate::colors::Theme;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn render_status_line(
|
||||
|
||||
30
client/src/lib.rs
Normal file
30
client/src/lib.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
// client/src/lib.rs
|
||||
pub mod config;
|
||||
pub mod terminal;
|
||||
pub mod ui;
|
||||
pub mod colors;
|
||||
pub mod components1;
|
||||
|
||||
pub use ui::run_ui;
|
||||
|
||||
use ratatui::{backend::CrosstermBackend, Terminal};
|
||||
use crossterm::event::{self, Event, KeyCode};
|
||||
|
||||
pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut terminal = Terminal::new(CrosstermBackend::new(std::io::stdout()))?;
|
||||
|
||||
loop {
|
||||
terminal.draw(|f| {
|
||||
// Your UI rendering logic here
|
||||
ui::draw(f);
|
||||
})?;
|
||||
|
||||
if let Event::Key(key) = event::read()? {
|
||||
if key.code == KeyCode::Char('q') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,3 +1,10 @@
|
||||
fn main() {
|
||||
println!("Client is running!");
|
||||
// client/src/main.rs
|
||||
use client::run_ui;
|
||||
use dotenvy::dotenv;
|
||||
use std::error::Error;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
dotenv().ok();
|
||||
run_ui().await
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crossterm::event::{Event, KeyCode, KeyModifiers};
|
||||
use crossterm::cursor::{SetCursorStyle};
|
||||
use crate::client::terminal::AppTerminal;
|
||||
use crate::terminal::AppTerminal;
|
||||
use crate::client::config::Config;
|
||||
use common::proto::multieko2::adresar::{PostAdresarRequest, PutAdresarRequest};
|
||||
use super::form::FormState;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/client/ui/handlers/form.rs
|
||||
|
||||
use crate::client::components1::render_form;
|
||||
use crate::client::colors::Theme;
|
||||
use crate::colors::Theme;
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::Frame;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/client/ui/handlers/render.rs
|
||||
|
||||
use crate::client::components1::{render_command_line, render_preview_card, render_status_line};
|
||||
use crate::client::colors::Theme;
|
||||
use crate::colors::Theme;
|
||||
use ratatui::layout::{Constraint, Direction, Layout};
|
||||
use ratatui::Frame;
|
||||
use super::form::FormState;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/client/ui/handlers/ui.rs
|
||||
|
||||
use crate::client::terminal::AppTerminal;
|
||||
use crate::client::colors::Theme;
|
||||
use crate::terminal::AppTerminal;
|
||||
use crate::colors::Theme;
|
||||
use crate::client::config::Config;
|
||||
use crate::client::ui::handlers::{event::EventHandler, form::FormState, state::AppState, render::render_ui};
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// src/client/ui/mod.rs
|
||||
pub mod models;
|
||||
pub mod handlers;
|
||||
pub mod state;
|
||||
|
||||
pub use handlers::*;
|
||||
|
||||
Reference in New Issue
Block a user