we compiled
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
// client/src/main.rs
|
// client/src/main.rs
|
||||||
use client::run_ui;
|
use client::run_ui;
|
||||||
use dotenvy::dotenv;
|
use dotenvy::dotenv;
|
||||||
use std::error::Error;
|
use anyhow::{anyhow, Result};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn Error>> {
|
async fn main() -> Result<()> {
|
||||||
dotenv().ok();
|
dotenv().ok();
|
||||||
run_ui().await
|
run_ui().await
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ use crate::state::pages::auth::{LoginState, RegisterState};
|
|||||||
use crate::state::pages::add_table::AddTableState;
|
use crate::state::pages::add_table::AddTableState;
|
||||||
use crate::state::pages::form::FormState;
|
use crate::state::pages::form::FormState;
|
||||||
use crate::modes::handlers::event::EventOutcome;
|
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 crossterm::event::KeyEvent;
|
||||||
|
use anyhow::{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.
|
||||||
@@ -30,7 +31,7 @@ pub async fn handle_highlight_event(
|
|||||||
command_message: &mut String,
|
command_message: &mut String,
|
||||||
edit_mode_cooldown: &mut bool,
|
edit_mode_cooldown: &mut bool,
|
||||||
ideal_cursor_column: &mut usize,
|
ideal_cursor_column: &mut usize,
|
||||||
) -> Result<EventOutcome, Box<dyn std::error::Error>> {
|
) -> Result<EventOutcome> {
|
||||||
// Delegate movement and other actions to the read_only handler
|
// Delegate movement and other actions to the read_only handler
|
||||||
// The rendering logic will use the highlight_anchor to draw the selection
|
// The rendering logic will use the highlight_anchor to draw the selection
|
||||||
let (should_exit, message) = read_only::handle_read_only_event(
|
let (should_exit, message) = read_only::handle_read_only_event(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
use crate::state::pages::form::FormState;
|
use crate::state::pages::form::FormState;
|
||||||
use crate::services::grpc_client::GrpcClient;
|
use crate::services::grpc_client::GrpcClient;
|
||||||
use crate::state::pages::canvas_state::CanvasState;
|
use crate::state::pages::canvas_state::CanvasState;
|
||||||
|
use anyhow::{anyhow, Result};
|
||||||
|
|
||||||
pub async fn handle_action(
|
pub async fn handle_action(
|
||||||
action: &str,
|
action: &str,
|
||||||
@@ -10,7 +11,7 @@ pub async fn handle_action(
|
|||||||
current_position: &mut u64,
|
current_position: &mut u64,
|
||||||
total_count: u64,
|
total_count: u64,
|
||||||
ideal_cursor_column: &mut usize,
|
ideal_cursor_column: &mut usize,
|
||||||
) -> Result<String, Box<dyn std::error::Error>> {
|
) -> Result<String> {
|
||||||
// TODO store unsaved changes without deleting form state values
|
// TODO store unsaved changes without deleting form state values
|
||||||
// First check for unsaved changes in both cases
|
// First check for unsaved changes in both cases
|
||||||
if form_state.has_unsaved_changes() {
|
if form_state.has_unsaved_changes() {
|
||||||
@@ -84,6 +85,7 @@ pub async fn handle_action(
|
|||||||
Ok("Already at last entry".into())
|
Ok("Already at last entry".into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => Err("Unknown form action".into())
|
_ => Err(anyhow!("Unknown form action: {}", action))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// src/tui/functions/login.rs
|
// 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 {
|
match action {
|
||||||
"previous_entry" => {
|
"previous_entry" => {
|
||||||
Ok("Previous entry at tui/functions/login.rs not implemented".into())
|
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" => {
|
"next_entry" => {
|
||||||
Ok("Next entry at tui/functions/login.rs not implemented".into())
|
Ok("Next entry at tui/functions/login.rs not implemented".into())
|
||||||
}
|
}
|
||||||
_ => Err("Unknown login action".into())
|
_ => Err(anyhow!("Unknown login action: {}", action))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user