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

feat(synapse-interface): update button states #2214

Merged
merged 22 commits into from
Mar 8, 2024
Merged

Conversation

bigboydiamonds
Copy link
Collaborator

@bigboydiamonds bigboydiamonds commented Mar 5, 2024

Description
Improve UX button states across Bridge, Swap, Pools, Stake flows

0af5d34fcff07e194d386a001c00ddb6a1e6c999: synapse-interface preview link
220555359708c26404b785fea8ae0d56628c8db3: synapse-interface preview link
dbf5fe00dd5b75284abe657f7fa39d052d3ba6e7: synapse-interface preview link
28719a3bfe06769ed915edb7465e04fd5b79a798: synapse-interface preview link
62889d79c452bc0d44c9a0741ce25ac70da53aa7: synapse-interface preview link
eabf49c8c86ca1af118deb74d774c3109d68bf9c: synapse-interface preview link
c277479c03e7c224bd80cd3f568a5283eb27a6f7: synapse-interface preview link
a3634a2c9d606feb830f0b13a2bc7ada2083bf98: synapse-interface preview link
8a8943dfcc4d2aeda19b00d59639d424db11dd6e: synapse-interface preview link
e40f098ffa079dd353cf56927657c0b971f04061: synapse-interface preview link
c6b9d9c52323b82c634962f0a6576a1bc093b97e: synapse-interface preview link

Summary by CodeRabbit

  • New Features

    • Enhanced the display of balances and rewards by trimming trailing zeroes after decimal points in the portfolio and stake sections.
  • Bug Fixes

    • Improved the logic for enabling/disabling buttons across various components (Swap, Bridge, Pool Management, and Stake) to ensure actions are only available when appropriate conditions are met.
  • Refactor

    • Adjusted formatting of CSS classes in the Pool Action Options for better readability and consistency.
    • Simplified the swap page by removing unused imports and variables.

239744517ca488faa6c8e7de54a679cfeaabf4db: synapse-interface preview link

Copy link
Contributor

coderabbitai bot commented Mar 5, 2024

Walkthrough

The updates aim to enhance user interface components in a software package by refining button behavior, improving numeric display through trimming trailing zeroes, and streamlining imports. These changes focus on enhancing readability, consistency, and user experience across various components like pools, portfolios, transactions, and staking interfaces.

Changes

Files Summary
.../Pools/PoolActionOptions.tsx Adjusted CSS class formatting for better readability.
.../Portfolio/.../PortfolioTokenAsset.tsx, .../stake/StakeCard.tsx Imported and used trimTrailingZeroesAfterDecimal for numeric displays.
.../StateManagedBridge/BridgeTransactionButton.tsx, .../StateManagedSwap/SwapTransactionButton.tsx, .../pool/poolManagement/WithdrawButton.tsx Updated button properties and disable conditions based on various checks like approval status, balance, and quote validity.
.../swap/index.tsx Streamlined imports by removing unused variables and adjusting constants.

🐇✨
In the realm of code where the synapses intertwine,
A rabbit hopped in, making the interface shine.
Trimming zeros with care, and buttons refined,
Enhancing the user's journey, with experience in mind.
🌟🐾

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>.
    • Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added size/s and removed size/xs labels Mar 5, 2024
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.84792%. Comparing base (f3cb57e) to head (7f00fbd).
Report is 10 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #2214         +/-   ##
===================================================
- Coverage   47.98060%   47.84792%   -0.13269%     
===================================================
  Files            364         360          -4     
  Lines          27013       26881        -132     
  Branches          83          83                 
===================================================
- Hits           12961       12862         -99     
+ Misses         12709       12680         -29     
+ Partials        1343        1339          -4     
Flag Coverage Δ
packages 90.62500% <ø> (ø)
promexporter ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

cloudflare-workers-and-pages bot commented Mar 5, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7f00fbd
Status: ✅  Deploy successful!
Preview URL: https://5a340ded.sanguine.pages.dev
Branch Preview URL: https://fe-button-states.sanguine.pages.dev

View logs

@bigboydiamonds bigboydiamonds changed the title [wip] Fe/button states Fe/button states Mar 7, 2024
@bigboydiamonds bigboydiamonds changed the title Fe/button states feat(synapse-interface): update button states Mar 7, 2024
Copy link
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.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 69b86e5 and c1fec51.
Files selected for processing (7)
  • packages/synapse-interface/components/Pools/PoolActionOptions.tsx (2 hunks)
  • packages/synapse-interface/components/Portfolio/components/PortfolioTokenAsset.tsx (2 hunks)
  • packages/synapse-interface/components/StateManagedBridge/BridgeTransactionButton.tsx (1 hunks)
  • packages/synapse-interface/components/StateManagedSwap/SwapTransactionButton.tsx (2 hunks)
  • packages/synapse-interface/pages/pool/poolManagement/WithdrawButton.tsx (2 hunks)
  • packages/synapse-interface/pages/stake/StakeCard.tsx (8 hunks)
  • packages/synapse-interface/pages/swap/index.tsx (3 hunks)
