Skip to content

UI fixes - new tokens tile#292

Merged
RanaBug merged 1 commit intostagingfrom
feat/PRO-3225/new-token-tiles
Apr 29, 2025
Merged

UI fixes - new tokens tile#292
RanaBug merged 1 commit intostagingfrom
feat/PRO-3225/new-token-tiles

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Apr 29, 2025

Description

  • UI fixes: - 0 should be null, text ellipsis for token names, arrow direction percentage fix

How Has This Been Tested?

  • Unit tests and manual testing

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary by CodeRabbit

  • Style

    • Improved layout and overflow handling for market data rows, ensuring better text truncation and alignment.
    • Enhanced icon display to indicate direction with rotation for downward trends.
  • New Features

    • Dollar signs are now consistently displayed before price, volume, and liquidity values in market data rows.
  • Tests

    • Updated test data to remove embedded dollar signs from raw values and adjusted assertions to expect dollar signs in rendered output.

@RanaBug RanaBug requested a review from IAmKio April 29, 2025 11:50
@RanaBug RanaBug self-assigned this Apr 29, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 29, 2025

Walkthrough

This set of changes standardizes how currency values are handled and displayed in the TokenMarketDataRow components and their associated tests. The code now ensures that raw data values for price, liquidity, and volume do not include a dollar sign, and the dollar sign is instead added explicitly in the rendering logic. Conditional rendering within the components has been refactored from short-circuit (&&) to ternary expressions with explicit null fallbacks. Several layout and CSS class adjustments have been made to improve overflow handling and alignment. Corresponding test data and assertions have been updated to match these new conventions.

Changes

File(s) Change Summary
.../LeftColumnTokenMarketDataRow.tsx Refactored conditional rendering from && to ternary with null; added truncation CSS classes; prepends $ to volume and liquidity values; no change to component interface.
.../RightColumnTokenMarketDataRow.tsx Updated conditional rendering to ternary with null; prepends $ to price; adds rotation to direction icon based on value; adds flex-shrink-0 class.
.../TokenMarketDataRow.tsx Adjusted layout classes for overflow and flex alignment; wraps left column in additional div for overflow handling; no change to public interface.
.../tests/LeftColumnTokenMarketDataRow.test.tsx
.../tests/RightColumnTokenMarketDataRow.test.tsx
.../TokensWithMarketDataTile/test/TokensWithMarketDataTile.test.tsx
Test data updated to remove dollar signs from raw values; assertions updated to expect dollar sign in rendered output; no logic or flow changes.

Sequence Diagram(s)

sequenceDiagram
    participant ParentComponent
    participant TokenMarketDataRow
    participant LeftColumn
    participant RightColumn

    ParentComponent->>TokenMarketDataRow: Passes raw market data (no $ in values)
    TokenMarketDataRow->>LeftColumn: Renders with volume/liquidity (adds $)
    TokenMarketDataRow->>RightColumn: Renders with price (adds $)
    LeftColumn-->>TokenMarketDataRow: Rendered JSX with $-prefixed values
    RightColumn-->>TokenMarketDataRow: Rendered JSX with $-prefixed values
    TokenMarketDataRow-->>ParentComponent: Composed row with formatted display
Loading

Suggested reviewers

  • IAmKio

Poem

A rabbit hopped through code so neat,
Dollar signs now where values meet.
With ternary checks and layouts tight,
Overflow hidden, all looks right.
Tests now match the new display,
Hip-hip-hooray for code today!
🐇💸


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1688714 and f933b48.

⛔ Files ignored due to path filters (5)
  • src/apps/pillarx-app/components/MediaGridCollection/tests/__snapshots__/DisplayCollectionImage.test.tsx.snap is excluded by !**/*.snap
  • src/apps/pillarx-app/components/PointsTile/test/__snapshots__/PointsTile.test.tsx.snap is excluded by !**/*.snap
  • src/apps/pillarx-app/components/TokenMarketDataRow/tests/__snapshots__/LeftColumnTokenMarketDataRow.test.tsx.snap is excluded by !**/*.snap
  • src/apps/pillarx-app/components/TokenMarketDataRow/tests/__snapshots__/RightColumnTokenMarketDataRow.test.tsx.snap is excluded by !**/*.snap
  • src/apps/pillarx-app/components/TokensWithMarketDataTile/test/__snapshots__/TokensWithMarketDataTile.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • src/apps/pillarx-app/components/TokenMarketDataRow/LeftColumnTokenMarketDataRow.tsx (2 hunks)
  • src/apps/pillarx-app/components/TokenMarketDataRow/RightColumnTokenMarketDataRow.tsx (1 hunks)
  • src/apps/pillarx-app/components/TokenMarketDataRow/TokenMarketDataRow.tsx (2 hunks)
  • src/apps/pillarx-app/components/TokenMarketDataRow/tests/LeftColumnTokenMarketDataRow.test.tsx (2 hunks)
  • src/apps/pillarx-app/components/TokenMarketDataRow/tests/RightColumnTokenMarketDataRow.test.tsx (2 hunks)
  • src/apps/pillarx-app/components/TokensWithMarketDataTile/test/TokensWithMarketDataTile.test.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: lint
  • GitHub Check: unit-tests
  • GitHub Check: build
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (18)
src/apps/pillarx-app/components/TokenMarketDataRow/TokenMarketDataRow.tsx (3)

