Skip to content

v0.8.2-dev to master#186

Merged
pauldelucia merged 3 commits into
masterfrom
v0.8.2-dev
Feb 25, 2025
Merged

v0.8.2-dev to master#186
pauldelucia merged 3 commits into
masterfrom
v0.8.2-dev

Conversation

@pauldelucia
Copy link
Copy Markdown
Member

@pauldelucia pauldelucia commented Feb 25, 2025

  • Added filters in dpns screens so users can search active/past contests and owned names by name
  • Added a selector in the voting screen so users can set all their nodes to "Vote Now" "Schedule" or "No Vote". Before it defaulted to "Vote Now" and there was no way to switch it. This is convenient for users with many nodes.
  • Bumped version in Cargo.toml

Summary by CodeRabbit

  • Chores

    • Updated the package version to 0.8.2.
  • New Features

    • Enhanced the contested names interface with new filtering options for active, past, and owned entries.
    • Introduced bulk voting functionality, allowing users to quickly select vote actions or schedule votes with custom timings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 25, 2025

Walkthrough

The pull request updates the package version in Cargo.toml from "0.8.0" to "0.8.2". Additionally, it enhances the UI for contested names by adding three new filter term fields and a bulk voting option field to the DPNSScreen struct. The UI methods now include logic for processing user input for active, past, and owned contests, with additional support for scheduling votes.

Changes

File(s) Change Summary
Cargo.toml Package version updated from "0.8.0" to "0.8.2".
src/ui/dpns/dpns_contested_names_screen.rs Added string fields active_filter_term, past_filter_term, and owned_filter_term; added set_all_option field for bulk voting; updated UI methods to include filtering and voting scheduling.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant S as DPNSScreen
    U->>S: Enter filter term for active/past/owned contests
    S->>S: Process filter term (normalize characters)
    S->>U: Render filtered contest list

    U->>S: Select bulk voting option ("No Vote", "Cast Now", "Schedule")
    S->>S: Update set_all_option state
    S->>U: Display voting scheduling inputs if "Schedule" is selected
Loading

Suggested reviewers

  • QuantumExplorer
  • ogabrielides

Poem

I'm a rabbit with a happy heart,
Hopping through code with a fresh new start.
Filters and votes now dance on the screen,
In a world of updates, neat and keen.
With bugs chased away, joy fills each part!
🐇🌟 Happy coding, from the rabbit's art!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/ui/dpns/dpns_contested_names_screen.rs (3)

348-372: Filter implementation for active contests

The filter implementation includes smart character replacement ('o'/'O' to '0' and 'l' to '1'), which helps match common typos or visual ambiguities.

However, users may not be aware of these automatic replacements. Consider adding a tooltip explaining this behavior.


698-725: Filter implementation for past contests

I notice the filtering code for past contests is almost identical to the active contests implementation. Consider extracting this logic into a helper function to reduce duplication and ensure consistent behavior across all filters.

-// 1) Filter by `past_filter_term`
-if !self.past_filter_term.is_empty() {
-    let mut filter_lc = self.past_filter_term.to_lowercase();
-    // Convert o and O to 0 and l to 1 in filter_lc
-    filter_lc = filter_lc
-        .chars()
-        .map(|c| match c {
-            'o' | 'O' => '0',
-            'l' => '1',
-            _ => c,
-        })
-        .collect();
-
-    cn.retain(|c| {
-        c.normalized_contested_name
-            .to_lowercase()
-            .contains(&filter_lc)
-    });
-}
+if !self.past_filter_term.is_empty() {
+    cn = self.apply_name_filter(cn, &self.past_filter_term);
+}

Then add a helper method to the DPNSScreen implementation:

fn apply_name_filter<T>(&self, items: Vec<T>, filter_term: &str) -> Vec<T> 
where T: HasNormalizedName {
    if filter_term.is_empty() {
        return items;
    }
    
    let mut filter_lc = filter_term.to_lowercase();
    filter_lc = filter_lc
        .chars()
        .map(|c| match c {
            'o' | 'O' => '0',
            'l' => '1',
            _ => c,
        })
        .collect();
        
    items.into_iter()
        .filter(|item| {
            item.get_normalized_name()
                .to_lowercase()
                .contains(&filter_lc)
        })
        .collect()
}

860-873: Filter implementation for owned names

The filter for owned names doesn't include the character replacement logic (o/O→0, l→1) that's present in the active and past contest filters. This inconsistency might confuse users who expect the same behavior across all filters.

Consider applying the same character replacement logic to the owned names filter for consistency:

if !self.owned_filter_term.is_empty() {
-    let filter_lc = self.owned_filter_term.to_lowercase();
+    let mut filter_lc = self.owned_filter_term.to_lowercase();
+    // Convert o and O to 0 and l to 1 in filter_lc
+    filter_lc = filter_lc
+        .chars()
+        .map(|c| match c {
+            'o' | 'O' => '0',
+            'l' => '1',
+            _ => c,
+        })
+        .collect();
    name_infos.retain(|c| c.1.name.to_lowercase().contains(&filter_lc));
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8ad3b2 and 2c21467.

📒 Files selected for processing (2)
  • Cargo.toml (1 hunks)
  • src/ui/dpns/dpns_contested_names_screen.rs (10 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Cargo.toml
🔇 Additional comments (4)
src/ui/dpns/dpns_contested_names_screen.rs (4)

123-125: Added filter fields for DPNS contested names

Good addition of filter fields for the three types of contested names. These will improve the usability of the UI by letting users quickly find specific names.

Also applies to: 194-196


136-136: Added set_all_option for bulk voting

Nice addition of a set_all_option field initialized to VoteOption::CastNow to enable bulk operations on all identities.

Also applies to: 207-207


839-845: Improved display of awarded identifiers

Good UI enhancement for past contest identifier display, making it truncatable and hoverable for better visibility of long identifiers.


1329-1407: Added bulk voting options UI

Excellent UX improvement for setting voting options on all identities at once. The UI is clear and includes all necessary inputs for scheduling votes.

The implementation handles different voting options effectively and provides a clear way to apply settings to all identities.

@pauldelucia pauldelucia merged commit c8e38e5 into master Feb 25, 2025
@pauldelucia pauldelucia deleted the v0.8.2-dev branch February 25, 2025 08:04
@coderabbitai coderabbitai Bot mentioned this pull request Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants