Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: denom info modal #37

Merged
merged 3 commits into from
Nov 13, 2024
Merged

Conversation

fmorency
Copy link
Contributor

@fmorency fmorency commented Nov 13, 2024

This PR reworks the UI of the denom info modal to keep only the token name, ticker, and description.

Fixes #29

2024-11-13_10-40
2024-11-13_10-40_1
2024-11-13_11-04

Summary by CodeRabbit

  • New Features

    • Simplified layout for the DenomInfoModal component, consolidating denomination details for easier viewing.
    • Updated labels for denomination attributes to enhance clarity (e.g., "Ticker" instead of "SYMBOL").
    • Enhanced styling flexibility with the addition of a className prop in the InfoItem component.
    • Adjusted address display format for improved readability.
  • Bug Fixes

    • Removed unnecessary sections and details for a cleaner presentation of denomination information.

@fmorency fmorency requested a review from chalabi2 November 13, 2024 15:43
@fmorency fmorency self-assigned this Nov 13, 2024
Copy link
Contributor

coderabbitai bot commented Nov 13, 2024

Walkthrough

The changes in the denomInfo.tsx file involve a complete overhaul of the DenomInfoModal component's structure and presentation. The layout has been simplified to focus on key attributes: "Name" and "Ticker," while removing less critical details such as "EXPONENT," "DENOM," and the mapping of denom_units. The InfoItem component has been updated to accept an optional className prop for enhanced styling flexibility.

Changes

File Change Summary
components/factory/modals/denomInfo.tsx Simplified DenomInfoModal layout; removed "EXPONENT," "DENOM," and denom_units mapping; updated InfoItem to include className prop.
components/bank/components/tests/tokenList.test.tsx Updated text assertions for token details in tests to reflect changes in terminology from "NAME," "SYMBOL," "DESCRIPTION," and "EXPONENT" to "Name," "Ticker," and "Description." Removed assertion for "EXPONENT."

Assessment against linked issues

Objective Addressed Explanation
Keep only Name, Ticker, and Description (29)

🐰 In the meadow where the numbers play,
A modal shines in a simpler way.
With "Name" and "Ticker" bright and clear,
We hop along without a fear!
Less clutter, more joy, oh what a sight,
A streamlined view, everything feels right! 🌼


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 27fc1f3 and 1d95cfe.

📒 Files selected for processing (2)
  • components/bank/components/__tests__/tokenList.test.tsx (1 hunks)
  • components/factory/modals/denomInfo.tsx (3 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
components/factory/modals/denomInfo.tsx

[warning] 14-14: components/factory/modals/denomInfo.tsx#L14
Added line #L14 was not covered by tests


[warning] 71-71: components/factory/modals/denomInfo.tsx#L71
Added line #L71 was not covered by tests


[warning] 79-79: components/factory/modals/denomInfo.tsx#L79
Added line #L79 was not covered by tests

🔇 Additional comments (5)
components/factory/modals/denomInfo.tsx (4)

12-15: Add test coverage for factory address detection logic

The new condition for detecting factory addresses lacks test coverage. Additionally, consider making the prefix check more robust.

-  if (denom?.name.startsWith('factory/manifest1')) {
+  const FACTORY_PREFIX = 'factory/manifest1';
+  if (denom?.name?.toLowerCase().startsWith(FACTORY_PREFIX)) {

Let me help you write test cases for this logic. Would you like me to generate them?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 14-14: components/factory/modals/denomInfo.tsx#L14
Added line #L14 was not covered by tests


35-43: LGTM! Clean implementation of the simplified modal

The changes perfectly align with the PR objectives, providing a cleaner interface with just the essential information. Good use of fallback values and appropriate text transformations.


58-68: LGTM! Good styling improvements

The addition of the optional className prop and full-height styling enhances the component's flexibility and consistency.


71-84: Add test coverage for address display and external link functionality

The external link implementation and address truncation logic lack test coverage. This should be tested to ensure proper functionality across different address formats.

Run this script to check existing test coverage for similar components:

Would you like me to help generate test cases for:

  1. Address truncation with the new slice length
  2. External link generation with the explorer URL
  3. Accessibility attributes for the external link?
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 71-71: components/factory/modals/denomInfo.tsx#L71
Added line #L71 was not covered by tests


[warning] 79-79: components/factory/modals/denomInfo.tsx#L79
Added line #L79 was not covered by tests

components/bank/components/__tests__/tokenList.test.tsx (1)

86-88: LGTM! Test assertions correctly updated for new modal labels.

The test assertions have been properly updated to match the simplified modal design showing only Name, Ticker, and Description fields.

Let's verify if there are any remaining test assertions for removed fields that need cleanup:

✅ Verification successful

Test assertions are properly cleaned up, no remaining references to removed fields

After reviewing the complete test file, I can confirm that all test assertions have been properly updated. The modal test now only checks for the simplified fields (Name, Ticker, Description) and there are no lingering assertions for removed fields like EXPONENT or DENOM_UNITS. While these fields exist in the mock data structure, they are not being tested in any assertions, which is correct.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining test assertions related to removed fields
# like EXPONENT, DENOM, or denom_units in test files

rg -i "expect\(.*?(exponent|denom_units)" --type ts,tsx "components/bank"

Length of output: 104


Script:

#!/bin/bash
# Search for any remaining test assertions related to removed fields
# Correcting the file type flags and expanding the search patterns

rg -t tsx -t ts "expect.*?(EXPONENT|exponent|denom_units|DENOM_UNITS)" components/bank/

Length of output: 117


Script:

#!/bin/bash
# Search for any remaining test assertions related to removed fields
# Using simpler ripgrep syntax without file type flags

rg "expect.*?(EXPONENT|exponent|denom_units|DENOM_UNITS)" "components/bank/__tests__" "components/bank/components/__tests__"

Length of output: 188


Script:

#!/bin/bash
# First, let's find the correct test file locations
fd "test.tsx" components/bank/

# Then search for any remaining test assertions related to removed fields
# Using a broader search to find any test expectations
rg "expect.*?(EXPONENT|exponent|denom|DENOM)" $(fd "test.tsx" components/bank/)

Length of output: 650


Script:

#!/bin/bash
# Let's examine the content of the tokenList test file to see all expectations
cat components/bank/components/__tests__/tokenList.test.tsx

Length of output: 3596


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 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

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.

Project coverage is 59.24%. Comparing base (a93ab38) to head (1d95cfe).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
components/factory/modals/denomInfo.tsx 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
- Coverage   59.39%   59.24%   -0.15%     
==========================================
  Files         148      148              
  Lines       13830    13811      -19     
==========================================
- Hits         8214     8183      -31     
- Misses       5616     5628      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fmorency fmorency merged commit 498a93b into liftedinit:main Nov 13, 2024
4 checks passed
@fmorency fmorency deleted the fix-denom-details branch November 13, 2024 21:22
Copy link
Collaborator

@chalabi2 chalabi2 left a comment

Choose a reason for hiding this comment

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

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Denom detail modal update
2 participants