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

cashout-fix: disable cashout inputs when not available + minor FAQ issue #411

Merged
merged 6 commits into from
Oct 4, 2024

Conversation

nezz0746
Copy link

@nezz0746 nezz0746 commented Oct 3, 2024

  • Disabled all inputs in cashout when not availble for a specific chain
  • Adding a KYC link in FAQ
  • Fixing small typo
  • Made entire TokenAmountInput clickable & focus on input

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced FAQ section with a direct link to KYC information for improved user navigation.
    • Improved cashout eligibility feedback based on selected chain, with visual indicators for enabled/disabled states.
    • Added click handling to the token amount input form for better user interaction.
  • Bug Fixes

    • Simplified rendering of cashout eligibility warnings for better clarity.
  • Style

    • Updated styling for bank account selection and cashout button to reflect cashout permissions dynamically.
    • Improved cursor indication on the token amount input form to enhance user experience.

Copy link

vercel bot commented Oct 3, 2024

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

Name Status Preview Comments Updated (UTC)
peanut-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 7:16am

Copy link

coderabbitai bot commented Oct 3, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request introduce enhancements to the cashout components in the application. A new hyperlink for KYC information is added to the FAQ section, improving user navigation. Additionally, the logic for cashout eligibility based on the selected blockchain is refined in the InitialCashoutView component, incorporating conditional styling and disabling inputs based on whether cashout is allowed. Furthermore, the TokenAmountInput component is updated to enhance user interaction through improved click handling.

Changes

File Path Change Summary
src/components/Cashout/Components/Faq.comp.tsx Added import for Link from next/link. Updated KYC text to include a hyperlink. Minor capitalization change in fee description.
src/components/Cashout/Components/Initial.view.tsx Added import for twMerge. Introduced xchainAllowed logic for cashout eligibility. Updated class names and button states based on eligibility. Simplified warning message rendering.
src/components/Global/TokenAmountInput/index.tsx Added formRef for managing form element and handleContainerClick for focusing input on form click. Updated form class name for interactivity.

Possibly related PRs

Suggested reviewers

  • Hugo0

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.

@nezz0746 nezz0746 added the Being worked on Being worked on label Oct 3, 2024
@nezz0746 nezz0746 self-assigned this Oct 3, 2024
Copy link

@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)
src/components/Cashout/Components/Faq.comp.tsx (1)

26-30: LGTM: KYC link added to FAQ

The addition of the Link component for the KYC text improves user experience by providing easy access to KYC information, as outlined in the PR objectives.

Consider adding an aria-label to the Link component for improved accessibility. For example:

- <Link href="/kyc" className="text-blue-600 underline">
+ <Link href="/kyc" className="text-blue-600 underline" aria-label="Learn more about KYC (Know Your Customer)">
src/components/Cashout/Components/Initial.view.tsx (2)

38-40: LGTM: cannotCashoutOnSelectedChain constant added

The addition of this constant improves code readability and centralizes the logic for determining cashout availability. This aligns well with the PR objective of disabling cashout inputs when not available for a specific blockchain chain.

However, there's a minor optimization that can be made:

Consider removing the redundant Boolean call:

 const cannotCashoutOnSelectedChain =
-    !Boolean(crossChainDetails.find((chain: any) => chain.chainId.toString() === selectedChainID.toString())) ||
+    !crossChainDetails.find((chain: any) => chain.chainId.toString() === selectedChainID.toString()) ||
     selectedChainID === '1'

This change doesn't affect the logic but makes the code slightly cleaner.

🧰 Tools
🪛 Biome

[error] 39-39: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)


388-389: LGTM: "Proceed" button and warning messages updated

The changes to the "Proceed" button's disabled condition and the addition of a new warning message effectively implement the PR objective of preventing interactions with unavailable cashout options. This improves the user experience by providing clear feedback.

Consider enhancing the warning message to provide more specific information:

 {cannotCashoutOnSelectedChain && (
     <span className=" text-h8 font-normal ">
-        <ChakraIcon name="warning" className="-mt-0.5" /> You cannot cashout on this chain.
+        <ChakraIcon name="warning" className="-mt-0.5" /> Cashout is not available on the selected chain. Please choose a supported chain to proceed.
     </span>
 )}

This change provides more context to the user and guides them towards a solution.

Also applies to: 418-422

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0c1cc83 and 2921866.

