diff --git a/Cargo.lock b/Cargo.lock index ceebaa5f0..23e554f25 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1486,8 +1486,8 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "dapi-grpc-macros", "futures-core", @@ -1505,8 +1505,8 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "heck", "quote", @@ -1564,8 +1564,8 @@ dependencies = [ [[package]] name = "dash-context-provider" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "dpp", "drive", @@ -1647,8 +1647,8 @@ dependencies = [ [[package]] name = "dash-sdk" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "arc-swap", "async-trait", @@ -1766,8 +1766,8 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "platform-value", "platform-version", @@ -1777,8 +1777,8 @@ dependencies = [ [[package]] name = "data-contracts" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "dashpay-contract", "dpns-contract", @@ -2016,8 +2016,8 @@ checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" [[package]] name = "dpns-contract" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "platform-value", "platform-version", @@ -2027,8 +2027,8 @@ dependencies = [ [[package]] name = "dpp" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "anyhow", "async-trait", @@ -2073,8 +2073,8 @@ dependencies = [ [[package]] name = "drive" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "bincode", "byteorder", @@ -2098,8 +2098,8 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "bincode", "dapi-grpc", @@ -2632,8 +2632,8 @@ dependencies = [ [[package]] name = "feature-flags-contract" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "platform-value", "platform-version", @@ -3839,8 +3839,8 @@ dependencies = [ [[package]] name = "keyword-search-contract" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "platform-value", "platform-version", @@ -3993,8 +3993,8 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "platform-value", "platform-version", @@ -5031,8 +5031,8 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "platform-serialization" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "bincode", "platform-version", @@ -5040,8 +5040,8 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "proc-macro2", "quote", @@ -5051,8 +5051,8 @@ dependencies = [ [[package]] name = "platform-value" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "base64 0.22.1", "bincode", @@ -5071,8 +5071,8 @@ dependencies = [ [[package]] name = "platform-version" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "bincode", "grovedb-version", @@ -5083,8 +5083,8 @@ dependencies = [ [[package]] name = "platform-versioning" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "proc-macro2", "quote", @@ -5619,8 +5619,8 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "backon", "chrono", @@ -6618,8 +6618,8 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "token-history-contract" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "platform-value", "platform-version", @@ -7244,8 +7244,8 @@ dependencies = [ [[package]] name = "wallet-utils-contract" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "platform-value", "platform-version", @@ -8198,8 +8198,8 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "2.0.0" -source = "git+https://github.com/dashpay/platform?rev=d3f3c930a618030be807bb257e7434ef3df090b5#d3f3c930a618030be807bb257e7434ef3df090b5" +version = "2.1.0-dev.8" +source = "git+https://github.com/dashpay/platform?rev=d6f9d9e74b885fbac27948bce6bae60b0cbd7135#d6f9d9e74b885fbac27948bce6bae60b0cbd7135" dependencies = [ "num_enum 0.5.11", "platform-value", diff --git a/Cargo.toml b/Cargo.toml index e07c5d7de..cb80ea5b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ qrcode = "0.14.1" nix = { version = "0.30.1", features = ["signal"] } eframe = { version = "0.32.0", features = ["persistence"] } base64 = "0.22.1" -dash-sdk = { git = "https://github.com/dashpay/platform", features = ["core_key_wallet", "core_bincode", "core_quorum-validation", "core_verification", "core_rpc_client"], rev = "d3f3c930a618030be807bb257e7434ef3df090b5" } +dash-sdk = { git = "https://github.com/dashpay/platform", features = ["core_key_wallet", "core_bincode", "core_quorum-validation", "core_verification", "core_rpc_client"], rev = "d6f9d9e74b885fbac27948bce6bae60b0cbd7135" } thiserror = "2.0.12" serde = "1.0.219" serde_json = "1.0.140" diff --git a/src/backend_task/identity/register_dpns_name.rs b/src/backend_task/identity/register_dpns_name.rs index d7ff0c963..888b2ae25 100644 --- a/src/backend_task/identity/register_dpns_name.rs +++ b/src/backend_task/identity/register_dpns_name.rs @@ -60,6 +60,7 @@ impl AppContext { let preorder_document = Document::V0(DocumentV0 { id: preorder_id, owner_id: qualified_identity.identity.id(), + creator_id: None, properties: BTreeMap::from([( "saltedDomainHash".to_string(), salted_domain_hash.into(), @@ -78,6 +79,7 @@ impl AppContext { let domain_document = Document::V0(DocumentV0 { id: domain_id, owner_id: qualified_identity.identity.id(), + creator_id: None, properties: BTreeMap::from([ ("parentDomainName".to_string(), "dash".into()), ("normalizedParentDomainName".to_string(), "dash".into()), diff --git a/src/backend_task/tokens/mod.rs b/src/backend_task/tokens/mod.rs index 40a1c8b80..aa8c40ddb 100644 --- a/src/backend_task/tokens/mod.rs +++ b/src/backend_task/tokens/mod.rs @@ -720,6 +720,8 @@ impl AppContext { let mut validation_operations = Vec::new(); match dash_sdk::dpp::data_contract::document_type::DocumentType::try_from_schema( contract_id, + 0, + 0, &name, platform_value, None, // schema_defs diff --git a/src/backend_task/tokens/query_tokens.rs b/src/backend_task/tokens/query_tokens.rs index 4020030c8..014c57400 100644 --- a/src/backend_task/tokens/query_tokens.rs +++ b/src/backend_task/tokens/query_tokens.rs @@ -1,5 +1,9 @@ //! Execute token query by keyword on Platform +use crate::{ + backend_task::BackendTaskSuccessResult, context::AppContext, + ui::tokens::tokens_screen::ContractDescriptionInfo, +}; use dash_sdk::{ Sdk, dpp::{document::DocumentV0Getters, platform_value::Value}, @@ -10,11 +14,6 @@ use dash_sdk::{ }, }; -use crate::{ - backend_task::BackendTaskSuccessResult, context::AppContext, - ui::tokens::tokens_screen::ContractDescriptionInfo, -}; - impl AppContext { /// 1. Fetch all **contractKeywords** docs that match `keyword` from the Search Contract /// 2. For every `contractId` found, fetch its **shortDescription** document from the Search Contract @@ -39,7 +38,7 @@ impl AppContext { let kw_docs = Document::fetch_many(sdk, kw_query.clone()) .await - .map_err(|e| format!("Error fetching keyword docs: {e}"))?; + .map_err(|e| e.to_string())?; // store the order for deterministic pagination let mut contract_ids: Vec = Vec::with_capacity(kw_docs.len()); @@ -47,11 +46,7 @@ impl AppContext { if let Some(doc) = doc_opt && let Some(cid_val) = doc.get("contractId") { - contract_ids.push( - cid_val - .to_identifier() - .map_err(|e| format!("Bad contractId: {e}"))?, - ); + contract_ids.push(cid_val.to_identifier().map_err(|e| e.to_string())?); } } @@ -85,7 +80,7 @@ impl AppContext { let description = if let Some((_, Some(desc_doc))) = Document::fetch_many(sdk, desc_query) .await - .map_err(|e| format!("Error fetching description doc: {e}"))? + .map_err(|e| e.to_string())? .into_iter() .next() { diff --git a/src/ui/components/contract_chooser_panel.rs b/src/ui/components/contract_chooser_panel.rs index ac465fd3c..b5c8add4a 100644 --- a/src/ui/components/contract_chooser_panel.rs +++ b/src/ui/components/contract_chooser_panel.rs @@ -181,8 +181,8 @@ pub fn add_contract_chooser_panel( SidePanel::left("contract_chooser_panel") // Let the user resize this panel horizontally - .resizable(false) - .default_width(270.0) // Increased to account for margins + .resizable(true) + .default_width(270.0) .frame( Frame::new() .fill(DashColors::background(dark_mode)) diff --git a/src/ui/contracts_documents/document_action_screen.rs b/src/ui/contracts_documents/document_action_screen.rs index c43c300b2..67b39fd89 100644 --- a/src/ui/contracts_documents/document_action_screen.rs +++ b/src/ui/contracts_documents/document_action_screen.rs @@ -1244,6 +1244,7 @@ impl DocumentActionScreen { id, properties, owner_id, + creator_id: None, revision, created_at: None, updated_at: None, @@ -1412,6 +1413,7 @@ impl DocumentActionScreen { id: original_doc.id(), properties, owner_id: original_doc.owner_id(), + creator_id: original_doc.creator_id(), revision: new_revision, created_at: None, updated_at: None, diff --git a/src/ui/tokens/tokens_screen/contract_details.rs b/src/ui/tokens/tokens_screen/contract_details.rs index 64e2c8c5c..926471086 100644 --- a/src/ui/tokens/tokens_screen/contract_details.rs +++ b/src/ui/tokens/tokens_screen/contract_details.rs @@ -1,9 +1,9 @@ -use crate::app::AppAction; use crate::ui::components::wallet_unlock::ScreenWithWalletUnlock; use crate::ui::tokens::tokens_screen::TokensScreen; +use crate::{app::AppAction, ui::theme::DashColors}; use dash_sdk::dpp::platform_value::string_encoding::Encoding; use dash_sdk::platform::Identifier; -use egui::Ui; +use egui::{Frame, Margin, Ui}; impl TokensScreen { /// Renders details for the selected_contract_id. @@ -14,13 +14,28 @@ impl TokensScreen { ) -> AppAction { let mut action = AppAction::None; + let mut go_back = false; + ui.horizontal(|ui| { + if ui.button("Back to Search Results").clicked() { + go_back = true; + } + }); + + if go_back { + self.selected_contract_id = None; + self.contract_details_loading = false; + self.selected_contract_description = None; + self.selected_token_infos.clear(); + return action; + } + + ui.add_space(10.0); + // Show loading spinner if data is being fetched if self.contract_details_loading { - ui.vertical_centered(|ui| { - ui.add_space(50.0); - ui.heading("Loading contract details..."); - ui.add_space(20.0); - ui.add(egui::widgets::Spinner::default().size(50.0)); + ui.horizontal(|ui| { + ui.label("Loading contract details..."); + ui.add(egui::widgets::Spinner::default().color(DashColors::DASH_BLUE)); }); return action; } @@ -29,10 +44,10 @@ impl TokensScreen { ui.heading("Contract Description:"); ui.add_space(10.0); ui.label(description.description.clone()); + ui.add_space(10.0); + ui.separator(); } - ui.add_space(10.0); - ui.separator(); ui.add_space(10.0); ui.heading("Tokens:"); @@ -42,54 +57,52 @@ impl TokensScreen { .filter(|token| token.data_contract_id == *contract_id) .cloned() .collect::>(); + let visuals = ui.visuals().clone(); for token in token_infos { - if token.data_contract_id == *contract_id { - ui.add_space(10.0); - ui.heading(format!("• {}", token.token_name.clone())); - ui.add_space(10.0); - ui.label(format!( - "ID: {}", - token.token_id.to_string(Encoding::Base58) - )); - ui.label(format!( - "Description: {}", - token + ui.add_space(10.0); + Frame::group(ui.style()) + .stroke(visuals.widgets.noninteractive.bg_stroke) + .fill(visuals.extreme_bg_color) + .inner_margin(Margin::same(12)) + .show(ui, |ui| { + ui.heading(token.token_name.clone()); + ui.add_space(6.0); + ui.label(format!( + "ID: {}", + token.token_id.to_string(Encoding::Base58) + )); + let description = token .description .clone() - .unwrap_or("No description".to_string()) - )); - } + .unwrap_or_else(|| "No description".to_string()); + ui.label(format!("Description: {}", description)); - ui.add_space(10.0); + ui.add_space(12.0); - // Add button to add token to my tokens - ui.horizontal(|ui| { - if ui.button("Add to My Tokens").clicked() { - match self.add_token_to_tracked_tokens(token.clone()) { - Ok(internal_action) => { - // Add token to my tokens - action |= internal_action; + ui.horizontal(|ui| { + if ui.button("Add to My Tokens").clicked() { + match self.add_token_to_tracked_tokens(token.clone()) { + Ok(internal_action) => { + action |= internal_action; + } + Err(e) => { + self.set_error_message(Some(e)); + } + } } - Err(e) => { - self.set_error_message(Some(e)); + if ui.button("View schema").clicked() { + match serde_json::to_string_pretty(&token.token_configuration) { + Ok(schema) => { + self.show_json_popup = true; + self.json_popup_text = schema; + } + Err(e) => { + self.set_error_message(Some(e.to_string())); + } + } } - } - } - if ui.button("View schema").clicked() { - // Show a popup window with the schema - match serde_json::to_string_pretty(&token.token_configuration) { - Ok(schema) => { - self.show_json_popup = true; - self.json_popup_text = schema; - } - Err(e) => { - self.set_error_message(Some(e.to_string())); - } - } - } - }); - - ui.add_space(20.0); + }); + }); } action diff --git a/src/ui/tokens/tokens_screen/keyword_search.rs b/src/ui/tokens/tokens_screen/keyword_search.rs index 13ceea4ad..5af0a2f4a 100644 --- a/src/ui/tokens/tokens_screen/keyword_search.rs +++ b/src/ui/tokens/tokens_screen/keyword_search.rs @@ -2,6 +2,7 @@ use crate::app::AppAction; use crate::backend_task::BackendTask; use crate::backend_task::contract::ContractTask; use crate::backend_task::tokens::TokenTask; +use crate::ui::theme::DashColors; use crate::ui::tokens::tokens_screen::{ ContractDescriptionInfo, ContractSearchStatus, TokensScreen, }; @@ -9,7 +10,7 @@ use chrono::Utc; use dash_sdk::dpp::platform_value::string_encoding::Encoding; use eframe::emath::Align; use eframe::epaint::Color32; -use egui::Ui; +use egui::{RichText, Ui}; use egui_extras::{Column, TableBuilder}; impl TokensScreen { @@ -105,27 +106,28 @@ impl TokensScreen { ui.label("No tokens match your keyword."); } else { action |= self.render_search_results_table(ui, &results); - } - - // Pagination controls - ui.horizontal(|ui| { - if self.search_current_page > 1 && ui.button("Previous").clicked() { - // Go to previous page - action = self.goto_previous_search_page(); - } - - if !(self.next_cursors.is_empty() && self.previous_cursors.is_empty()) { - ui.label(format!("Page {}", self.search_current_page)); - } - - if self.search_has_next_page && ui.button("Next").clicked() { - // Go to next page - action = self.goto_next_search_page(); + // Pagination controls + if self.search_has_next_page || self.search_current_page > 1 { + ui.horizontal(|ui| { + if self.search_current_page > 1 && ui.button("Previous").clicked() { + // Go to previous page + action |= self.goto_previous_search_page(); + } + + if !(self.next_cursors.is_empty() && self.previous_cursors.is_empty()) { + ui.label(format!("Page {}", self.search_current_page)); + } + + if self.search_has_next_page && ui.button("Next").clicked() { + // Go to next page + action |= self.goto_next_search_page(); + } + }); } - }); + } } ContractSearchStatus::ErrorMessage(e) => { - ui.colored_label(Color32::RED, format!("Error: {}", e)); + ui.colored_label(Color32::DARK_RED, format!("Error: {}", e)); } } @@ -139,6 +141,8 @@ impl TokensScreen { ) -> AppAction { let mut action = AppAction::None; + let dark_mode = ui.visuals().dark_mode; + egui::ScrollArea::both().show(ui, |ui| { ui.set_min_width(ui.available_width()); ui.set_max_width(ui.available_width()); @@ -152,13 +156,28 @@ impl TokensScreen { .column(Column::initial(80.0).resizable(true)) // Action .header(30.0, |mut header| { header.col(|ui| { - ui.label("Contract ID"); + ui.label( + RichText::new("Contract ID") + .strong() + .size(14.0) + .color(DashColors::text_primary(dark_mode)), + ); }); header.col(|ui| { - ui.label("Contract Description"); + ui.label( + RichText::new("Contract Description") + .strong() + .size(14.0) + .color(DashColors::text_primary(dark_mode)), + ); }); header.col(|ui| { - ui.label("Action"); + ui.label( + RichText::new("Action") + .strong() + .size(14.0) + .color(DashColors::text_primary(dark_mode)), + ); }); }) .body(|mut body| { @@ -168,7 +187,13 @@ impl TokensScreen { ui.label(contract.data_contract_id.to_string(Encoding::Base58)); }); row.col(|ui| { - ui.label(contract.description.clone()); + let description = if contract.description.trim().is_empty() { + "None".to_string() + } else { + contract.description.clone() + }; + + ui.label(description); }); row.col(|ui| { // Example "Add" button diff --git a/src/ui/tokens/tokens_screen/mod.rs b/src/ui/tokens/tokens_screen/mod.rs index 28d375dcd..1ae75df50 100644 --- a/src/ui/tokens/tokens_screen/mod.rs +++ b/src/ui/tokens/tokens_screen/mod.rs @@ -2894,13 +2894,12 @@ impl ScreenLike for TokensScreen { } } TokensSubscreen::SearchTokens => { - if msg.contains("Error fetching tokens") { + if msg_type == MessageType::Error { self.contract_search_status = ContractSearchStatus::ErrorMessage(msg.to_string()); // Clear adding status on error self.adding_token_start_time = None; self.adding_token_name = None; - self.backend_message = Some((msg.to_string(), msg_type, Utc::now())); } else if msg.contains("Added token") | msg.contains("Token already added") | msg.contains("Saved token to db") diff --git a/src/ui/wallets/wallets_screen/mod.rs b/src/ui/wallets/wallets_screen/mod.rs index 30db7e648..b8de381eb 100644 --- a/src/ui/wallets/wallets_screen/mod.rs +++ b/src/ui/wallets/wallets_screen/mod.rs @@ -873,11 +873,12 @@ impl ScreenLike for WalletsBalancesScreen { }); }); - ui.add_space(10.0); - ui.separator(); ui.add_space(10.0); if self.selected_wallet.is_some() { + ui.separator(); + ui.add_space(10.0); + // Always show the filter selector ui.vertical(|ui| { ui.heading( @@ -913,15 +914,6 @@ impl ScreenLike for WalletsBalancesScreen { ui.add_space(10.0); self.render_bottom_options(ui); - } else { - ui.vertical_centered(|ui| { - ui.add_space(50.0); - ui.label( - RichText::new("Please select a wallet to view its details") - .size(16.0) - .color(Color32::GRAY), - ); - }); } });