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

(Deposit/Withdraw) Address design feedback for Bitcoin deposits and withdrawals #4010

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

JoseRFelix
Copy link
Collaborator

@JoseRFelix JoseRFelix commented Dec 12, 2024

What is the purpose of the change:

Implement the following feedback items from the design team:

  • Missing QR code close trigger
  • 0% fees → “Free”, and Remove 0% altogether in collapse header
  • “Continue” button text → “Confirm amount”
  • Address modal title → “Enter Bitcoin address”
  • “Done” button in address modal feels non-standard size and style
  • Line-heights too large in address input

Linear Task

https://linear.app/osmosis/issue/FE-1278/nomic-feedback

Testing and Verifying

  • Should display "Free" on expanded transfer details when fees are 0.
  • QR code should display "x" and should close when clicked.
  • Bitcoin withdrawal address input button should be displayed as "Confirm Amount."
  • Bitcoin withdrawal address modal title should display as "Enter Bitcoin Address."
  • "Done" button in bitcoin address input should match expected font size.
  • Nomic pending transfer status should update as tx updates arrive

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
osmosis-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 7:22am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
osmosis-frontend-datadog ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 7:22am
osmosis-frontend-dev ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 7:22am
osmosis-frontend-edgenet ⬜️ Ignored (Inspect) Dec 12, 2024 7:22am
osmosis-testnet ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 7:22am

@JoseRFelix JoseRFelix marked this pull request as ready for review December 12, 2024 07:14
@JoseRFelix JoseRFelix requested review from a team December 12, 2024 07:15
@JoseRFelix JoseRFelix changed the title feat: address Nomic design feedback (Deposit/Withdraw) Address Nomic design feedback Dec 12, 2024
@JoseRFelix JoseRFelix changed the title (Deposit/Withdraw) Address Nomic design feedback (Deposit/Withdraw) Address design feedback for Bitcoin deposits and withdrawals Dec 12, 2024
Copy link
Contributor

coderabbitai bot commented Dec 12, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/web/components/bridge/amount-screen.tsx