📒 Files selected for processing (2)
  • src/components/Cashout/Components/Faq.comp.tsx (2 hunks)
  • src/components/Cashout/Components/Initial.view.tsx (8 hunks)
🧰 Additional context used
🪛 Biome
src/components/Cashout/Components/Initial.view.tsx

[error] 39-39: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

🔇 Additional comments (8)
src/components/Cashout/Components/Faq.comp.tsx (3)

4-4: LGTM: New import for Link component

The addition of the Link import from 'next/link' is appropriate for implementing the KYC link in the FAQ section, as mentioned in the PR objectives.


36-36: LGTM: Capitalization fix in fee description

The capitalization of "We" in the fee description has been corrected, addressing the minor typographical error mentioned in the PR objectives. This change enhances the overall quality of the FAQ text.


Line range hint 1-48: Verify implementation of disabling cashout inputs

The changes in this file address the addition of the KYC link to the FAQ and fix the minor typographical error, as mentioned in the PR objectives. However, the implementation for disabling cashout inputs when they are not available is not present in this file.

To ensure all PR objectives are met, please run the following script to check for the implementation of disabling cashout inputs:

src/components/Cashout/Components/Initial.view.tsx (5)

21-21: LGTM: Import of twMerge added

The addition of the twMerge import from 'tailwind-merge' is appropriate for the conditional styling changes made in the component.


268-276: LGTM: Bank account selection UI updated

The changes to the bank account selection UI effectively implement the PR objective of disabling cashout inputs when not available. The use of twMerge for conditional styling and the added check before allowing selection are well-implemented.


320-324: LGTM: New bank account input UI updated

The changes to the new bank account input UI effectively implement the PR objective of disabling cashout inputs when not available. The use of twMerge for conditional styling and the addition of the disabled attribute ensure that the input is both visually and functionally disabled when cashout is not available on the selected chain.

Also applies to: 329-332, 339-339


349-354: LGTM: Bank account input UI for non-authenticated users updated

The changes to the bank account input UI for non-authenticated users mirror those made for authenticated users, ensuring consistent behavior across the application. The use of twMerge for conditional styling and the addition of the disabled attribute effectively implement the PR objective of disabling cashout inputs when not available.

Also applies to: 358-361, 368-368


Line range hint 1-424: Overall assessment: Well-implemented changes

The modifications in this file effectively achieve the PR objective of disabling cashout inputs when they are not available for a specific blockchain chain. The implementation is consistent across different parts of the component, including the bank account selection, new bank account input, and the "Proceed" button.

Key points:

  1. The introduction of cannotCashoutOnSelectedChain centralizes the logic for determining cashout availability.
  2. The use of twMerge for conditional styling provides clear visual cues to the user.
  3. Proper disabling of inputs and the "Proceed" button prevents unintended interactions.
  4. The addition of a warning message improves user feedback.

The suggested minor improvements, if implemented, will further enhance the code quality and user experience. Great job on this implementation!

Copy link

@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 (1)
src/components/Global/TokenAmountInput/index.tsx (1)

51-54: Approve form element changes with a minor suggestion.

The modifications to the form element enhance user interaction and align with the PR objectives:

  1. The ref={formRef} addition is consistent with the earlier formRef declaration.
  2. Adding cursor-text to the className improves visual feedback.
  3. The onClick={handleContainerClick} implementation adds the desired focus functionality.

These changes effectively improve the user experience as intended.

Consider using the onMouseDown event instead of onClick for a more responsive user experience:

-            onClick={handleContainerClick}
+            onMouseDown={handleContainerClick}

This change will trigger the focus immediately on mouse press, rather than waiting for the click to complete.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2921866 and 02edd31.

📒 Files selected for processing (1)
  • src/components/Global/TokenAmountInput/index.tsx (1 hunks)
🔇 Additional comments (3)
src/components/Global/TokenAmountInput/index.tsx (3)

43-47: LGTM: handleContainerClick improves user experience.

The handleContainerClick function is a good addition that enhances user interaction by focusing the input when the container is clicked. It correctly uses the inputRef and follows React best practices.


Line range hint 1-124: Summary: PR objectives achieved with minor suggestions for improvement.

This PR successfully implements the changes to improve user experience in the TokenAmountInput component. The modifications align with the stated objectives by enhancing input interaction and visual feedback.

Key improvements:

  1. Added click-to-focus functionality for better user interaction.
  2. Updated cursor style to indicate interactivity.

