-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Redesign approve screen #7271
Redesign approve screen #7271
Conversation
f7a19e0
to
9ceec92
Compare
Builds ready [9ceec92]
|
<div className="edit-approval-permission"> | ||
<div className="edit-approval-permission__header"> | ||
<div className="edit-approval-permission__title"> | ||
Edit Permission |
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 should probably be a localized message, along with the other text in this component
Spend limit permission | ||
</div> | ||
<div className="edit-approval-permission__edit-section__description"> | ||
Allow Uniswap to withdraw and spend up to the following amount: |
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.
The "Uniswap" here should be replaced with the name for whichever site is requesting approval.
The same goes for the "Spend limit requested by Uniswap" message below
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.
I encountered this PropType warning upon opening the Approve screen:
Warning: Failed prop type: Invalid prop `decimals` of type `string` supplied to `ConfirmApprove`, expected `number`.
in ConfirmApprove (created by TokenTrackerWrappedComponent)
in TokenTrackerWrappedComponent (created by Connect(TokenTrackerWrappedComponent))
in Connect(TokenTrackerWrappedComponent) (created by Route)
in Route (created by withRouter(Connect(TokenTrackerWrappedComponent)))
in withRouter(Connect(TokenTrackerWrappedComponent)) (created by Route)
in Route (created by ConfirmTransaction)
in Switch (created by ConfirmTransaction)
in ConfirmTransaction (created by Connect(ConfirmTransaction))
in Connect(ConfirmTransaction) (created by Route)
in Route (created by withRouter(Connect(ConfirmTransaction)))
in withRouter(Connect(ConfirmTransaction)) (created by Route)
in Route (created by Authenticated)
in Authenticated (created by Connect(Authenticated))
in Connect(Authenticated) (created by Routes)
in Switch (created by Routes)
in div (created by Routes)
in div (created by Routes)
in Routes (created by Connect(Routes))
in Connect(Routes) (created by Route)
in Route (created by withRouter(Connect(Routes)))
in withRouter(Connect(Routes)) (created by Index)
in I18nProvider (created by Connect(I18nProvider))
in Connect(I18nProvider) (created by Route)
in Route (created by withRouter(Connect(I18nProvider)))
in withRouter(Connect(I18nProvider)) (created by Index)
in MetaMetricsProvider (created by Connect(MetaMetricsProvider))
in Connect(MetaMetricsProvider) (created by Route)
in Route (created by withRouter(Connect(MetaMetricsProvider)))
in withRouter(Connect(MetaMetricsProvider)) (created by Index)
in Router (created by HashRouter)
in HashRouter (created by Index)
in Provider (created by Index)
in Index
I also noticed that the popup itself had a few UI issues:
- Why is there a vertical scrollbar? It looks like a horizontal scrollbar appears upon opening the transaction details
- The account is missing from the top-left
- It seems like there should be more whitespace above and below the network (it looks a bit cramped). Maybe this would be fixed indirectly after adding the account though.
ui/app/components/app/modals/edit-approval-permission/edit-approval-permission.component.js
Show resolved
Hide resolved
})}> | ||
{ | ||
tokenAmount < tokenBalance | ||
? -'Proposed Approval Limit' |
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 that -
intended? I think this'd come out as NaN
<div className="edit-approval-permission__edit-section__option"> | ||
<div | ||
className="edit-approval-permission__edit-section__radio-button" | ||
onClick={() => this.setState({ selectedOption: 'unlimited' })} |
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.
Nit: 'unlimited'
and 'custom'
should probably be enums. It seems like a good place to use an enum anyway.
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.
I'll upgrade this from a nitpick to an issue: there are a lot of 'unlimited'
and 'custom'
scattered throughout this component, we should move those into constants at a minimum
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.
We could also maybe even put this.state.selectedOption === 'custom'
and this.state.selectedOption === 'unlimited'
into state so that a lot of those instances could be read from state, e.g.
<div className={classnames({
'edit-approval-permission__edit-section__radio-button-outline': !this.state.selectedOptionIsUnlimited,
'edit-approval-permission__edit-section__radio-button-outline--selected': this.state.selectedOptionIsUnlimited
})} />
submitType="primary" | ||
contentClass="edit-approval-permission-modal-content" | ||
containerClass="edit-approval-permission-modal-container" | ||
submitDisabled={ this.state.customSpendLimit === this.props.customTokenAmount } |
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 prevents saving Unlimited
if the custom amount selected is equal to the custom token amount.
e.g.
- Set a custom spend limit of 5, then save it
- Edit permissions again
- Set a custom limit of 5
- Select 'Unlimited'
Save is then disabled, when it should be enabled.
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.
Actually, the onSubmit
handler doesn't seem to allow setting 'Unlimited' anyway 🤔
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 is indeed curious
|
||
const mapDispatchToProps = dispatch => { | ||
return { | ||
resetAccount: () => dispatch(resetAccount()), |
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.
I'm guessing you forgot to update this part
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 still looks wrong - resetAcocunt
isn't sued in the EditApprovalPermission
component
ui/app/components/app/modals/edit-approval-permission/edit-approval-permission.component.js
Show resolved
Hide resolved
<div className="edit-approval-permission__edit-section__option"> | ||
<div | ||
className="edit-approval-permission__edit-section__radio-button" | ||
onClick={() => this.setState({ selectedOption: 'unlimited' })} |
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.
I'll upgrade this from a nitpick to an issue: there are a lot of 'unlimited'
and 'custom'
scattered throughout this component, we should move those into constants at a minimum
<div className="edit-approval-permission__edit-section__option"> | ||
<div | ||
className="edit-approval-permission__edit-section__radio-button" | ||
onClick={() => this.setState({ selectedOption: 'unlimited' })} |
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.
We could also maybe even put this.state.selectedOption === 'custom'
and this.state.selectedOption === 'unlimited'
into state so that a lot of those instances could be read from state, e.g.
<div className={classnames({
'edit-approval-permission__edit-section__radio-button-outline': !this.state.selectedOptionIsUnlimited,
'edit-approval-permission__edit-section__radio-button-outline--selected': this.state.selectedOptionIsUnlimited
})} />
submitType="primary" | ||
contentClass="edit-approval-permission-modal-content" | ||
containerClass="edit-approval-permission-modal-container" | ||
submitDisabled={ this.state.customSpendLimit === this.props.customTokenAmount } |
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 is indeed curious
return ( | ||
<div className="confirm-approve-content__transaction-details-content"> | ||
<div className="confirm-approve-content__small-text"> | ||
A fee is associated with this request. Learn 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.
The text in this component should also be localizable
…s the correct type
9ceec92
to
792bacd
Compare
@Gudahtt @whymarrh all issues have been addressed: 792bacd Ensure first param passed to calcTokenValue in confirm-approve.util is the correct type |
Video of editing permission amount: https://streamable.com/m6sdt |
7988deb
to
1d35558
Compare
Builds ready [1d35558]
|
ui/app/pages/confirm-approve/confirm-approve-content/confirm-approve-content.component.js
Show resolved
Hide resolved
ui/app/pages/confirm-approve/confirm-approve-content/confirm-approve-content.component.js
Show resolved
Hide resolved
d4a8ec8
to
5de79be
Compare
Builds ready [5de79be]
|
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.
Seems legit
The units for the amounts shown on the approve screen in the transaction fee section were missing. It appears that they were present in an early version of the approve screen (#7271) but they got lost somewhere along the way.
The units for the amounts shown on the approve screen in the transaction fee section were missing. It appears that they were present in an early version of the approve screen (#7271) but they got lost somewhere along the way.
The units for the amounts shown on the approve screen in the transaction fee section were missing. It appears that they were present in an early version of the approve screen (#7271) but they got lost somewhere along the way.
Fixes #7165
This PR implements a redesign of the approve screen
Demo video here: https://streamable.com/5xnt7