Oops! Something went wrong! :(

ESLint: 8.50.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/packages/web/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

Walkthrough

The pull request introduces several modifications across multiple components related to asset transfers. Key changes include updates to user interface elements, such as button text and modal titles, improved state management practices, and enhanced error handling. New components are added to streamline the display of transaction details, and visual adjustments are made to the layout and styling of existing components. These changes collectively aim to improve user interactions and the clarity of information presented during asset transfers.

Changes

File Path Change Summary
packages/web/components/bridge/amount-screen.tsx - Button text changed from "continue" to "confirmAmount" for withdrawal with manual address.
- Refined logic for asset dropdown visibility.
- Enhanced state management for network selection and wallet connections.
- Updated error handling for asset transfers.
packages/web/components/bridge/bridge-wallet-select-modal.tsx - Modal title updated from "transfer.inputBitcoinAddress" to "transfer.enterBitcoinAddress" for withdrawals to Bitcoin.
- Minor styling adjustment for Button component class name.
packages/web/components/bridge/deposit-address-screen.tsx - Added IconButton to close QR code display.
- Updated logic for displaying provider fees based on fee amount.
- Minor layout and styling adjustments.
- New components added for displaying transfer details and fees.
packages/web/components/input/textarea-box.tsx - Adjusted styling for textarea and trailing symbol by modifying padding classes.
packages/web/components/nomic/nomic-pending-transfers.tsx - Updated upsertTransaction method to enhance immutability of transactions state.
- Comment added for future feature regarding Bitcoin address retrieval.

Possibly related PRs

Suggested reviewers

  • CryptoAssassin1
  • jonator

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. (Experiment)
  • @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
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

🧹 Outside diff range and nitpick comments (3)
packages/web/components/bridge/amount-screen.tsx (1)

Line range hint 1-1180: Consider breaking down the component for better maintainability.

The AmountScreen component is quite large and handles multiple responsibilities. Consider the following improvements:

  1. Extract the chain selection logic into a separate component
  2. Move complex state management into custom hooks
  3. Split the transfer details into its own file

Example refactor for chain selection:

+ // chain-selector.tsx
+ export const ChainSelector: FunctionComponent<{
+   direction: "deposit" | "withdraw";
+   fromChain: BridgeChainWithDisplayInfo;
+   toChain: BridgeChainWithDisplayInfo;
+   onChainSelect: (chain: BridgeChainWithDisplayInfo) => void;
+ }> = ({ direction, fromChain, toChain, onChainSelect }) => {
+   // Extract chain selection logic here
+ };

  // amount-screen.tsx
  export const AmountScreen = observer(({ ... }) => {
-   // Chain selection logic
+   return (
+     <>
+       <ChainSelector
+         direction={direction}
+         fromChain={fromChain}
+         toChain={toChain}
+         onChainSelect={handleChainSelect}
+       />
+       {/* Rest of the component */}
+     </>
+   );
  });
packages/web/components/nomic/nomic-pending-transfers.tsx (2)

Line range hint 47-85: LGTM! Consider adding type safety for transaction IDs.

The state management improvements look good. Creating a new Map instance ensures proper immutability, and the optimization check prevents unnecessary re-renders. The logic for maintaining transaction history is well-implemented.

Consider creating a type for the transaction ID to improve type safety:

type TransactionId = string;

interface TransactionStore {
  transactions: Map<TransactionId, /* ... */>;
  transactionIds: Record<TransactionId, boolean>;
}

339-340: Implement Bitcoin origin address retrieval.

The TODO comment indicates a missing feature to display the source Bitcoin address for pending deposits. This information would improve transaction transparency for users.

Would you like me to help implement the Bitcoin address retrieval functionality? I can:

  1. Add the address field to the pending deposit type
  2. Update the state management to handle this new field
  3. Implement the UI to display the address
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2ed6cc5 and e7c836b.

⛔ Files ignored due to path filters (17)
  • packages/web/localizations/de.json is excluded by !**/*.json
  • packages/web/localizations/en.json is excluded by !**/*.json
  • packages/web/localizations/es.json is excluded by !**/*.json
  • packages/web/localizations/fa.json is excluded by !**/*.json
  • packages/web/localizations/fr.json is excluded by !**/*.json
  • packages/web/localizations/gu.json is excluded by !**/*.json
  • packages/web/localizations/hi.json is excluded by !**/*.json
  • packages/web/localizations/ja.json is excluded by !**/*.json
  • packages/web/localizations/ko.json is excluded by !**/*.json
  • packages/web/localizations/pl.json is excluded by !**/*.json
  • packages/web/localizations/pt-br.json is excluded by !**/*.json
  • packages/web/localizations/ro.json is excluded by !**/*.json
  • packages/web/localizations/ru.json is excluded by !**/*.json
  • packages/web/localizations/tr.json is excluded by !**/*.json
  • packages/web/localizations/zh-cn.json is excluded by !**/*.json
  • packages/web/localizations/zh-hk.json is excluded by !**/*.json
  • packages/web/localizations/zh-tw.json is excluded by !**/*.json
📒 Files selected for processing (5)
  • packages/web/components/bridge/amount-screen.tsx (1 hunks)
  • packages/web/components/bridge/bridge-wallet-select-modal.tsx (2 hunks)
  • packages/web/components/bridge/deposit-address-screen.tsx (4 hunks)
  • packages/web/components/input/textarea-box.tsx (2 hunks)
  • packages/web/components/nomic/nomic-pending-transfers.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/web/components/input/textarea-box.tsx
🔇 Additional comments (7)
packages/web/components/bridge/bridge-wallet-select-modal.tsx (2)

69-69: LGTM: Modal title updated per design feedback

The modal title has been updated to "Enter Bitcoin address" as requested in the design feedback.


581-581: LGTM: Button text styling updated

The button styling has been updated to ensure consistent font size using the !text-subtitle1 class.

packages/web/components/bridge/deposit-address-screen.tsx (3)

Line range hint 158-197: LGTM: QR code close button implementation

The close button has been properly implemented with:

  • Correct positioning using absolute positioning
  • Proper accessibility attributes (aria-label, data-testid)
  • Appropriate styling and hover states

453-458: LGTM: Fee display logic updated

The fee display logic has been updated to handle non-zero provider fees appropriately.


535-541: LGTM: Provider fee display updated per design feedback

The provider fee display now shows "Free" when the fee is zero, as requested in the design feedback.

packages/web/components/bridge/amount-screen.tsx (2)

1180-1180: LGTM: Button text change implemented correctly.

The button text change from "continue" to "confirmAmount" for Bitcoin withdrawals has been implemented as per the design feedback requirements.


Line range hint 1-1180: Verify coordination with related components.

This file implements the amount screen component, but some UI changes mentioned in the PR objectives (QR code close trigger, address modal title, etc.) should be coordinated with other components.

Let's verify the related component implementations:

✅ Verification successful

Based on the code analysis, I can now provide a final verification response:

UI changes have been properly implemented across components

The code shows that:

  • QR code close trigger is handled in QRCodeView component with proper state management
  • Bitcoin address modal title is correctly set in BridgeWalletSelectModal using transfer.enterBitcoinAddress translation key
  • Fee display shows "Free" text in ProviderFeesRow component when fee is zero
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for related component implementations

# Check for QR code close implementation
echo "Checking QR code close implementation..."
rg -A 5 "QRCode|qr-code" --type tsx

# Check for address modal title implementation
echo "Checking address modal title implementation..."
rg -A 5 "transfer\.enterBitcoinAddress" --type tsx

# Check for fee display implementation
echo "Checking fee display implementation..."
rg -A 5 "0%|Free" --type tsx

Length of output: 486


Script:

#!/bin/bash
# Let's try searching without file type restriction since tsx extension wasn't recognized

# Check for QR code close implementation
echo "Checking QR code close implementation..."
rg -A 5 "QRCode|qr-code"

# Check for address modal title implementation
echo "Checking address modal title implementation..."
rg -A 5 "transfer\.enterBitcoinAddress"

# Check for fee display implementation
echo "Checking fee display implementation..."
rg -A 5 "transfer\.free|0%"

# Let's also check for modal components that might contain these implementations
echo "Checking modal components..."
rg -A 5 "Modal.*bitcoin|bitcoin.*Modal"

Length of output: 68972


Script:

#!/bin/bash
# Let's search for specific components and their implementations

# Check for QR code component implementation
echo "Checking QR code component..."
fd -e tsx -e ts "qr-code" -x cat {}

# Check for Bitcoin address modal implementation
echo "Checking Bitcoin address modal..."
fd -e tsx -e ts "bridge-wallet-select-modal" -x cat {}

# Check for fee display implementation in quote details
echo "Checking fee display in quote details..."
fd -e tsx -e ts "quote-detail" -x cat {}

Length of output: 37744

@JoseRFelix JoseRFelix merged commit 9b111d0 into stage Dec 12, 2024
34 of 35 checks passed
@JoseRFelix JoseRFelix deleted the jose/fe-1278-nomic-feedback branch December 12, 2024 21:03
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.

3 participants