While the changes effectively meet the PR goals, consider the following suggestions:

  1. Verify the usage of formRef and remove if unused.
  2. Consider using onMouseDown instead of onClick for more responsive focus behavior.

Overall, the implementation is sound and follows React best practices. Great job on improving the component's functionality!


41-42: Approve formRef addition, but verify its usage.

The addition of formRef is a good practice for accessing the form element directly. However, it doesn't appear to be used elsewhere in the component.

Let's verify if formRef is used elsewhere in the codebase:

If formRef is indeed unused, consider removing it to keep the code clean.

✅ Verification successful

Confirm formRef usage within the component.

The formRef is correctly used as a reference to the form element in the TokenAmountInput component. However, there was an issue checking its usage in other files due to an unrecognized file type. Please run the following corrected script to ensure formRef isn't used elsewhere:


Confirm formRef usage is confined to the component.

The formRef is correctly used within the TokenAmountInput component. To ensure it's not utilized elsewhere, please run the following corrected script:


Confirm formRef usage is confined to the component.

The formRef is correctly used within the TokenAmountInput component. To ensure it's not utilized elsewhere, please run the following corrected script:


formRef is correctly used within the component and not referenced elsewhere.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if formRef is used elsewhere in the component or other files

# Test 1: Check usage within this file
echo "Checking usage within TokenAmountInput component:"
rg "formRef" src/components/Global/TokenAmountInput/index.tsx

# Test 2: Check usage in other files
echo "Checking usage in other files:"
rg "formRef" --type typescript --type tsx

Length of output: 394


Script:

#!/bin/bash
# Description: Check if formRef is used elsewhere in the component or other files

# Test 1: Check usage within this file
echo "Checking usage within TokenAmountInput component:"
rg "formRef" src/components/Global/TokenAmountInput/index.tsx

# Test 2: Check usage in other files
echo "Checking usage in other files:"
rg "formRef" --type ts --type tsx

Length of output: 379


Script:

#!/bin/bash
# Description: Check if formRef is used elsewhere in the component or other files

# Test 1: Check usage within this file
echo "Checking usage within TokenAmountInput component:"
rg "formRef" src/components/Global/TokenAmountInput/index.tsx

# Test 2: Check usage in other files
echo "Checking usage in other files:"
rg "formRef" --type typescript --type typescriptreact

Length of output: 406


Script:

#!/bin/bash
# Description: Check if formRef is used elsewhere in the component or other files

# Test 1: Check usage within this file
echo "Checking usage within TokenAmountInput component:"
rg "formRef" src/components/Global/TokenAmountInput/index.tsx

# Test 2: Check usage in other files
echo "Checking usage in other files:"
rg "formRef" -g "*.ts" -g "*.tsx"

Length of output: 525

Cashing out requires KYC. <br></br>Min cashout: $10, max $100k.
Cashing out requires{' '}
<Link href="/kyc" className="text-blue-600 underline">
KYC

Choose a reason for hiding this comment

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

praise: awesome to see a QA item in code so fast!

Copy link
Contributor

Choose a reason for hiding this comment

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

💯

Copy link

@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: 2

🧹 Outside diff range and nitpick comments (1)
src/components/Cashout/Components/Initial.view.tsx (1)

41-43: Improve Type Safety by Typing crossChainDetails

Currently, chain is typed as any in the find method. To enhance type safety and leverage TypeScript's benefits, define a proper type for chain.

Apply this diff:

 const xchainAllowed = useMemo(
-    () => Boolean(crossChainDetails.find((chain: any) => chain.chainId.toString() === selectedChainID.toString())),
+    () => Boolean(crossChainDetails.find((chain: { chainId: number }) => chain.chainId.toString() === selectedChainID.toString())),
     [crossChainDetails, selectedChainID]
 )

Alternatively, consider defining an interface or type for crossChainDetails items.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 02edd31 and b7ded0e.

📒 Files selected for processing (1)
  • src/components/Cashout/Components/Initial.view.tsx (6 hunks)
🔇 Additional comments (1)
src/components/Cashout/Components/Initial.view.tsx (1)

409-412: Clear User Feedback When Cashout Is Not Allowed

Displaying a warning message when cashout is not allowed effectively informs the user.

src/components/Cashout/Components/Initial.view.tsx Outdated Show resolved Hide resolved
src/components/Cashout/Components/Initial.view.tsx Outdated Show resolved Hide resolved
Copy link

