-
Notifications
You must be signed in to change notification settings - Fork 100
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
ui: Order submit button state management #2534
Conversation
6769d5b
to
0e97533
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.
For other reasons why a user would not be able to trade, such as the bond pending or one of the wallets not yet being created, we are removing the order form completely. See resolveOrderFormVisibility
in markets.ts
. Instead of the order form, there is a large message displayed saying why the user cannot trade.
Personally, I don't think the order form should be shown if the user has no balance in either of the assets. Why should they be entering a rate and # of lots if they cannot trade anyways? Also, if only one of the assets has a balance, then you can just grey out the Buy/Sell button on top that switches to the other side of the market.
Thoughts? @buck54321 @JoeGruffins ?
For markets involving ETH/Tokens, if there is no ETH balance in the wallet, then the user will not be able to trade at all, even if they are buying ETH or the ETH token. The user needs ETH to redeem. |
A new user will most likely want to click around to discover the UI/UX before depositing funds - if they can't find the order form anywhere that's unusual/confusing and will likely to generate support questions. What problem would the hidden form solve? |
0e97533
to
6bbd0c6
Compare
Never mind, you're right, it's better like this. I do notice a few issues though:
Screen.Recording.2023-10-01.at.10.22.45.PM.mov |
8a388a7
to
c9fbf92
Compare
Fixed the cursor to
Solved - when switching markets the button changes to a disabled state as the form values are cleared.
The button state updates correctly now, also refactored the update logic to make the changes more readable. |
Screen.Recording.2023-10-06.at.12.20.48.AM.movScreen.Recording.2023-10-06.at.12.47.51.AM.movFor me the tooltip still looks the same. Also, I noticed that the market order section is broken. For market buys, the button is always disabled, even if the balance is enough. The market sells button also has some strange behavior you can see in the videos. |
8c5e795
to
9d147bb
Compare
Thanks for testing this, the bug causing those issues is fixed. I've also added a test for the rate field being non-zero, and sorted the problem of the UI not always being updated when a new balanceNote came in. |
The logic looks good now. How do you feel about this clean up though? 0487795 Also, the hover over the button still has the same behavior for me. I see that error icon for a bit before the tooltip shows up. How do you feel about just updating the button text? |
Thanks for that, added.
Would it be clearer if the cursor stayed the default, instead of changing to the error icon on hover? The button might break the layout if we changed the text, translated strings might be longer than the English default and even that is at the limits. |
54dbfe0
to
827d9db
Compare
Yeah I think the error icon is kind of confusing. I've never really seen that before. |
I think a better UI would be to actually just allow the button, but when you click it, it does a form validation with error message(s) below the invalid fields. |
2a3e599
to
4b19f04
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.
Is this right?
button-viz.mp4
// If we're not showing the max order panel yet, don't do anything. | ||
if (!mkt.maxSell) break |
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.
Hmm. Why?
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.
This way the max order panel and the order button update when the balance does.
Hmm. Well basically, for a limit buy order, the button state was not reactive to changes in the lots field. |
Was there anything logged in the console? Was the button tooltip referring to no balance or empty order quantity? |
94bcbd4
to
80d55be
Compare
This commit is somewhat unrelated but feels like it belongs here |
f8a21f5
to
204a7d0
Compare
afea516
to
eacaacf
Compare
This PR modifies the behavior of the order submit button so that it prevents the user from submitting the order if it would fail due to the below conditions:
Closes #2527