refactor: unified identity selector#408
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA reusable Changes
Sequence Diagram(s)sequenceDiagram
participant UI_Screen
participant IdentitySelector
participant AppContext
UI_Screen->>AppContext: Load local qualified identities
AppContext-->>UI_Screen: Return Vec<QualifiedIdentity>
UI_Screen->>IdentitySelector: Instantiate with identities & config
IdentitySelector->>UI_Screen: On selection/input, update identity string
UI_Screen-->>IdentitySelector: Exclude certain identities (optional)
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (7)
src/ui/tokens/tokens_screen/groups.rs (1)
161-186: Consider simplifying the exclusion logic for better maintainability.The current exclusion logic is functional but complex. The nested filter logic and developer mode handling could be simplified for better readability.
Consider this refactored approach:
- // Collect other member identities to exclude duplicates - let exclude_identities: Vec<_> = if !self.app_context.is_developer_mode() { - group_ui - .members - .iter() - .enumerate() - .filter_map(|(i, m)| if i != j && !m.identity_str.is_empty() { - let identifier = Identifier::from_string(&m.identity_str, Encoding::Base58).ok()?; - Some(identifier) - } else { - None - }) - .collect() - } else { - Vec::new() - }; - - let identities = self.identities.values().cloned().collect::<Vec<QualifiedIdentity>>(); - // Use the reusable identity selector widget - let _identity_response = ui.add(IdentitySelector::new( - format!("member_identity_selector_{}", j), - &mut member.identity_str, - &identities, - ) - .width(200.0) - .exclude(&exclude_identities)); + let identities = self.identities.values().cloned().collect::<Vec<QualifiedIdentity>>(); + let mut selector = IdentitySelector::new( + format!("member_identity_selector_{}", j), + &mut member.identity_str, + &identities, + ) + .width(200.0); + + // Exclude other group members in non-developer mode + if !self.app_context.is_developer_mode() { + let exclude_identities: Vec<_> = group_ui + .members + .iter() + .enumerate() + .filter_map(|(i, m)| { + if i != j && !m.identity_str.is_empty() { + Identifier::from_string(&m.identity_str, Encoding::Base58).ok() + } else { + None + } + }) + .collect(); + selector = selector.exclude(&exclude_identities); + } + + let _identity_response = ui.add(selector);src/ui/tokens/transfer_tokens_screen.rs (2)
140-142: Consider graceful error handling instead of panic-prone.expect().The current implementation will panic if identities aren't loaded. Consider using proper error handling that provides user feedback.
- let known_identities = app_context - .load_local_qualified_identities() - .expect("Identities not loaded"); + let known_identities = app_context + .load_local_qualified_identities() + .unwrap_or_else(|_| { + // Log error and return empty vec, or handle appropriately + Vec::new() + });
161-164: Consider improving the default receiver identity selection.Setting the receiver to the first known identity might not provide the best UX. Consider either leaving it empty or using a more intelligent default.
- let receiver_identity_id = known_identities - .first() - .map(|identity| identity.identity.id().to_string(Encoding::Base58)) - .unwrap_or_default(); + let receiver_identity_id = String::new(); // Start with empty for better UXsrc/ui/tokens/destroy_frozen_funds_screen.rs (2)
69-71: Address the TODO comment for better UX.The TODO comment indicates that frozen identities should be filtered by frozen status. This would improve user experience by only showing relevant identities.
Would you like me to help implement the filtering logic to show only frozen identities, or open an issue to track this improvement?
191-193: Consider graceful error handling instead of panic-prone.expect().Same issue as in other files - using
.expect()could cause application crashes if identities fail to load.- let all_identities = app_context - .load_local_qualified_identities() - .expect("Identities not loaded"); + let all_identities = app_context + .load_local_qualified_identities() + .unwrap_or_else(|_| Vec::new());src/ui/tokens/freeze_tokens_screen.rs (1)
78-80: Consider graceful error handling instead of panic-prone.expect().Consistent with other files in this PR, using
.expect()could cause application crashes. Consider handling the error gracefully.- let known_identities = app_context - .load_local_qualified_identities() - .expect("Identities not loaded"); + let known_identities = app_context + .load_local_qualified_identities() + .unwrap_or_else(|_| Vec::new());src/ui/components/identity_selector.rs (1)
18-42: Fix the documentation example to match the actual API.The documentation example shows methods that don't exist in the actual implementation (
allow_duplicatesmethod).-/// # Example -/// ```rust,no_run -/// use dash_evo_tool::ui::components::identity_selector::IdentitySelector; -/// use dash_sdk::query_types::IndexMap; -/// use dash_sdk::platform::Identifier; -/// use dash_evo_tool::model::qualified_identity::QualifiedIdentity; -/// -/// // This example shows the API usage, but cannot be run in doctest -/// // due to complex dependencies -/// fn example_usage(ui: &mut egui::Ui, identities: &IndexMap<Identifier, QualifiedIdentity>) { -/// let mut identity_str = String::new(); -/// let exclude_list = vec!["already_used_identity".to_string()]; -/// -/// let response = ui.add(IdentitySelector::new( -/// "my_selector", -/// &mut identity_str, -/// identities -/// ) -/// .width(250.0) -/// .allow_duplicates(false) -/// .exclude(&exclude_list)); -/// -/// if response.changed() { -/// // Identity was changed via dropdown selection, "Other" selection, or text input -/// } -/// } -/// ``` +/// # Example +/// ```rust,no_run +/// use dash_evo_tool::ui::components::identity_selector::IdentitySelector; +/// use dash_sdk::platform::Identifier; +/// use dash_evo_tool::model::qualified_identity::QualifiedIdentity; +/// +/// // This example shows the API usage, but cannot be run in doctest +/// // due to complex dependencies +/// fn example_usage(ui: &mut egui::Ui, identities: &[QualifiedIdentity]) { +/// let mut identity_str = String::new(); +/// let exclude_list = vec![/* Identifier objects */]; +/// +/// let response = ui.add(IdentitySelector::new( +/// "my_selector", +/// &mut identity_str, +/// identities +/// ) +/// .width(250.0) +/// .exclude(&exclude_list)); +/// +/// if response.changed() { +/// // Identity was changed via dropdown selection, "Other" selection, or text input +/// } +/// } +/// ```
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
src/ui/components/identity_selector.rs(1 hunks)src/ui/components/mod.rs(1 hunks)src/ui/identities/transfer_screen.rs(5 hunks)src/ui/tokens/destroy_frozen_funds_screen.rs(4 hunks)src/ui/tokens/freeze_tokens_screen.rs(4 hunks)src/ui/tokens/mint_tokens_screen.rs(5 hunks)src/ui/tokens/tokens_screen/groups.rs(2 hunks)src/ui/tokens/transfer_tokens_screen.rs(5 hunks)src/ui/tokens/unfreeze_tokens_screen.rs(5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/ui/**/*.rs
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- CLAUDE.md
src/ui/components/**/*.rs
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- CLAUDE.md
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
src/ui/components/mod.rs (9)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Add new UI screens to the appropriate 'src/ui/' subdirectory
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Call 'mark_for_update()' when state changes in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/components/**/*.rs : Implement reusable UI panels (left panel, wallet panel, top panel) with consistent styling and layout in 'src/ui/components/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Handle Core RPC authentication and network-specific configurations in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Implement custom provider for Dash SDK integration in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Encrypt private keys with Argon2 + AES-GCM in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use 'Result<T, String>' for UI-facing error handling
src/ui/tokens/tokens_screen/groups.rs (4)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Encrypt private keys with Argon2 + AES-GCM in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Implement custom provider for Dash SDK integration in 'src/sdk_wrapper.rs'
src/ui/identities/transfer_screen.rs (8)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Encrypt private keys with Argon2 + AES-GCM in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/components/**/*.rs : Implement reusable UI panels (left panel, wallet panel, top panel) with consistent styling and layout in 'src/ui/components/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/{context,app}.rs : Use 'AppContext' with 'Arc<Mutex<T>>' for thread-safe shared state
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Handle Core RPC authentication and network-specific configurations in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Implement custom provider for Dash SDK integration in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use 'Result<T, String>' for UI-facing error handling
src/ui/tokens/destroy_frozen_funds_screen.rs (9)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Encrypt private keys with Argon2 + AES-GCM in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/components/**/*.rs : Implement reusable UI panels (left panel, wallet panel, top panel) with consistent styling and layout in 'src/ui/components/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/{context,app}.rs : Use 'AppContext' with 'Arc<Mutex<T>>' for thread-safe shared state
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Handle Core RPC authentication and network-specific configurations in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Implement custom provider for Dash SDK integration in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Add new UI screens to the appropriate 'src/ui/' subdirectory
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use 'Result<T, String>' for UI-facing error handling
src/ui/tokens/freeze_tokens_screen.rs (9)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Encrypt private keys with Argon2 + AES-GCM in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/components/**/*.rs : Implement reusable UI panels (left panel, wallet panel, top panel) with consistent styling and layout in 'src/ui/components/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/{context,app}.rs : Use 'AppContext' with 'Arc<Mutex<T>>' for thread-safe shared state
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Handle Core RPC authentication and network-specific configurations in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Implement custom provider for Dash SDK integration in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Add new UI screens to the appropriate 'src/ui/' subdirectory
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use 'Result<T, String>' for UI-facing error handling
src/ui/tokens/unfreeze_tokens_screen.rs (9)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Encrypt private keys with Argon2 + AES-GCM in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/components/**/*.rs : Implement reusable UI panels (left panel, wallet panel, top panel) with consistent styling and layout in 'src/ui/components/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/{context,app}.rs : Use 'AppContext' with 'Arc<Mutex<T>>' for thread-safe shared state
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Handle Core RPC authentication and network-specific configurations in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Implement custom provider for Dash SDK integration in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Add new UI screens to the appropriate 'src/ui/' subdirectory
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use 'Result<T, String>' for UI-facing error handling
src/ui/components/identity_selector.rs (2)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Implement custom provider for Dash SDK integration in 'src/sdk_wrapper.rs'
src/ui/tokens/transfer_tokens_screen.rs (9)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/components/**/*.rs : Implement reusable UI panels (left panel, wallet panel, top panel) with consistent styling and layout in 'src/ui/components/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Encrypt private keys with Argon2 + AES-GCM in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/{context,app}.rs : Use 'AppContext' with 'Arc<Mutex<T>>' for thread-safe shared state
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Handle Core RPC authentication and network-specific configurations in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Implement custom provider for Dash SDK integration in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Add new UI screens to the appropriate 'src/ui/' subdirectory
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use 'Result<T, String>' for UI-facing error handling
src/ui/tokens/mint_tokens_screen.rs (7)
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Implement password-based encryption for identity security in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/model/qualified_identity/**/*.rs : Encrypt private keys with Argon2 + AES-GCM in 'src/model/qualified_identity/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/**/*.rs : Use the 'ScreenLike' trait for hierarchical screen management in UI code
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/backend_task/**/*.rs : Create new backend tasks in the 'src/backend_task/' directory
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/sdk_wrapper.rs : Handle Core RPC authentication and network-specific configurations in 'src/sdk_wrapper.rs'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/ui/components/**/*.rs : Implement reusable UI panels (left panel, wallet panel, top panel) with consistent styling and layout in 'src/ui/components/'
Learnt from: CR
PR: dashpay/dash-evo-tool#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T12:49:27.256Z
Learning: Applies to src/backend_task/**/*.rs : Check 'app_context.executables' before running tasks
🔇 Additional comments (13)
src/ui/components/mod.rs (1)
4-4: LGTM: Module declaration follows established pattern.The addition of the
identity_selectormodule declaration is consistent with the existing module organization pattern in the components folder.src/ui/tokens/mint_tokens_screen.rs (3)
6-6: LGTM: Import follows established pattern.The import of
QualifiedIdentityis necessary for the new functionality and follows the existing import organization.
8-8: LGTM: Import follows established pattern.The import of
IdentitySelectoris necessary for the new widget integration and follows the existing import organization.
221-229: LGTM: IdentitySelector integration with proper exclusion logic.The replacement of manual text input with the
IdentitySelectorwidget is well-implemented:
- Proper exclusion of the current identity to prevent self-selection
- Appropriate fixed width of 300.0 for consistent UI
- Good use of the widget's API
This achieves the PR objective of providing consistent identity selection across screens.
src/ui/tokens/tokens_screen/groups.rs (1)
1-2: LGTM: Imports follow established pattern.The imports for
QualifiedIdentityandIdentitySelectorare necessary for the new functionality and follow the existing import organization.src/ui/identities/transfer_screen.rs (2)
7-7: LGTM: Import follows established pattern.The import of
IdentitySelectoris necessary for the new widget integration and follows the existing import organization.
119-127: LGTM: IdentitySelector integration with proper exclusion logic.The replacement of manual text input with the
IdentitySelectorwidget is well-implemented:
- Proper exclusion of the current identity to prevent self-transfer
- Appropriate fixed width of 300.0 for consistent UI
- Good use of the widget's API
This achieves the PR objective of providing consistent identity selection across screens.
src/ui/tokens/unfreeze_tokens_screen.rs (2)
8-8: LGTM: Import follows established pattern.The import of
IdentitySelectoris necessary for the new widget integration and follows the existing import organization.
213-220: LGTM: IdentitySelector integration is well-implemented.The replacement of manual text input with the
IdentitySelectorwidget is correctly implemented:
- Proper widget configuration with fixed width of 300.0
- Good use of the widget's API
- Consistent with the pattern used in other screens
This achieves the PR objective of providing consistent identity selection across screens.
src/ui/tokens/transfer_tokens_screen.rs (1)
206-214: Good implementation of the unified IdentitySelector widget.The widget is properly configured with sender identity exclusion and appropriate width. The integration follows the established pattern from the coding guidelines.
src/ui/tokens/destroy_frozen_funds_screen.rs (1)
219-223: Clean integration of the IdentitySelector widget.The widget is properly integrated with the frozen_identities list. The implementation is consistent with the established pattern.
src/ui/tokens/freeze_tokens_screen.rs (1)
209-216: Excellent implementation of the IdentitySelector widget.The widget configuration with width setting and clean integration demonstrates good adherence to the unified identity selector pattern.
src/ui/components/identity_selector.rs (1)
86-166: Excellent implementation of the Widget trait.The widget implementation is well-designed with proper synchronization between dropdown and text input, efficient identity lookups using BTreeMap, and clean exclusion logic. The response handling correctly combines both input methods.
pauldelucia
left a comment
There was a problem hiding this comment.
Just replace the uses of the old selector with the new one
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a reusable IdentitySelector widget to standardize identity selection across the application. The widget combines a dropdown menu with a text input field, allowing users to select from known identities or manually input an identity ID.
- Creates a new
IdentitySelectorwidget with customizable options for width, exclusions, and labels - Replaces manual text input fields and combo boxes across multiple token-related screens
- Removes deprecated helper functions and updates imports to use the new component
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ui/components/identity_selector.rs | New reusable widget combining dropdown and text input for identity selection |
| src/ui/tokens/transfer_tokens_screen.rs | Replaces custom dropdown/text input with IdentitySelector widget |
| src/ui/tokens/mint_tokens_screen.rs | Integrates IdentitySelector for recipient selection |
| src/ui/tokens/freeze_tokens_screen.rs | Uses IdentitySelector for freeze target selection |
| src/ui/tokens/unfreeze_tokens_screen.rs | Implements IdentitySelector for unfreeze target selection |
| src/ui/tokens/destroy_frozen_funds_screen.rs | Replaces manual input with IdentitySelector |
| src/ui/identities/transfer_screen.rs | Updates to use IdentitySelector for recipient selection |
| src/ui/contracts_documents/group_actions_screen.rs | Migrates to IdentitySelector with advanced features |
| src/ui/helpers.rs | Removes deprecated render_identity_selector function |
| src/ui/components/mod.rs | Adds identity_selector module export |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pauldelucia
left a comment
There was a problem hiding this comment.
TODO: move some functions that are similar to the identity selector from ui/helpers into their own files in ui/components
let's do this in a separate PR |
* fix: top up with qr code wasnt working (#410) * fix: top up with qr code wasnt working * fmt and clippy * coderabbit * fix: dash-qt path autodetection fails (#409) * fix: dash-qt path not detected correctly * fix: correct handling of dash-qt path clear button * chore: copilot review * fix: change of wallet on top up does not update the address (#414) * build(deps): upgrade build dependencies (egui 0.32.0, rusqlite 0.37, and others) (#406) * build(deps): update all rust dependencies * chore: replace depreacated ui.close_menu() * chore: upgrade Popup in identities screen * fix: actions menu items width too low * chore: all warnings fixed * chore: close identity actions on click outside --------- Co-authored-by: pauldelucia <pauldelucia2@gmail.com> * refactor: unified identity selector (#408) * refactor: unified identity selection * feat: identity selector implementation on multiple screens * feat: add label to IdentitySelector * chore: I think final * Update src/ui/components/identity_selector.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: settings are read from db 20 times a second (#420) * feat: wallet unlock on wallet screen (#415) * refactor: Amount type and AmountInput component (#417) * feat: amount input, first building version * test(amount): fixed tests * chore: I think final * chore: my_tokens display correct amount * chore: transfer tokens update * chore: hide unit on rewards estimate column * chore: two new helper methods * chore: I think finals * cargo fmt * feat: component trait * impl Component for AmountInput * chore: updated component trait * chore: update for egui enabled state mgmt * doc: component design pattern doc * chore: component design pattern continued * chore: amount improvements * chore: copilot review * chore: amount improvements * backport: amount component from * chore: fix imports * chore: refactor * chore: futher refactor * chore: further refactor based on feedback * doc: simplified component design pattern description * chore: peer review * doc: update docs * chore: amount input * test: run tests using github actions and fix failing tests (#422) * fix: failing tests * gha: run tests * fix: tests fail due to lack of .env file * fix: incorrect decimals handling on token create, mint and burn screens (#419) * feat: amount input, first building version * test(amount): fixed tests * chore: I think final * chore: my_tokens display correct amount * chore: transfer tokens update * chore: hide unit on rewards estimate column * chore: two new helper methods * chore: I think finals * cargo fmt * feat: component trait * impl Component for AmountInput * chore: updated component trait * chore: update for egui enabled state mgmt * doc: component design pattern doc * chore: component design pattern continued * chore: amount improvements * chore: copilot review * chore: amount improvements * refactor: mint and burn token screens use AmountInput * chore: use AmountInput on token creator screen * fix: burn error handling * feat: errors displayed in the AmountInput component * fix: vertical align of amount input * backport: amount component from * chore: fix imports * chore: refactor * chore: futher refactor * chore: further refactor based on feedback * doc: simplified component design pattern description * chore: peer review * doc: update docs * chore: amount input * chore: fixes after merge * chore: self-review * feat: amout set decimal places + rename label => with_label * refactor: amount input init on token screen * chore: fix token creator layout * chore: format base amount with leading zeros in confirmation * chore: base supply 0 by default * feat: add network field to identity structures (#423) * feat: add network field to identity structures * fix * feat: add display for private key in both WIF and Hex formats (#424) * feat: add display for private key in both WIF and Hex formats * fix: display private keys as normal text and depend on color theme --------- Co-authored-by: pauldelucia <pauldelucia2@gmail.com> * feat: allow setting zmq uri in .env (#425) * feat: allow setting ZMQ URI * chore: rename zmq_endpoint to core_zmq_endpoint * fix: failing test in token screen needed update * fix: update CI to use rust version 1.88 to match rust-toolchain * feat: better display in key selector (#429) * refactor: unified confirmation dialog (#413) * refactor: unified alert window * chore: update CLAUDE to create reusable components whenever appropriate * feat: correct confirm dialog on set token price screen * chore: remove callbacks which are overkill * chore: cargo fmt * chore: doctest fix * chore: impl Component for ConfirmationDialog * chore: use WidgetText * feat: Add Escape key handling for confirmation dialog * chore: button inactive when in progress * chore: fixes after merge * chore: some theme improvements * fmt and visual appeal --------- Co-authored-by: pauldelucia <pauldelucia2@gmail.com> * feat: nicer contract chooser panel (#426) * feat: nicer contract chooser panel * fmt * clippy * fix: token purchasability was not refreshing unless app restart (#432) * fix: token action buttons alignment * feat: nicer expanding tabs in token creator (#431) * feat: nicer expanding tabs in token creator * fix * feat: implement new ConfirmationDialog component throughout app (#430) * feat: implement new ConfirmationDialog component throughout app * fix: remove backup files * fix: confirmation dialog on withdrawal screen always showing "loading" * feat: Dash Masternode List and Quorum Viewer (#428) * a lot of work on DML viewer * more work * more work * more work * more work * more work * more work * more work * more work * ui improvements * ui improvements * optimizations * fast start * more work * more work * more work * fmt * much more work * fixes * updates * fix * fmt * revert * update for dashcore 40 * params for testnet * added testnet diff * fixes * clippy * more clippy * fixes * clean UI * use backend tasks * backend messages * coderabbit suggestions to add timeouts and prevent infinite loops * transient and fatal errors * update dash core configs for testnet * fmt * fix timeout * fix h-3 error * clear state when switching networks --------- Co-authored-by: pauldelucia <pauldelucia2@gmail.com> * chore: bump version to 1.0.0-dev (#439) The 1.0-dev branch builds were still reporting as 0.9.0 * feat: add left panel button labels and create contract subscreen chooser panel (#441) * feat: add left panel button labels and create contract subscreen chooser panel * fmt * feat: clarify identity index description for identity creation * fix: screen button labels display hard to see in dark mode * feat: left panel scroll (#443) * feat: left panel scroll * clippy * feat: add existing identity by wallet + identity index (#444) * feat: add existing identity by wallet + identity index * fmt * remove logging * update derivation index label * add robustness * fix: screen button labels display hard to see in dark mode * feat: left panel scroll (#443) * feat: left panel scroll * clippy * feat: load all identities up to an index * clippy * fix * feat: remove wallet (#445) * feat: remove wallet * clippy * Clarify wallet removal warning message Updated warning message for wallet removal to clarify that keys will no longer work unless the wallet is re-imported. * fix: identity creation and top-up via QR code handling (#447) * fix: identity creation handling * cleanup * cleanup * fix identity topup too * remove note * fix: keyword search required new platform version plus error handling and UI updates (#449) * fix: keyword search not displaying errors * update platform version and keyword search cleanup * fix * fix: handle decimals and fix schedules on price and purchase screens (#412) * fix: inactive button on set price group action * chore: apply review feedback * refactor: use token amount input * chore: update AmountInput * chore: tiered pricing * chore: direct purchase * chore: remove total agreed price * chore: max amount input defaults to max_credits * fmt * fix * clippy --------- Co-authored-by: pauldelucia <pauldelucia2@gmail.com> Co-authored-by: Claude <noreply@anthropic.com> * fix: showing used asset locks as unused (#448) * chore: remove unused task sender * chore: update to Platform V10 * feat: GroveSTARK ZK proofs (#450) * works * works * fix * ok * ok * ok * ok * ok * fix verification message showing in generation screen * remove advanced settings. set default 16 grinding bits and 128 bit security * ok * lock * ok * clippy * fmt * clippy and fmt * pin grovestark dep * fix * ok * clippy * rename file * remove ProofData * cleanup * fix * rename GroveStark to GroveSTARK * rename zk_proofs_screen to grovestark_screen * rename ZKProofs tool subscreen to GroveSTARK * move grovestark prover to model * rename ContractsDashpayComingSoon to ContractsDashpay * rename ContractsDashpay to Dashpay * rename dashpay stuff * fixes * ok * update grovestark rev * update * chore: update grovestark rev * chore: bump version * update platform rev * clippy * fix * fix * fix release * fix release * fix release --------- Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: QuantumExplorer <quantum@dash.org> Co-authored-by: thephez <thephez@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
This pull request introduces a reusable
IdentitySelectorwidget to simplify identity selection across multiple screens in the application. The widget combines a dropdown menu with a text input field, allowing users to select from known identities or manually input an identity ID. It is integrated into several screens, replacing previous manual text input fields for identity selection.New Feature: Reusable
IdentitySelectorWidgetsrc/ui/components/identity_selector.rs: Added a newIdentitySelectorwidget that combines a dropdown of available identities with a text input field for manual entry. It supports customization such as width, exclusion of specific identities, and duplicate prevention.Integration of
IdentitySelectorAcross ScreensTransfer Screen
src/ui/identities/transfer_screen.rs: Integrated theIdentitySelectorwidget for selecting the receiver identity ID. Added support for loading known identities from the application context. [1] [2] [3]Destroy Frozen Funds Screen
src/ui/tokens/destroy_frozen_funds_screen.rs: Replaced manual text input for frozen identity ID with theIdentitySelectorwidget. Added functionality to load all identities from the application context. [1] [2]Freeze Tokens Screen
src/ui/tokens/freeze_tokens_screen.rs: Used theIdentitySelectorwidget for selecting the identity to freeze. Loaded known identities from the application context for dropdown options. [1] [2]Mint Tokens Screen
src/ui/tokens/mint_tokens_screen.rs: Replaced recipient identity ID input with theIdentitySelectorwidget. Added logic to exclude the issuer identity from the dropdown options. [1] [2]Supporting Changes
IdentitySelectorwidget is used, ensuring proper integration. [1] [2] [3] [4] [5] [6]ComboBoximport insrc/ui/tokens/tokens_screen/groups.rs.Introduce a reusable identity selector component for consistent identity selection across various screens, enhancing user experience and code maintainability.Summary by CodeRabbit
New Features
Improvements