This commit is contained in:
filipriec
2025-04-18 21:11:49 +02:00
parent ef3ecfc73f
commit a0467d17a8
19 changed files with 18 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
use crate::state::pages::add_table::AddTableState; use crate::state::pages::add_table::AddTableState;
use crate::state::pages::canvas_state::CanvasState; // Use trait use crate::state::pages::canvas_state::CanvasState; // Use trait
use crossterm::event::{KeyCode, KeyEvent}; use crossterm::event::{KeyCode, KeyEvent};
use anyhow::{Context, Result}; use anyhow::Result;
#[derive(PartialEq)] #[derive(PartialEq)]
enum CharType { enum CharType {

View File

@@ -7,7 +7,7 @@ use crate::state::pages::auth::RegisterState;
use crate::tui::functions::common::form::{revert, save}; use crate::tui::functions::common::form::{revert, save};
use crossterm::event::{KeyCode, KeyEvent}; use crossterm::event::{KeyCode, KeyEvent};
use std::any::Any; use std::any::Any;
use anyhow::{Context, Result}; use anyhow::Result;
pub async fn execute_common_action<S: CanvasState + Any>( pub async fn execute_common_action<S: CanvasState + Any>(
action: &str, action: &str,

View File

@@ -8,7 +8,7 @@ use crate::tui::functions::common::form::SaveOutcome;
use crate::modes::handlers::event::EventOutcome; use crate::modes::handlers::event::EventOutcome;
use crossterm::event::{KeyCode, KeyEvent}; use crossterm::event::{KeyCode, KeyEvent};
use std::any::Any; use std::any::Any;
use anyhow::{Context, Result}; use anyhow::Result;
pub async fn execute_common_action<S: CanvasState + Any>( pub async fn execute_common_action<S: CanvasState + Any>(
action: &str, action: &str,

View File

@@ -3,7 +3,7 @@
use crate::config::binds::key_sequences::KeySequenceTracker; use crate::config::binds::key_sequences::KeySequenceTracker;
use crate::state::pages::canvas_state::CanvasState; use crate::state::pages::canvas_state::CanvasState;
use crate::state::app::state::AppState; use crate::state::app::state::AppState;
use anyhow::{Context, Result}; use anyhow::Result;
#[derive(PartialEq)] #[derive(PartialEq)]
enum CharType { enum CharType {

View File

@@ -1,7 +1,7 @@
// client/src/main.rs // client/src/main.rs
use client::run_ui; use client::run_ui;
use dotenvy::dotenv; use dotenvy::dotenv;
use anyhow::{anyhow, Result}; use anyhow::Result;
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {

View File

@@ -10,7 +10,7 @@ use crate::state::pages::add_table::AddTableState;
use crate::state::app::state::AppState; use crate::state::app::state::AppState;
use crate::functions::modes::read_only::{auth_ro, form_ro, add_table_ro}; use crate::functions::modes::read_only::{auth_ro, form_ro, add_table_ro};
use crossterm::event::KeyEvent; use crossterm::event::KeyEvent;
use anyhow::{Context, Result}; use anyhow::Result;
pub async fn handle_read_only_event( pub async fn handle_read_only_event(
app_state: &mut AppState, app_state: &mut AppState,

View File

@@ -10,7 +10,7 @@ use crate::tui::terminal::core::TerminalCore;
use crate::tui::functions::common::form::{save, revert}; use crate::tui::functions::common::form::{save, revert};
use crate::modes::handlers::event::EventOutcome; use crate::modes::handlers::event::EventOutcome;
use crate::tui::functions::common::form::SaveOutcome; use crate::tui::functions::common::form::SaveOutcome;
use anyhow::{Context, Result}; use anyhow::Result;
pub async fn handle_command_event( pub async fn handle_command_event(
key: KeyEvent, key: KeyEvent,

View File

@@ -3,7 +3,7 @@ use crate::tui::terminal::core::TerminalCore;
use crate::state::app::state::AppState; use crate::state::app::state::AppState;
use crate::state::pages::{form::FormState, auth::LoginState, auth::RegisterState}; use crate::state::pages::{form::FormState, auth::LoginState, auth::RegisterState};
use crate::state::pages::canvas_state::CanvasState; use crate::state::pages::canvas_state::CanvasState;
use anyhow::{Context, Result}; use anyhow::Result;
pub struct CommandHandler; pub struct CommandHandler;

View File

@@ -10,7 +10,7 @@ use crate::state::pages::admin::AdminState;
use crate::modes::handlers::event::EventOutcome; use crate::modes::handlers::event::EventOutcome;
use crate::tui::functions::common::{login, register}; use crate::tui::functions::common::{login, register};
use crate::tui::functions::common::add_table::handle_delete_selected_columns; use crate::tui::functions::common::add_table::handle_delete_selected_columns;
use anyhow::{Context, Result}; use anyhow::Result;
/// Handles key events specifically when a dialog is active. /// Handles key events specifically when a dialog is active.
/// Returns Some(Result<EventOutcome, Error>) if the event was handled (consumed), /// Returns Some(Result<EventOutcome, Error>) if the event was handled (consumed),

View File

@@ -11,7 +11,7 @@ use crate::state::pages::admin::AdminState;
use crate::state::pages::canvas_state::CanvasState; use crate::state::pages::canvas_state::CanvasState;
use crate::ui::handlers::context::UiContext; use crate::ui::handlers::context::UiContext;
use crate::modes::handlers::event::EventOutcome; use crate::modes::handlers::event::EventOutcome;
use anyhow::{Context, Result}; use anyhow::Result;
pub async fn handle_navigation_event( pub async fn handle_navigation_event(
key: KeyEvent, key: KeyEvent,

View File

@@ -11,7 +11,7 @@ use crate::state::pages::form::FormState;
use crate::modes::handlers::event::EventOutcome; use crate::modes::handlers::event::EventOutcome;
use crate::modes::read_only; use crate::modes::read_only;
use crossterm::event::KeyEvent; use crossterm::event::KeyEvent;
use anyhow::{anyhow, Result}; use anyhow::Result;
/// Handles events when in Highlight mode. /// Handles events when in Highlight mode.
/// Currently, it mostly delegates to the read_only handler for movement. /// Currently, it mostly delegates to the read_only handler for movement.

View File

@@ -10,7 +10,7 @@ use common::proto::multieko2::table_definition::{
table_definition_client::TableDefinitionClient, table_definition_client::TableDefinitionClient,
ProfileTreeResponse ProfileTreeResponse
}; };
use anyhow::{Context, Result}; use anyhow::Result;
#[derive(Clone)] #[derive(Clone)]
pub struct GrpcClient { pub struct GrpcClient {

View File

@@ -4,7 +4,7 @@ use std::env;
use common::proto::multieko2::table_definition::ProfileTreeResponse; use common::proto::multieko2::table_definition::ProfileTreeResponse;
use crate::modes::handlers::mode_manager::AppMode; use crate::modes::handlers::mode_manager::AppMode;
use crate::ui::handlers::context::DialogPurpose; use crate::ui::handlers::context::DialogPurpose;
use anyhow::{Context, Result}; use anyhow::Result;
pub struct DialogState { pub struct DialogState {
pub dialog_show: bool, pub dialog_show: bool,

View File

@@ -3,7 +3,7 @@
use crate::services::grpc_client::GrpcClient; use crate::services::grpc_client::GrpcClient;
use crate::state::pages::form::FormState; use crate::state::pages::form::FormState;
use common::proto::multieko2::adresar::{PostAdresarRequest, PutAdresarRequest}; use common::proto::multieko2::adresar::{PostAdresarRequest, PutAdresarRequest};
use anyhow::{Context, Result}; use anyhow::Result;
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SaveOutcome { pub enum SaveOutcome {

View File

@@ -7,7 +7,6 @@ use crate::state::app::state::AppState;
use crate::state::app::buffer::{AppView, BufferState}; use crate::state::app::buffer::{AppView, BufferState};
use crate::state::pages::canvas_state::CanvasState; use crate::state::pages::canvas_state::CanvasState;
use crate::ui::handlers::context::DialogPurpose; use crate::ui::handlers::context::DialogPurpose;
use crate::modes::handlers::event::EventOutcome;
use common::proto::multieko2::auth::LoginResponse; use common::proto::multieko2::auth::LoginResponse;
use anyhow::{Context, Result}; use anyhow::{Context, Result};

View File

@@ -8,7 +8,7 @@ use crate::state::{
}; };
use crate::ui::handlers::context::DialogPurpose; use crate::ui::handlers::context::DialogPurpose;
use crate::state::app::buffer::{AppView, BufferState}; use crate::state::app::buffer::{AppView, BufferState};
use anyhow::{Context, Result}; use anyhow::Result;
/// Attempts to register the user using the provided details via gRPC. /// Attempts to register the user using the provided details via gRPC.
/// Updates RegisterState and AppState on success or failure. /// Updates RegisterState and AppState on success or failure.

View File

@@ -7,7 +7,7 @@ use crossterm::{
}; };
use ratatui::{backend::CrosstermBackend, Terminal}; use ratatui::{backend::CrosstermBackend, Terminal};
use std::io::{self, stdout, Write}; use std::io::{self, stdout, Write};
use anyhow::{Context, Result}; use anyhow::Result;
pub struct TerminalCore { pub struct TerminalCore {
terminal: Terminal<CrosstermBackend<io::Stdout>>, terminal: Terminal<CrosstermBackend<io::Stdout>>,

View File

@@ -1,7 +1,7 @@
// src/tui/terminal/event_reader.rs // src/tui/terminal/event_reader.rs
use crossterm::event::{self, Event}; use crossterm::event::{self, Event};
use anyhow::{Context, Result}; use anyhow::Result;
pub struct EventReader; pub struct EventReader;

View File

@@ -3,7 +3,7 @@
use crate::config::binds::config::Config; use crate::config::binds::config::Config;
use crate::config::colors::themes::Theme; use crate::config::colors::themes::Theme;
use crate::services::grpc_client::GrpcClient; use crate::services::grpc_client::GrpcClient;
use crate::services::auth::AuthClient; // <-- Add AuthClient import // <-- Add AuthClient import
use crate::services::ui_service::UiService; use crate::services::ui_service::UiService;
use crate::modes::common::commands::CommandHandler; use crate::modes::common::commands::CommandHandler;
use crate::modes::handlers::event::{EventHandler, EventOutcome}; use crate::modes::handlers::event::{EventHandler, EventOutcome};