we compiled

This commit is contained in:
filipriec
2025-04-18 21:04:36 +02:00
parent d3fcb23e22
commit ef3ecfc73f
4 changed files with 13 additions and 8 deletions

View File

@@ -1,10 +1,10 @@
// client/src/main.rs
use client::run_ui;
use dotenvy::dotenv;
use std::error::Error;
use anyhow::{anyhow, Result};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
async fn main() -> Result<()> {
dotenv().ok();
run_ui().await
}

View File

@@ -9,8 +9,9 @@ use crate::state::pages::auth::{LoginState, RegisterState};
use crate::state::pages::add_table::AddTableState;
use crate::state::pages::form::FormState;
use crate::modes::handlers::event::EventOutcome;
use crate::modes::read_only; // Import the ReadOnly handler
use crate::modes::read_only;
use crossterm::event::KeyEvent;
use anyhow::{anyhow, Result};
/// Handles events when in Highlight mode.
/// Currently, it mostly delegates to the read_only handler for movement.
@@ -30,7 +31,7 @@ pub async fn handle_highlight_event(
command_message: &mut String,
edit_mode_cooldown: &mut bool,
ideal_cursor_column: &mut usize,
) -> Result<EventOutcome, Box<dyn std::error::Error>> {
) -> Result<EventOutcome> {
// Delegate movement and other actions to the read_only handler
// The rendering logic will use the highlight_anchor to draw the selection
let (should_exit, message) = read_only::handle_read_only_event(

View File

@@ -2,6 +2,7 @@
use crate::state::pages::form::FormState;
use crate::services::grpc_client::GrpcClient;
use crate::state::pages::canvas_state::CanvasState;
use anyhow::{anyhow, Result};
pub async fn handle_action(
action: &str,
@@ -10,7 +11,7 @@ pub async fn handle_action(
current_position: &mut u64,
total_count: u64,
ideal_cursor_column: &mut usize,
) -> Result<String, Box<dyn std::error::Error>> {
) -> Result<String> {
// TODO store unsaved changes without deleting form state values
// First check for unsaved changes in both cases
if form_state.has_unsaved_changes() {
@@ -84,6 +85,7 @@ pub async fn handle_action(
Ok("Already at last entry".into())
}
}
_ => Err("Unknown form action".into())
_ => Err(anyhow!("Unknown form action: {}", action))
}
}

View File

@@ -1,6 +1,8 @@
// src/tui/functions/login.rs
pub async fn handle_action(action: &str,) -> Result<String, Box<dyn std::error::Error>> {
use anyhow::{anyhow, Result};
pub async fn handle_action(action: &str,) -> Result<String> {
match action {
"previous_entry" => {
Ok("Previous entry at tui/functions/login.rs not implemented".into())
@@ -8,6 +10,6 @@ pub async fn handle_action(action: &str,) -> Result<String, Box<dyn std::error::
"next_entry" => {
Ok("Next entry at tui/functions/login.rs not implemented".into())
}
_ => Err("Unknown login action".into())
_ => Err(anyhow!("Unknown login action: {}", action))
}
}