-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
fix(trading): fixed swap inputs validation and styling #17066
base: develop
Are you sure you want to change the base?
Conversation
...s/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx
Show resolved
Hide resolved
...s/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx
Outdated
Show resolved
Hide resolved
WalkthroughThis pull request introduces modifications to the trading module across several files. In the 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (10)
🔇 Additional comments (2)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (1)
packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx (1)
239-239
: Consider relying on form validation for empty address check.The additional
address === ''
check is redundant since the address field is already marked as required in the form validation (line 67). Theform.formState.isValid
check should be sufficient.- isDisabled={!form.formState.isValid || address === '' || callInProgress} + isDisabled={!form.formState.isValid || callInProgress}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/suite/src/hooks/wallet/trading/form/useTradingVerifyAccount.tsx
(1 hunks)packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
- GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
- GitHub Check: run-desktop-tests (@group=passphrase, trezor-user-env-unix)
- GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
- GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
- GitHub Check: build-web
- GitHub Check: Setup and Cache Dependencies
- GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
- GitHub Check: Analyze with CodeQL (javascript)
- GitHub Check: build-web
🔇 Additional comments (4)
packages/suite/src/hooks/wallet/trading/form/useTradingVerifyAccount.tsx (1)
75-77
: LGTM! The validation mode change improves user experience.Changing the form validation mode from 'onChange' to 'onTouched' aligns with the PR objectives and improves UX by showing validation errors only after user interaction.
Please verify that this change:
- Doesn't affect fields that might need immediate validation
- Works correctly with the form validation trigger on mount (line 160)
- Maintains expected behavior with
shouldValidate
flags insetValue
calls (lines 125, 127)packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx (3)
128-128
: LGTM! Improved spacing for better readability.The increased gap between Column components enhances the visual hierarchy and readability of the form.
147-174
: LGTM! Enhanced address input validation UX.The changes improve the user experience by:
- Only showing the address input after account selection
- Displaying error messages only after the user has interacted with the field
181-181
: LGTM! Consistent rendering behavior for extra fields.The extra field input now follows the same pattern as the address input, only showing after account selection.
...s/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx
Outdated
Show resolved
Hide resolved
...s/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx
Show resolved
Hide resolved
packages/suite/src/hooks/wallet/trading/form/useTradingVerifyAccount.tsx
Outdated
Show resolved
Hide resolved
This is extremely confusing, can we hide memo when buying to your own acc? @adderpositive |
This is how our send form now looks like for Ripple I am thinking that we should replicate it here with by default disabled What do you think @jirih-stsh? |
@tomasklim Yeah I agree. Lets copy the Ui from send, but keep the toggle disabled. Just be aware that currently in send, if you disable the toggle it will inject a warning banner instead bellow the input. Not sure if that will good look in swap. |
Let's do it without banner and without |
I don't know. Will there still be a possibility to fill the memo? |
There was a problem hiding this 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
🧹 Nitpick comments (1)
packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerifyDestinationTag.tsx (1)
41-43
: Add aria-label for better accessibility.The guide button should have an aria-label to improve accessibility for screen readers.
- <Button variant="tertiary" type="button" size="tiny" onClick={handleOpenGuide}> + <Button + variant="tertiary" + type="button" + size="tiny" + onClick={handleOpenGuide} + aria-label="Learn more about destination tag" + >
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/components/src/components/form/Switch/Switch.tsx
(1 hunks)packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx
(4 hunks)packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerifyDestinationTag.tsx
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
- GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
- GitHub Check: run-desktop-tests (@group=passphrase, trezor-user-env-unix)
- GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
- GitHub Check: Setup and Cache Dependencies
- GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
- GitHub Check: build-web
- GitHub Check: build-web
- GitHub Check: Analyze with CodeQL (javascript)
- GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
🔇 Additional comments (4)
packages/components/src/components/form/Switch/Switch.tsx (1)
66-70
: LGTM! Improved hover state selector specificity.The change from
:hover
to&:hover
is a good practice in styled-components as it makes the hover state more specific to the component and prevents unintended effects on nested elements.packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerifyDestinationTag.tsx (3)
1-13
: LGTM! Clean interface design with proper type safety.The imports are well-organized and the interface is clearly defined with appropriate types.
15-22
: LGTM! Implementation aligns with requirements.The component correctly initializes with the toggle disabled by default, as requested in the PR discussion.
33-49
: LGTM! Clean layout with proper conditional rendering.The layout is well-structured and the conditional rendering of the input component is implemented correctly. The use of a tertiary button for the guide link provides a good balance between accessibility and visual cleanliness.
@tomasklim Done Screen.Recording.2025-02-18.at.12.53.14.mov |
I also fixed #17071 as discussed with @jvaclavik |
/rebase |
Start rebasing: https://github.com/trezor/trezor-suite/actions/runs/13390482571 |
17005ad
to
8f0aeab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Related Issue
Resolve #16954
Resolve #17071
Screenshots:
Screen.Recording.2025-02-18.at.10.49.37.mov