1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Hide "delete" button when editing contact of wallet account (#9030)

Wallet accounts can't be deleted from the contact list. This button
never worked, nor should it.
This commit is contained in:
Mark Stacey 2020-07-17 20:30:25 -03:00 committed by GitHub
parent 68a64af5b3
commit ea8fa580be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ export default class EditContact extends PureComponent {
viewRoute: PropTypes.string,
listRoute: PropTypes.string,
setAccountLabel: PropTypes.func,
showingMyAccounts: PropTypes.bool.isRequired,
}
static defaultProps = {
@ -40,22 +41,40 @@ export default class EditContact extends PureComponent {
render () {
const { t } = this.context
const { history, name, addToAddressBook, removeFromAddressBook, address, chainId, memo, viewRoute, listRoute, setAccountLabel } = this.props
const {
address,
addToAddressBook,
chainId,
history,
listRoute,
memo,
name,
removeFromAddressBook,
setAccountLabel,
showingMyAccounts,
viewRoute,
} = this.props
return (
<div className="settings-page__content-row address-book__edit-contact">
<div className="settings-page__header address-book__header--edit">
<Identicon address={address} diameter={60} />
<Button
type="link"
className="settings-page__address-book-button"
onClick={async () => {
await removeFromAddressBook(chainId, address)
history.push(listRoute)
}}
>
{t('deleteAccount')}
</Button>
{
showingMyAccounts
? null
: (
<Button
type="link"
className="settings-page__address-book-button"
onClick={async () => {
await removeFromAddressBook(chainId, address)
history.push(listRoute)
}}
>
{t('deleteAccount')}
</Button>
)
}
</div>
<div className="address-book__edit-contact__content">
<div className="address-book__view-contact__group">