@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)
src/components/Cashout/Components/Initial.view.tsx (3)

260-269: Enhanced UI feedback for cashout availability

The changes to the bank account selection UI effectively communicate cashout availability to the user:

  1. Conditional styling based on xchainAllowed improves visual feedback.
  2. Disabling the click functionality when cashout is not allowed prevents user confusion.

These updates enhance the user experience by providing clear visual and interactive cues.

Consider adding an aria-disabled attribute when xchainAllowed is false to improve accessibility:

 <div
     key={index}
     className={twMerge(
         'flex w-full  items-center justify-between border border-black p-2',
         selectedBankAccount === account.account_identifier
             ? 'bg-purple-1'
             : 'hover:bg-gray-100',
         xchainAllowed && 'cursor-pointer',
         !xchainAllowed && 'opacity-60'
     )}
+    aria-disabled={!xchainAllowed}
     onClick={() => {
         if (!xchainAllowed) return
         // ... rest of the onClick handler
     }}
 >

313-318: Consistent UI treatment for new bank account input

The changes to the new bank account input UI align well with the bank account selection UI:

  1. Conditional styling based on xchainAllowed provides consistent visual feedback.
  2. Disabling the input when cashout is not allowed prevents user interaction.

These updates maintain a cohesive user experience across different input methods.

For consistency with the bank account selection UI, consider adding cursor-not-allowed when xchainAllowed is false:

 <div
     className={twMerge(
         'flex w-full border border-black p-2',
         xchainAllowed && 'cursor-pointer',
-        !xchainAllowed && 'opacity-60'
+        !xchainAllowed && 'opacity-60 cursor-not-allowed'
     )}
 >

Also applies to: 323-326, 333-333


Line range hint 412-416: Clear warning message for unavailable cashout

The addition of a warning message when cashout is not available is a good improvement:

  1. It provides explicit feedback to the user about why they can't proceed with the cashout.
  2. The message complements the visual cues provided by the disabled UI elements.

This change enhances the user experience by clearly communicating the reason for the unavailable cashout option.

Consider providing more specific information about why cashout is not available on the current chain:

 {!xchainAllowed && (
     <span className=" text-h8 font-normal ">
         <ChakraIcon name="warning" className="-mt-0.5" />
-        You cannot cashout on this chain.
+        Cashout is not available on the current chain. Please switch to a supported chain to proceed.
     </span>
 )}

This more detailed message could help users understand what action they need to take to enable cashout.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b7ded0e and 5a6c6a5.

📒 Files selected for processing (1)
  • src/components/Cashout/Components/Initial.view.tsx (6 hunks)
🔇 Additional comments (3)
src/components/Cashout/Components/Initial.view.tsx (3)

21-21: Improved styling management and chain compatibility check

The addition of twMerge and the xchainAllowed constant are good improvements:

  1. twMerge will help manage Tailwind CSS classes more efficiently, reducing conflicts and improving maintainability.
  2. xchainAllowed centralizes the logic for determining cashout availability on the selected chain, which can be reused throughout the component.

These changes enhance code readability and maintainability.

Also applies to: 40-43


Line range hint 380-380: Consistent disabling of "Proceed" button

The addition of !xchainAllowed to the button's disabled condition is a good change:

  1. It prevents users from attempting to proceed when cashout is not available on the selected chain.
  2. This change maintains consistency with the other UI elements that are disabled when xchainAllowed is false.

This update completes the user experience by ensuring all relevant UI elements respect the cashout availability.


Line range hint 1-418: Summary: Comprehensive implementation of cashout availability checks

The changes in this file effectively implement a consistent check for cashout availability across the UI:

  1. The xchainAllowed constant centralizes the logic for determining cashout availability.
  2. UI elements (bank account selection, new bank account input, and "Proceed" button) are consistently disabled when cashout is not available.
  3. Visual feedback is provided through conditional styling and opacity changes.
  4. An explicit warning message informs users when cashout is not available on the current chain.
  5. The use of twMerge improves the management of conditional Tailwind CSS classes.

These changes significantly enhance the user experience by providing clear feedback and preventing invalid actions when cashout is not available on the selected chain.

@nezz0746 nezz0746 removed the Being worked on Being worked on label Oct 3, 2024
Copy link

@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 (2)
src/components/Cashout/Components/Initial.view.tsx (2)

