buffer as a feature
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -493,7 +493,7 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "canvas"
|
name = "canvas"
|
||||||
version = "0.4.2"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -584,7 +584,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "client"
|
name = "client"
|
||||||
version = "0.4.2"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -635,7 +635,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "0.4.2"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"prost",
|
"prost",
|
||||||
"prost-types",
|
"prost-types",
|
||||||
@@ -3022,7 +3022,7 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "search"
|
name = "search"
|
||||||
version = "0.4.2"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"common",
|
"common",
|
||||||
@@ -3121,7 +3121,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server"
|
name = "server"
|
||||||
version = "0.4.2"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bcrypt",
|
"bcrypt",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ resolver = "2"
|
|||||||
[workspace.package]
|
[workspace.package]
|
||||||
# TODO: idk how to do the name, fix later
|
# TODO: idk how to do the name, fix later
|
||||||
# name = "komp_ac"
|
# name = "komp_ac"
|
||||||
version = "0.4.2"
|
version = "0.5.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
authors = ["Filip Priečinský <filippriec@gmail.com>"]
|
authors = ["Filip Priečinský <filippriec@gmail.com>"]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// src/functions/common/buffer.rs
|
// src/buffer/functions/buffer.rs
|
||||||
|
|
||||||
use crate::state::app::buffer::BufferState;
|
use crate::buffer::state::BufferState;
|
||||||
use crate::state::app::buffer::AppView;
|
use crate::buffer::state::AppView;
|
||||||
|
|
||||||
pub fn get_view_layer(view: &AppView) -> u8 {
|
pub fn get_view_layer(view: &AppView) -> u8 {
|
||||||
match view {
|
match view {
|
||||||
9
client/src/buffer/mod.rs
Normal file
9
client/src/buffer/mod.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// src/buffer/mod.rs
|
||||||
|
|
||||||
|
pub mod state;
|
||||||
|
pub mod functions;
|
||||||
|
pub mod ui;
|
||||||
|
|
||||||
|
pub use state::{AppView, BufferState};
|
||||||
|
pub use functions::*;
|
||||||
|
pub use ui::render_buffer_list;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// src/state/app/buffer.rs
|
// src/buffer/state/buffer.rs
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum AppView {
|
pub enum AppView {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// src/components/handlers/buffer_list.rs
|
// src/buffer/ui.rs
|
||||||
|
|
||||||
use crate::config::colors::themes::Theme;
|
use crate::config::colors::themes::Theme;
|
||||||
use crate::state::app::buffer::BufferState;
|
use crate::buffer::state::BufferState;
|
||||||
use crate::state::app::state::AppState; // Add this import
|
use crate::state::app::state::AppState; // Add this import
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
layout::{Alignment, Rect},
|
layout::{Alignment, Rect},
|
||||||
@@ -11,7 +11,7 @@ use ratatui::{
|
|||||||
Frame,
|
Frame,
|
||||||
};
|
};
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use crate::functions::common::buffer::get_view_layer;
|
use crate::buffer::functions::get_view_layer;
|
||||||
|
|
||||||
pub fn render_buffer_list(
|
pub fn render_buffer_list(
|
||||||
f: &mut Frame,
|
f: &mut Frame,
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
// src/components/handlers.rs
|
// src/components/handlers.rs
|
||||||
pub mod sidebar;
|
pub mod sidebar;
|
||||||
pub mod buffer_list;
|
|
||||||
|
|
||||||
pub use sidebar::*;
|
pub use sidebar::*;
|
||||||
pub use buffer_list::*;
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
// src/functions/common.rs
|
|
||||||
|
|
||||||
pub mod buffer;
|
|
||||||
|
|
||||||
pub use buffer::*;
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
// src/functions/mod.rs
|
// src/functions/mod.rs
|
||||||
|
|
||||||
pub mod common;
|
|
||||||
pub mod modes;
|
pub mod modes;
|
||||||
|
|
||||||
pub use modes::*;
|
pub use modes::*;
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ use crate::config::binds::config::{Config, EditorKeybindingMode};
|
|||||||
use crate::state::{
|
use crate::state::{
|
||||||
app::state::AppState,
|
app::state::AppState,
|
||||||
pages::add_logic::{AddLogicFocus, AddLogicState},
|
pages::add_logic::{AddLogicFocus, AddLogicState},
|
||||||
app::buffer::AppView,
|
|
||||||
app::buffer::BufferState,
|
|
||||||
};
|
};
|
||||||
|
use crate::buffer::{AppView, BufferState};
|
||||||
use crossterm::event::{KeyEvent, KeyCode, KeyModifiers};
|
use crossterm::event::{KeyEvent, KeyCode, KeyModifiers};
|
||||||
use crate::services::GrpcClient;
|
use crate::services::GrpcClient;
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
use crate::state::pages::admin::{AdminFocus, AdminState};
|
use crate::state::pages::admin::{AdminFocus, AdminState};
|
||||||
use crate::state::app::state::AppState;
|
use crate::state::app::state::AppState;
|
||||||
use crate::config::binds::config::Config;
|
use crate::config::binds::config::Config;
|
||||||
use crate::state::app::buffer::{BufferState, AppView};
|
use crate::buffer::state::{BufferState, AppView};
|
||||||
use crate::state::pages::add_table::{AddTableState, LinkDefinition};
|
use crate::state::pages::add_table::{AddTableState, LinkDefinition};
|
||||||
use ratatui::widgets::ListState;
|
use ratatui::widgets::ListState;
|
||||||
use crate::state::pages::add_logic::{AddLogicState, AddLogicFocus}; // Added AddLogicFocus import
|
use crate::state::pages::add_logic::{AddLogicState, AddLogicFocus}; // Added AddLogicFocus import
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ pub mod modes;
|
|||||||
pub mod functions;
|
pub mod functions;
|
||||||
pub mod services;
|
pub mod services;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
pub mod buffer;
|
||||||
|
|
||||||
pub use ui::run_ui;
|
pub use ui::run_ui;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
use crossterm::event::{Event, KeyCode};
|
use crossterm::event::{Event, KeyCode};
|
||||||
use crate::config::binds::config::Config;
|
use crate::config::binds::config::Config;
|
||||||
use crate::ui::handlers::context::DialogPurpose;
|
use crate::ui::handlers::context::DialogPurpose;
|
||||||
use crate::state::app::{state::AppState, buffer::AppView};
|
use crate::state::app::state::AppState;
|
||||||
use crate::state::app::buffer::BufferState;
|
use crate::buffer::AppView;
|
||||||
|
use crate::buffer::state::BufferState;
|
||||||
use crate::state::pages::auth::{LoginState, RegisterState};
|
use crate::state::pages::auth::{LoginState, RegisterState};
|
||||||
use crate::state::pages::admin::AdminState;
|
use crate::state::pages::admin::AdminState;
|
||||||
use crate::modes::handlers::event::EventOutcome;
|
use crate::modes::handlers::event::EventOutcome;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
// src/modes/handlers/event.rs
|
// src/modes/handlers/event.rs
|
||||||
use crate::config::binds::config::Config;
|
use crate::config::binds::config::Config;
|
||||||
use crate::config::binds::key_sequences::KeySequenceTracker;
|
use crate::config::binds::key_sequences::KeySequenceTracker;
|
||||||
use crate::functions::common::buffer;
|
use crate::buffer::functions;
|
||||||
|
use crate::buffer::{AppView, BufferState, switch_buffer};
|
||||||
use crate::functions::modes::navigation::add_logic_nav;
|
use crate::functions::modes::navigation::add_logic_nav;
|
||||||
use crate::functions::modes::navigation::add_logic_nav::SaveLogicResultSender;
|
use crate::functions::modes::navigation::add_logic_nav::SaveLogicResultSender;
|
||||||
use crate::functions::modes::navigation::add_table_nav::SaveTableResultSender;
|
use crate::functions::modes::navigation::add_table_nav::SaveTableResultSender;
|
||||||
@@ -19,7 +20,6 @@ use crate::services::grpc_client::GrpcClient;
|
|||||||
use canvas::{FormEditor, AppMode as CanvasMode};
|
use canvas::{FormEditor, AppMode as CanvasMode};
|
||||||
use crate::state::{
|
use crate::state::{
|
||||||
app::{
|
app::{
|
||||||
buffer::{AppView, BufferState},
|
|
||||||
search::SearchState,
|
search::SearchState,
|
||||||
state::AppState,
|
state::AppState,
|
||||||
},
|
},
|
||||||
@@ -477,14 +477,14 @@ impl EventHandler {
|
|||||||
) {
|
) {
|
||||||
match action {
|
match action {
|
||||||
"next_buffer" => {
|
"next_buffer" => {
|
||||||
if buffer::switch_buffer(buffer_state, true) {
|
if switch_buffer(buffer_state, true) {
|
||||||
return Ok(EventOutcome::Ok(
|
return Ok(EventOutcome::Ok(
|
||||||
"Switched to next buffer".to_string(),
|
"Switched to next buffer".to_string(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"previous_buffer" => {
|
"previous_buffer" => {
|
||||||
if buffer::switch_buffer(buffer_state, false) {
|
if switch_buffer(buffer_state, false) {
|
||||||
return Ok(EventOutcome::Ok(
|
return Ok(EventOutcome::Ok(
|
||||||
"Switched to previous buffer".to_string(),
|
"Switched to previous buffer".to_string(),
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// src/state/app.rs
|
// src/state/app.rs
|
||||||
|
|
||||||
pub mod state;
|
pub mod state;
|
||||||
pub mod buffer;
|
|
||||||
pub mod search;
|
pub mod search;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::services::auth::AuthClient;
|
|||||||
use crate::state::pages::auth::AuthState;
|
use crate::state::pages::auth::AuthState;
|
||||||
use crate::state::pages::auth::LoginState;
|
use crate::state::pages::auth::LoginState;
|
||||||
use crate::state::app::state::AppState;
|
use crate::state::app::state::AppState;
|
||||||
use crate::state::app::buffer::{AppView, BufferState};
|
use crate::buffer::state::{AppView, BufferState};
|
||||||
use crate::config::storage::storage::{StoredAuthData, save_auth_data};
|
use crate::config::storage::storage::{StoredAuthData, save_auth_data};
|
||||||
use crate::ui::handlers::context::DialogPurpose;
|
use crate::ui::handlers::context::DialogPurpose;
|
||||||
use common::proto::komp_ac::auth::LoginResponse;
|
use common::proto::komp_ac::auth::LoginResponse;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
use crate::config::storage::delete_auth_data;
|
use crate::config::storage::delete_auth_data;
|
||||||
use crate::state::pages::auth::AuthState;
|
use crate::state::pages::auth::AuthState;
|
||||||
use crate::state::app::state::AppState;
|
use crate::state::app::state::AppState;
|
||||||
use crate::state::app::buffer::{AppView, BufferState};
|
use crate::buffer::state::{AppView, BufferState};
|
||||||
use crate::ui::handlers::context::DialogPurpose;
|
use crate::ui::handlers::context::DialogPurpose;
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use crate::state::{
|
|||||||
app::state::AppState,
|
app::state::AppState,
|
||||||
};
|
};
|
||||||
use crate::ui::handlers::context::DialogPurpose;
|
use crate::ui::handlers::context::DialogPurpose;
|
||||||
use crate::state::app::buffer::{AppView, BufferState};
|
use crate::buffer::state::{AppView, BufferState};
|
||||||
use common::proto::komp_ac::auth::AuthResponse;
|
use common::proto::komp_ac::auth::AuthResponse;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use tokio::spawn;
|
use tokio::spawn;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// src/tui/functions/intro.rs
|
// src/tui/functions/intro.rs
|
||||||
use crate::state::app::state::AppState;
|
use crate::state::app::state::AppState;
|
||||||
use crate::state::app::buffer::{AppView, BufferState};
|
use crate::buffer::state::{AppView, BufferState};
|
||||||
|
|
||||||
/// Handles intro screen selection by updating view history and managing focus state.
|
/// Handles intro screen selection by updating view history and managing focus state.
|
||||||
/// 0: Continue (restores last form or default)
|
/// 0: Continue (restores last form or default)
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ use crate::components::{
|
|||||||
handlers::sidebar::{self, calculate_sidebar_layout},
|
handlers::sidebar::{self, calculate_sidebar_layout},
|
||||||
intro::intro::render_intro,
|
intro::intro::render_intro,
|
||||||
render_background,
|
render_background,
|
||||||
render_buffer_list,
|
|
||||||
render_command_line,
|
render_command_line,
|
||||||
render_status_line,
|
render_status_line,
|
||||||
};
|
};
|
||||||
|
use crate::buffer::render_buffer_list;
|
||||||
use crate::config::colors::themes::Theme;
|
use crate::config::colors::themes::Theme;
|
||||||
use crate::modes::general::command_navigation::NavigationState;
|
use crate::modes::general::command_navigation::NavigationState;
|
||||||
use crate::state::app::buffer::BufferState;
|
use crate::buffer::state::BufferState;
|
||||||
use crate::state::app::state::AppState;
|
use crate::state::app::state::AppState;
|
||||||
use crate::state::pages::admin::AdminState;
|
use crate::state::pages::admin::AdminState;
|
||||||
use crate::state::pages::auth::AuthState;
|
use crate::state::pages::auth::AuthState;
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use crate::state::pages::auth::RegisterState;
|
|||||||
use crate::state::pages::admin::AdminState;
|
use crate::state::pages::admin::AdminState;
|
||||||
use crate::state::pages::admin::AdminFocus;
|
use crate::state::pages::admin::AdminFocus;
|
||||||
use crate::state::pages::intro::IntroState;
|
use crate::state::pages::intro::IntroState;
|
||||||
use crate::state::app::buffer::BufferState;
|
use crate::buffer::state::BufferState;
|
||||||
use crate::state::app::buffer::AppView;
|
use crate::buffer::state::AppView;
|
||||||
use crate::state::app::state::AppState;
|
use crate::state::app::state::AppState;
|
||||||
use crate::tui::terminal::{EventReader, TerminalCore};
|
use crate::tui::terminal::{EventReader, TerminalCore};
|
||||||
use crate::ui::handlers::render::render_ui;
|
use crate::ui::handlers::render::render_ui;
|
||||||
|
|||||||
Reference in New Issue
Block a user