complete redesign oh how client is displaying data
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
// src/state/app/state.rs
|
||||
|
||||
use std::env;
|
||||
use common::proto::multieko2::table_definition::ProfileTreeResponse;
|
||||
use crate::modes::handlers::mode_manager::AppMode;
|
||||
use crate::ui::handlers::context::DialogPurpose;
|
||||
use crate::state::app::search::SearchState; // ADDED
|
||||
use anyhow::Result;
|
||||
use common::proto::multieko2::table_definition::ProfileTreeResponse;
|
||||
// NEW: Import the types we need for the cache
|
||||
use common::proto::multieko2::table_structure::TableStructureResponse;
|
||||
use crate::modes::handlers::mode_manager::AppMode;
|
||||
use crate::state::app::search::SearchState;
|
||||
use crate::ui::handlers::context::DialogPurpose;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::sync::Arc;
|
||||
#[cfg(feature = "ui-debug")]
|
||||
use std::time::Instant;
|
||||
|
||||
// --- YOUR EXISTING DIALOGSTATE IS UNTOUCHED ---
|
||||
// --- DialogState and UiState are unchanged ---
|
||||
pub struct DialogState {
|
||||
pub dialog_show: bool,
|
||||
pub dialog_title: String,
|
||||
@@ -30,7 +34,7 @@ pub struct UiState {
|
||||
pub show_form: bool,
|
||||
pub show_login: bool,
|
||||
pub show_register: bool,
|
||||
pub show_search_palette: bool, // ADDED
|
||||
pub show_search_palette: bool,
|
||||
pub focus_outside_canvas: bool,
|
||||
pub dialog: DialogState,
|
||||
}
|
||||
@@ -52,10 +56,12 @@ pub struct AppState {
|
||||
pub current_view_profile_name: Option<String>,
|
||||
pub current_view_table_name: Option<String>,
|
||||
|
||||
// NEW: The "Rulebook" cache. We use Arc for efficient sharing.
|
||||
pub schema_cache: HashMap<String, Arc<TableStructureResponse>>,
|
||||
|
||||
pub focused_button_index: usize,
|
||||
pub pending_table_structure_fetch: Option<(String, String)>,
|
||||
|
||||
// ADDED: State for the search palette
|
||||
pub search_state: Option<SearchState>,
|
||||
|
||||
// UI preferences
|
||||
@@ -67,9 +73,7 @@ pub struct AppState {
|
||||
|
||||
impl AppState {
|
||||
pub fn new() -> Result<Self> {
|
||||
let current_dir = env::current_dir()?
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
let current_dir = env::current_dir()?.to_string_lossy().to_string();
|
||||
Ok(AppState {
|
||||
current_dir,
|
||||
profile_tree: ProfileTreeResponse::default(),
|
||||
@@ -77,9 +81,10 @@ impl AppState {
|
||||
current_view_profile_name: None,
|
||||
current_view_table_name: None,
|
||||
current_mode: AppMode::General,
|
||||
schema_cache: HashMap::new(), // NEW: Initialize the cache
|
||||
focused_button_index: 0,
|
||||
pending_table_structure_fetch: None,
|
||||
search_state: None, // ADDED
|
||||
search_state: None,
|
||||
ui: UiState::default(),
|
||||
|
||||
#[cfg(feature = "ui-debug")]
|
||||
|
||||
Reference in New Issue
Block a user