269-276: LGTM: Updated UI elements with twMerge

The use of twMerge for conditional styling based on xchainAllowed is well-implemented:

  • Dynamic class application enhances the UI responsiveness to the cashout availability.
  • Cursor style, opacity, and input state are correctly managed based on xchainAllowed.

For consistency, consider applying the same hover:bg-gray-100 class to the new bank account input div when xchainAllowed is true, similar to the bank account selection div.

Also applies to: 322-327, 332-335


Line range hint 421-425: LGTM: New warning message for disallowed cashout

The addition of a warning message when cashout is not allowed on the selected chain is well-implemented:

  • The message is clear and consistent with other warnings in the component.
  • The condition for displaying the message is correct.

Consider providing more specific information in the warning message, such as "Cashout is not available on [chain name]" or "Please switch to a supported chain for cashout". This would give users more context and guidance on how to proceed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5a6c6a5 and 0f780c4.

📒 Files selected for processing (3)
  • src/components/Cashout/Components/Faq.comp.tsx (2 hunks)
  • src/components/Cashout/Components/Initial.view.tsx (7 hunks)
  • src/components/Global/TokenAmountInput/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/Cashout/Components/Faq.comp.tsx
  • src/components/Global/TokenAmountInput/index.tsx
🔇 Additional comments (3)
src/components/Cashout/Components/Initial.view.tsx (3)

21-21: LGTM: New import and xchainAllowed constant

The addition of the twMerge import and the xchainAllowed constant are well-implemented:

  • The twMerge import will be useful for conditional class merging.
  • The xchainAllowed constant effectively encapsulates the logic for determining cashout availability.
  • Using useMemo for xchainAllowed is a good optimization.

Also applies to: 40-52


Line range hint 386-391: LGTM: Updated cashout button disabled state

The addition of !xchainAllowed to the button's disabled conditions is correct and consistent with the overall changes. It ensures that the button is disabled when cashout is not allowed on the selected chain, while preserving other necessary conditions.


Line range hint 1-426: Summary: Well-implemented cashout availability check

The changes in this file effectively implement a new cashout availability check based on the selected chain:

  1. The new xchainAllowed constant encapsulates the logic for determining cashout availability.
  2. UI elements are consistently updated to reflect the cashout availability status, including:
    • Conditional styling for bank account selection and input
    • Disabling the cashout button when not allowed
    • Displaying a warning message for unsupported chains
  3. The implementation uses twMerge for efficient conditional styling and useMemo for performance optimization.

These changes improve the user experience by providing clear visual feedback and preventing interactions when cashout is not available on the selected chain.

Great job on implementing this feature! The code is clean, consistent, and improves the overall functionality of the cashout process.

Copy link
Contributor

@Hugo0 Hugo0 left a comment

Choose a reason for hiding this comment

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

Lgtm! Let's merge and QA 🫡

Cashing out requires KYC. <br></br>Min cashout: $10, max $100k.
Cashing out requires{' '}
<Link href="/kyc" className="text-blue-600 underline">
KYC
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

</p>
<br></br>
<p>Fees:</p>
<ul className="list-disc pl-5">
<li>Peanut sponsors gas</li>
<li>we have to charge a $1 fee for EU cashouts, and $0.5 for US transfers</li>
<li>We have to charge a $1 fee for EU cashouts, and $0.5 for US transfers</li>
Copy link
Contributor

Choose a reason for hiding this comment

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

we have to xd

Comment on lines -31 to -32
setRecipient,
recipient,
Copy link
Contributor

Choose a reason for hiding this comment

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

thought: both setRecipient and recipient are now not-used in InitialCashoutView now. We should prob clean it up

@@ -49,10 +46,10 @@ export const InitialCashoutView = ({
* There may be chains that are not supported to conduct that cross-chain operation (e.g., due to gas costs,
* business strategy, etc.), so we'd like to block user action in that case.
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: nice comment

@@ -269,12 +266,16 @@ export const InitialCashoutView = ({
?.map((account, index) => (
<div
key={index}
className={`flex w-full cursor-pointer items-center justify-between border border-black p-2 ${
className={twMerge(
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: nice use of twMerge

Comment on lines +273 to 277
: 'hover:bg-gray-100',
xchainAllowed && 'cursor-pointer',
!xchainAllowed && 'opacity-60'
)}
onClick={() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

thought: this logic doesn't seem super legible

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