small error to fix
This commit is contained in:
@@ -4,7 +4,7 @@ use crossterm::event::{KeyEvent};
|
|||||||
use crate::config::binds::config::Config;
|
use crate::config::binds::config::Config;
|
||||||
use crate::tui::terminal::grpc_client::GrpcClient;
|
use crate::tui::terminal::grpc_client::GrpcClient;
|
||||||
use crate::tui::terminal::core::TerminalCore;
|
use crate::tui::terminal::core::TerminalCore;
|
||||||
use crate::tui::terminal::commands::CommandHandler;
|
use crate::tui::controls::commands::CommandHandler;
|
||||||
use crate::ui::handlers::form::FormState;
|
use crate::ui::handlers::form::FormState;
|
||||||
use crate::state::state::AppState;
|
use crate::state::state::AppState;
|
||||||
use common::proto::multieko2::adresar::{PostAdresarRequest, PutAdresarRequest};
|
use common::proto::multieko2::adresar::{PostAdresarRequest, PutAdresarRequest};
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use crossterm::cursor::SetCursorStyle;
|
|||||||
use crate::tui::terminal::{
|
use crate::tui::terminal::{
|
||||||
core::TerminalCore,
|
core::TerminalCore,
|
||||||
grpc_client::GrpcClient,
|
grpc_client::GrpcClient,
|
||||||
commands::CommandHandler,
|
|
||||||
};
|
};
|
||||||
|
use crate::tui::controls::commands::CommandHandler;
|
||||||
use crate::config::binds::config::Config;
|
use crate::config::binds::config::Config;
|
||||||
use crate::ui::handlers::form::FormState;
|
use crate::ui::handlers::form::FormState;
|
||||||
use crate::ui::handlers::rat_state::UiStateHandler;
|
use crate::ui::handlers::rat_state::UiStateHandler;
|
||||||
|
|||||||
5
client/src/tui/controls.rs
Normal file
5
client/src/tui/controls.rs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// src/tui/controls.rs
|
||||||
|
|
||||||
|
pub mod commands;
|
||||||
|
|
||||||
|
pub use commands::*;
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// src/tui/terminal/commands.rs
|
// src/tui/controls/commands.rs
|
||||||
|
|
||||||
use crate::tui::terminal::core::TerminalCore;
|
use crate::tui::terminal::core::TerminalCore;
|
||||||
|
|
||||||
pub struct CommandHandler {
|
pub struct CommandHandler {
|
||||||
@@ -24,7 +23,10 @@ impl CommandHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_quit(&self, terminal: &mut TerminalCore) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
async fn handle_quit(
|
||||||
|
&self,
|
||||||
|
terminal: &mut TerminalCore,
|
||||||
|
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
||||||
if self.is_saved {
|
if self.is_saved {
|
||||||
terminal.cleanup()?;
|
terminal.cleanup()?;
|
||||||
Ok((true, "Exiting.".into()))
|
Ok((true, "Exiting.".into()))
|
||||||
@@ -33,12 +35,18 @@ impl CommandHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_force_quit(&self, terminal: &mut TerminalCore) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
async fn handle_force_quit(
|
||||||
|
&self,
|
||||||
|
terminal: &mut TerminalCore,
|
||||||
|
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
||||||
terminal.cleanup()?;
|
terminal.cleanup()?;
|
||||||
Ok((true, "Force exiting without saving.".into()))
|
Ok((true, "Force exiting without saving.".into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_save_quit(&mut self, terminal: &mut TerminalCore) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
async fn handle_save_quit(
|
||||||
|
&mut self,
|
||||||
|
terminal: &mut TerminalCore,
|
||||||
|
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
||||||
self.is_saved = true;
|
self.is_saved = true;
|
||||||
terminal.cleanup()?;
|
terminal.cleanup()?;
|
||||||
Ok((true, "State saved. Exiting.".into()))
|
Ok((true, "State saved. Exiting.".into()))
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
// src/tui/mod.rs
|
// src/tui/mod.rs
|
||||||
pub mod terminal;
|
pub mod terminal;
|
||||||
|
pub mod controls;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
pub mod core;
|
pub mod core;
|
||||||
pub mod grpc_client;
|
pub mod grpc_client;
|
||||||
pub mod commands;
|
|
||||||
pub mod event_reader;
|
pub mod event_reader;
|
||||||
|
|
||||||
pub use core::TerminalCore;
|
pub use core::TerminalCore;
|
||||||
pub use grpc_client::GrpcClient;
|
pub use grpc_client::GrpcClient;
|
||||||
pub use commands::CommandHandler;
|
|
||||||
pub use event_reader::EventReader;
|
pub use event_reader::EventReader;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use crate::tui::terminal::TerminalCore;
|
use crate::tui::terminal::TerminalCore;
|
||||||
use crate::tui::terminal::GrpcClient;
|
use crate::tui::terminal::GrpcClient;
|
||||||
use crate::tui::terminal::CommandHandler;
|
use crate::tui::controls::CommandHandler;
|
||||||
use crate::tui::terminal::EventReader;
|
use crate::tui::terminal::EventReader;
|
||||||
use crate::config::colors::themes::Theme;
|
use crate::config::colors::themes::Theme;
|
||||||
use crate::config::binds::config::Config;
|
use crate::config::binds::config::Config;
|
||||||
|
|||||||
Reference in New Issue
Block a user