project structure redesign
This commit is contained in:
49
client/docs/project_structure.tst
Normal file
49
client/docs/project_structure.tst
Normal file
@@ -0,0 +1,49 @@
|
||||
client/
|
||||
├── Cargo.toml
|
||||
├── config.toml
|
||||
└── src/
|
||||
├── main.rs # Entry point with minimal code
|
||||
├── lib.rs # Core exports
|
||||
├── app.rs # Application lifecycle and main loop
|
||||
│
|
||||
├── ui/ # UI components and rendering
|
||||
│ ├── mod.rs
|
||||
│ ├── theme.rs # Theme definitions (from colors.rs)
|
||||
│ ├── layout.rs # Layout definitions
|
||||
│ ├── render.rs # Main render coordinator
|
||||
│ └── components/ # UI components
|
||||
│ ├── mod.rs
|
||||
│ ├── command_line.rs
|
||||
│ ├── form.rs
|
||||
│ ├── preview_card.rs
|
||||
│ └── status_line.rs
|
||||
│
|
||||
├── input/ # Input handling
|
||||
│ ├── mod.rs
|
||||
│ ├── handler.rs # Main input handler (lightweight coordinator)
|
||||
│ ├── commands.rs # Command processing
|
||||
│ ├── navigation.rs # Navigation between entries and fields
|
||||
│ └── edit.rs # Edit mode logic
|
||||
│
|
||||
├── editor/ # Text editing functionality
|
||||
│ ├── mod.rs
|
||||
│ ├── cursor.rs # Cursor movement
|
||||
│ └── text.rs # Text manipulation (word movements, etc.)
|
||||
│
|
||||
├── state/ # Application state
|
||||
│ ├── mod.rs
|
||||
│ ├── app_state.rs # Main application state
|
||||
│ └── form_state.rs # Form state
|
||||
│
|
||||
├── model/ # Data models
|
||||
│ ├── mod.rs
|
||||
│ └── entry.rs # Entry model with business logic
|
||||
│
|
||||
├── service/ # External services
|
||||
│ ├── mod.rs
|
||||
│ ├── terminal.rs # Terminal setup and management
|
||||
│ └── grpc.rs # gRPC client (extracted from terminal.rs)
|
||||
│
|
||||
└── config/ # Configuration
|
||||
├── mod.rs
|
||||
└── keybindings.rs # Keybinding definitions and matching
|
||||
@@ -5,7 +5,7 @@ use ratatui::{
|
||||
layout::Rect,
|
||||
Frame,
|
||||
};
|
||||
use crate::colors::Theme;
|
||||
use crate::config::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::colors::Theme;
|
||||
use crate::config::colors::Theme;
|
||||
use crate::ui::form::FormState;
|
||||
|
||||
pub fn render_form(
|
||||
|
||||
@@ -6,7 +6,7 @@ use ratatui::{
|
||||
text::Text,
|
||||
Frame,
|
||||
};
|
||||
use crate::colors::Theme;
|
||||
use crate::config::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::colors::Theme;
|
||||
use crate::config::colors::Theme;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn render_status_line(
|
||||
|
||||
3
client/src/config/mod.rs
Normal file
3
client/src/config/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
// src/config/mod.rs
|
||||
pub mod colors;
|
||||
pub mod config;
|
||||
@@ -1,8 +1,7 @@
|
||||
// client/src/lib.rs
|
||||
pub mod config;
|
||||
pub mod terminal;
|
||||
pub mod ui;
|
||||
pub mod colors;
|
||||
pub mod tui;
|
||||
pub mod config;
|
||||
pub mod components1;
|
||||
|
||||
pub use ui::run_ui;
|
||||
|
||||
2
client/src/tui/mod.rs
Normal file
2
client/src/tui/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
// src/tui/mod.rs
|
||||
pub mod terminal;
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use crossterm::event::{Event, KeyCode, KeyModifiers};
|
||||
use crossterm::cursor::{SetCursorStyle};
|
||||
use crate::terminal::AppTerminal;
|
||||
use crate::config::Config;
|
||||
use crate::tui::terminal::AppTerminal;
|
||||
use crate::config::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::components1::render_form;
|
||||
use crate::colors::Theme;
|
||||
use crate::config::colors::Theme;
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::Frame;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/client/ui/handlers/render.rs
|
||||
|
||||
use crate::components1::{render_command_line, render_preview_card, render_status_line};
|
||||
use crate::colors::Theme;
|
||||
use crate::config::colors::Theme;
|
||||
use ratatui::layout::{Constraint, Direction, Layout};
|
||||
use ratatui::Frame;
|
||||
use super::form::FormState;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// src/client/ui/handlers/ui.rs
|
||||
|
||||
use crate::terminal::AppTerminal;
|
||||
use crate::colors::Theme;
|
||||
use crate::config::Config;
|
||||
use crate::tui::terminal::AppTerminal;
|
||||
use crate::config::colors::Theme;
|
||||
use crate::config::config::Config;
|
||||
use crate::ui::handlers::{event::EventHandler, form::FormState, state::AppState, render::render_ui};
|
||||
|
||||
pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
Reference in New Issue
Block a user