33-33: Good use of CSS overflow handling properties.

Adding overflow-hidden to the container helps manage content that exceeds its boundaries, which is important for maintaining clean UI layout.


42-44: Great improvement for text truncation implementation.

Adding a wrapper div with min-w-0 overflow-hidden is the correct approach for enabling text truncation in flex layouts. The min-w-0 property allows the flex item to shrink below its content width when necessary.


46-46: Improved alignment for right column content.

The added flex alignment properties (flex items-end justify-end) ensure proper alignment of the right column content, providing better visual balance with the left column.

src/apps/pillarx-app/components/TokenMarketDataRow/tests/LeftColumnTokenMarketDataRow.test.tsx (2)

20-20: Good separation of data and presentation format.

Removing dollar signs from raw data values is a good practice. This separates the data from its presentation format, making the code more maintainable.

Also applies to: 25-25


50-50: Correctly updated test assertion for currency display.

The test now properly expects the dollar sign in the rendered output, consistent with the implementation changes in the component.

src/apps/pillarx-app/components/TokenMarketDataRow/tests/RightColumnTokenMarketDataRow.test.tsx (1)

20-20: Consistent removal of currency symbols from test data.

The removal of dollar signs from raw price and liquidity values is consistent with the standardization approach used in other files, improving code consistency.

Also applies to: 25-25, 55-55

src/apps/pillarx-app/components/TokensWithMarketDataTile/test/TokensWithMarketDataTile.test.tsx (2)

39-39: Consistently standardized currency data format.

Good job removing currency symbols from the raw test data across all test cases, which aligns with the project-wide standardization of handling currency values.

Also applies to: 45-45, 70-70, 75-75


136-136: Properly updated test assertions for currency display.

The test assertions now correctly expect dollar signs in the rendered output, verifying that the component is adding currency symbols during rendering rather than relying on them in the raw data.

Also applies to: 143-143

src/apps/pillarx-app/components/TokenMarketDataRow/RightColumnTokenMarketDataRow.tsx (5)

20-20: Good layout improvement with flex-shrink-0

Adding the flex-shrink-0 class prevents the right column from shrinking when space is constrained, maintaining the visual integrity of the price information.


22-28: Improved conditional rendering and price formatting

The switch from short-circuit evaluation to ternary operator with explicit null fallback prevents potential rendering issues with falsy values. Adding the dollar sign directly in the JSX makes the currency formatting more explicit and consistent.


32-46: Better visual indicator for price direction

The implementation of conditional rotation for the triangle icon provides clearer visual feedback about price direction. The transform style properly rotates the icon 180 degrees for "DOWN" direction, making the UI more intuitive.


47-52: Consistent conditional rendering for percentage

Using ternary operator with explicit null fallback aligns with the improved rendering pattern used throughout the component.


54-59: Consistent conditional rendering for transaction count

The rendering pattern is now consistent with other conditional elements in the component, improving code maintainability.

src/apps/pillarx-app/components/TokenMarketDataRow/LeftColumnTokenMarketDataRow.tsx (5)

46-55: Improved text rendering with overflow handling

Good changes here with two improvements:

  1. Switching to ternary operators with explicit null fallbacks for more consistent conditional rendering
  2. Adding truncation classes (truncate whitespace-nowrap overflow-hidden max-w-full) to the text2 container ensures long token names don't break the layout

The truncation addition aligns well with the PR objective of "implementing text ellipsis for token names to handle overflow."


56-65: Consistent conditional rendering for copy link

The switch to a ternary operator with explicit null fallback follows the pattern used throughout the components, improving code consistency.


68-72: Consistent conditional rendering for timestamp

The ternary operator pattern is now consistently applied to the timestamp rendering as well.


73-78: Improved volume formatting with dollar sign

Adding the dollar sign to the volume amount makes the currency format explicit in the UI rather than requiring it to be part of the data. This supports the PR objective of "treating zero values as null" by allowing cleaner data representation.


79-84: Improved liquidity formatting with dollar sign

Consistent with the volume and price formatting changes, adding the dollar sign here standardizes how currency values are displayed across the component.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ 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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

@cloudflare-workers-and-pages
Copy link

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: f933b48
Status: ✅  Deploy successful!
Preview URL: https://8e24d352.x-e62.pages.dev
Branch Preview URL: https://feat-pro-3225-new-token-tile.x-e62.pages.dev

View logs

Copy link
Collaborator

@IAmKio IAmKio left a comment

Choose a reason for hiding this comment

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

LGTM!

@RanaBug RanaBug merged commit a46c2ac into staging Apr 29, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request May 1, 2025
3 tasks
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