-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add setApprovalForAll confirmation view #15010
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,8 @@ export default class ConfirmApproveContent extends Component { | |
assetName: PropTypes.string, | ||
tokenId: PropTypes.string, | ||
assetStandard: PropTypes.string, | ||
isSetApproveForAll: PropTypes.bool, | ||
setApproveForAllArg: PropTypes.bool, | ||
}; | ||
|
||
state = { | ||
|
@@ -184,7 +186,7 @@ export default class ConfirmApproveContent extends Component { | |
|
||
renderERC721OrERC1155PermissionContent() { | ||
const { t } = this.context; | ||
const { origin, toAddress, isContract } = this.props; | ||
const { origin, toAddress, isContract, isSetApproveForAll } = this.props; | ||
|
||
const titleTokenDescription = this.getTitleTokenDescription(); | ||
|
||
|
@@ -201,7 +203,9 @@ export default class ConfirmApproveContent extends Component { | |
{t('approvedAsset')}: | ||
</div> | ||
<div className="confirm-approve-content__medium-text"> | ||
{titleTokenDescription} | ||
{isSetApproveForAll | ||
? `${t('allOfYour', [titleTokenDescription])} ` | ||
: titleTokenDescription} | ||
</div> | ||
</div> | ||
<div className="flex-row"> | ||
|
@@ -299,12 +303,19 @@ export default class ConfirmApproveContent extends Component { | |
|
||
renderDataContent() { | ||
const { t } = this.context; | ||
const { data } = this.props; | ||
const { data, isSetApproveForAll, setApproveForAllArg } = this.props; | ||
return ( | ||
<div className="flex-column"> | ||
<div className="confirm-approve-content__small-text"> | ||
{t('functionApprove')} | ||
{isSetApproveForAll | ||
? t('functionSetApprovalForAll') | ||
: t('functionApprove')} | ||
</div> | ||
{isSetApproveForAll && setApproveForAllArg !== undefined ? ( | ||
<div className="confirm-approve-content__small-text"> | ||
{t('parameters')}: {setApproveForAllArg} | ||
</div> | ||
) : null} | ||
<div className="confirm-approve-content__small-text confirm-approve-content__data__data-block"> | ||
{data} | ||
</div> | ||
|
@@ -509,6 +520,41 @@ export default class ConfirmApproveContent extends Component { | |
return titleTokenDescription; | ||
} | ||
|
||
renderTitle() { | ||
const { t } = this.context; | ||
const { isSetApproveForAll, setApproveForAllArg } = this.props; | ||
const titleTokenDescription = this.getTitleTokenDescription(); | ||
|
||
let title; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lol this is what I had before and Ariella suggested this way: #15010 (comment) I don't have much of an opinion on this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. haha sorry @adonesky1 and @darkwing. I actually liked the |
||
|
||
if (isSetApproveForAll) { | ||
title = t('approveAllTokensTitle', [titleTokenDescription]); | ||
if (setApproveForAllArg === false) { | ||
title = t('revokeAllTokensTitle', [titleTokenDescription]); | ||
} | ||
} | ||
return title || t('allowSpendToken', [titleTokenDescription]); | ||
} | ||
|
||
renderDescription() { | ||
const { t } = this.context; | ||
const { isContract, isSetApproveForAll, setApproveForAllArg } = this.props; | ||
const grantee = isContract | ||
? t('contract').toLowerCase() | ||
: t('account').toLowerCase(); | ||
|
||
let description = t('trustSiteApprovePermission', [grantee]); | ||
|
||
if (isSetApproveForAll && setApproveForAllArg === false) { | ||
description = t('revokeApproveForAllDescription', [ | ||
grantee, | ||
this.getTitleTokenDescription(), | ||
]); | ||
} | ||
|
||
return description; | ||
} | ||
|
||
render() { | ||
const { t } = this.context; | ||
const { | ||
|
@@ -534,8 +580,6 @@ export default class ConfirmApproveContent extends Component { | |
} = this.props; | ||
const { showFullTxDetails } = this.state; | ||
|
||
const titleTokenDescription = this.getTitleTokenDescription(); | ||
|
||
return ( | ||
<div | ||
className={classnames('confirm-approve-content', { | ||
|
@@ -575,14 +619,10 @@ export default class ConfirmApproveContent extends Component { | |
</Box> | ||
</Box> | ||
<div className="confirm-approve-content__title"> | ||
{t('allowSpendToken', [titleTokenDescription])} | ||
{this.renderTitle()} | ||
</div> | ||
<div className="confirm-approve-content__description"> | ||
{t('trustSiteApprovePermission', [ | ||
isContract | ||
? t('contract').toLowerCase() | ||
: t('account').toLowerCase(), | ||
])} | ||
{this.renderDescription()} | ||
</div> | ||
<Box className="confirm-approve-content__address-display-content"> | ||
<Box display={DISPLAY.FLEX}> | ||
|
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.
does this type actually get set anywhere?
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.
@digiwand when you tested this, did you see the
setApprovalForAllTitle
in the transaction history list?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.
Should be able to! I see it. cc @digiwand
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.
its set here in the method
determineTransactionType