Files skipped from review due to trivial changes (1)
  • packages/synapse-interface/components/Pools/PoolActionOptions.tsx
Additional comments: 12
packages/synapse-interface/components/Portfolio/components/PortfolioTokenAsset.tsx (2)
  • 16-16: The import of trimTrailingZeroesAfterDecimal is correctly added to enhance the precision of displayed values by trimming trailing zeroes after decimal points. This aligns with the PR objectives to improve user experience.
  • 54-58: The usage of trimTrailingZeroesAfterDecimal within the updateFromValue dispatch call is a good practice. It ensures that the displayed values in the PortfolioTokenAsset component are formatted without unnecessary trailing zeroes, enhancing readability and precision. This change is consistent with the PR's goal to improve the user interface.
packages/synapse-interface/pages/pool/poolManagement/WithdrawButton.tsx (2)
  • 40-42: The addition of isValidInput and isValidQuote conditions to determine the button's enabled state is a significant improvement. It ensures that the button is only enabled when the input is valid, the quote is valid, and the balance is sufficient. This change enhances the user experience by preventing invalid or incomplete transactions.
  • 33-49: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [46-71]

The logic for setting buttonProperties based on various conditions (e.g., insufficient balance, loading state, wallet connection, chain mismatch, and approval status) is well-structured and comprehensive. It covers a wide range of scenarios that users might encounter, ensuring that the button's label and behavior are appropriate for each situation. This contributes to a more intuitive and responsive interface.

packages/synapse-interface/components/StateManagedSwap/SwapTransactionButton.tsx (2)
  • 57-60: The updated conditions for disabling the SwapTransactionButton are comprehensive, considering isLoading, isApproved, isConnected, sufficientBalance, and the validity of swapQuote. This ensures that the button is only enabled when all necessary prerequisites for a swap transaction are met, enhancing the user experience by preventing invalid operations.
  • 104-109: The logic for setting buttonProperties based on the approval status, loading state, and the presence of a valid quote is well-implemented. It provides clear feedback to the user about the action required (e.g., approving the token, executing the swap) and ensures that the button's behavior is consistent with the current state of the swap transaction. This contributes to a more intuitive and responsive interface for swapping operations.
packages/synapse-interface/components/StateManagedBridge/BridgeTransactionButton.tsx (1)
  • 146-146: The addition of a condition to check for isApproved, fromValueBigInt > 0, and bridgeQuote?.destQuery before setting buttonProperties is a thoughtful enhancement. It ensures that the button for approving the bridge transaction is only enabled when the user has a non-zero value to bridge, the transaction is approved, and there is a destination query available. This change makes the bridge functionality more robust and user-friendly by preventing incomplete or invalid transactions.
packages/synapse-interface/pages/stake/StakeCard.tsx (3)
  • 22-23: The addition of InteractiveInputRowButton and trimTrailingZeroesAfterDecimal imports is correctly done to support the updated functionality in the StakeCard component. These changes are in line with the PR's objectives to enhance the precision of displayed values and improve the user interface.
  • 146-154: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [136-166]

Replacing direct usage of formatBigIntToString with trimTrailingZeroesAfterDecimal for displaying balances and rewards is a significant improvement. It ensures that the displayed values are formatted without unnecessary trailing zeroes, enhancing readability and precision. This change aligns with the PR's goal to make the interface more user-friendly by improving the accuracy and usability of displayed information.

  • 265-294: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [172-372]

The updated logic for enabling/disabling buttons based on balance and reward values is well-implemented. It ensures that actions such as claiming rewards, staking, and unstaking are only available when appropriate, preventing users from attempting invalid operations. This contributes to a more intuitive and responsive interface for staking functionalities.

packages/synapse-interface/pages/swap/index.tsx (2)
  • 1-1: The removal of the useNetwork import from wagmi is a good decision if the chain variable is no longer used in this file. This change streamlines the codebase by eliminating unnecessary imports, contributing to the PR's objective of improving maintainability.
  • 45-45: The adjustment in the import of constants, specifically the inclusion of EMPTY_SWAP_QUOTE_ZERO from @/constants/swap, is appropriate given the context of the changes made in this file. It ensures that the necessary constants are available for use in the swap functionality, aligning with the PR's goal to enhance user interaction and interface responsiveness.

Copy link
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.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between c1fec51 and 7f00fbd.
Files selected for processing (1)
  • packages/synapse-interface/pages/stake/StakeCard.tsx (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/synapse-interface/pages/stake/StakeCard.tsx

@abtestingalpha abtestingalpha merged commit 90df2bf into master Mar 8, 2024
42 checks passed
@abtestingalpha abtestingalpha deleted the fe/button-states branch March 8, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants