Refactor swap min amount: move action to main button#1704
Conversation
DRadmir
commented
Feb 16, 2026
- Add useMinAmount case to SwapButtonAction
- Main button shows "Use Minimum Amount" and becomes active on InputAmountError
- Remove separate button from error section
- Update errorInfoAction to only handle NoQuoteAvailable
Summary of ChangesHello @DRadmir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the user experience for handling minimum amount errors in the swap flow. Instead of a secondary button appearing for 'Use Minimum Amount', this functionality is now integrated directly into the main swap button. This change aims to simplify the UI and provide a more intuitive interaction for users when an input amount error is detected, by making the primary action button contextually relevant. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The refactoring successfully moves the "Use Minimum Amount" action to the main button, which centralizes the primary user action and simplifies the error section. The logic for identifying the minimum amount error and applying it is correctly implemented. However, the priority of this action relative to the balance validation could be improved to ensure a better user experience when multiple issues exist.
| } | ||
|
|
||
| var buttonAction: SwapButtonAction { | ||
| if let useMinAmount { return useMinAmount } |
There was a problem hiding this comment.
The useMinAmount action currently takes precedence over the balance validation. If a user enters an amount that is both below the swapper's minimum and above their available balance, the button will suggest using the minimum amount. It is generally better to prioritize the insufficientBalance error, as the user cannot proceed with the swap regardless of the swapper's minimum amount if they lack the funds. Consider moving this check after the isAmountValid check.
- Add useMinAmount case to SwapButtonAction - Main button shows "Use Minimum Amount" and becomes active on InputAmountError - Remove separate button from error section - Update errorInfoAction to only handle NoQuoteAvailable
57925ba to
aa8db7c
Compare