You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.6 KiB
92 lines
2.6 KiB
4 years ago
|
import PropTypes from 'prop-types';
|
||
|
import React, { Component } from 'react';
|
||
|
import { connect } from 'react-redux';
|
||
|
import * as actions from '../../../../store/actions';
|
||
|
import Identicon from '../../../ui/identicon';
|
||
|
import Button from '../../../ui/button';
|
||
7 years ago
|
|
||
4 years ago
|
function mapStateToProps(state) {
|
||
7 years ago
|
return {
|
||
7 years ago
|
token: state.appState.modal.modalState.props.token,
|
||
6 years ago
|
assetImages: state.metamask.assetImages,
|
||
4 years ago
|
};
|
||
7 years ago
|
}
|
||
|
|
||
4 years ago
|
function mapDispatchToProps(dispatch) {
|
||
7 years ago
|
return {
|
||
|
hideModal: () => dispatch(actions.hideModal()),
|
||
5 years ago
|
hideToken: (address) => {
|
||
4 years ago
|
dispatch(actions.removeToken(address)).then(() => {
|
||
4 years ago
|
dispatch(actions.hideModal());
|
||
|
});
|
||
7 years ago
|
},
|
||
4 years ago
|
};
|
||
7 years ago
|
}
|
||
|
|
||
5 years ago
|
class HideTokenConfirmationModal extends Component {
|
||
|
static contextTypes = {
|
||
|
t: PropTypes.func,
|
||
4 years ago
|
};
|
||
7 years ago
|
|
||
5 years ago
|
static propTypes = {
|
||
|
hideToken: PropTypes.func.isRequired,
|
||
|
hideModal: PropTypes.func.isRequired,
|
||
|
assetImages: PropTypes.object.isRequired,
|
||
|
token: PropTypes.shape({
|
||
|
symbol: PropTypes.string,
|
||
|
address: PropTypes.string,
|
||
|
}),
|
||
4 years ago
|
};
|
||
7 years ago
|
|
||
4 years ago
|
state = {};
|
||
7 years ago
|
|
||
4 years ago
|
render() {
|
||
4 years ago
|
const { token, hideToken, hideModal, assetImages } = this.props;
|
||
|
const { symbol, address } = token;
|
||
|
const image = assetImages[address];
|
||
7 years ago
|
|
||
5 years ago
|
return (
|
||
|
<div className="hide-token-confirmation">
|
||
|
<div className="hide-token-confirmation__container">
|
||
|
<div className="hide-token-confirmation__title">
|
||
|
{this.context.t('hideTokenPrompt')}
|
||
|
</div>
|
||
|
<Identicon
|
||
|
className="hide-token-confirmation__identicon"
|
||
|
diameter={45}
|
||
|
address={address}
|
||
|
image={image}
|
||
|
/>
|
||
|
<div className="hide-token-confirmation__symbol">{symbol}</div>
|
||
|
<div className="hide-token-confirmation__copy">
|
||
|
{this.context.t('readdToken')}
|
||
|
</div>
|
||
|
<div className="hide-token-confirmation__buttons">
|
||
4 years ago
|
<Button
|
||
|
type="default"
|
||
|
className="hide-token-confirmation__button"
|
||
5 years ago
|
data-testid="hide-token-confirmation__cancel"
|
||
5 years ago
|
onClick={() => hideModal()}
|
||
|
>
|
||
|
{this.context.t('cancel')}
|
||
4 years ago
|
</Button>
|
||
|
<Button
|
||
|
type="secondary"
|
||
|
className="hide-token-confirmation__button"
|
||
5 years ago
|
data-testid="hide-token-confirmation__hide"
|
||
5 years ago
|
onClick={() => hideToken(address)}
|
||
|
>
|
||
|
{this.context.t('hide')}
|
||
4 years ago
|
</Button>
|
||
5 years ago
|
</div>
|
||
5 years ago
|
</div>
|
||
|
</div>
|
||
4 years ago
|
);
|
||
5 years ago
|
}
|
||
7 years ago
|
}
|
||
5 years ago
|
|
||
4 years ago
|
export default connect(
|
||
|
mapStateToProps,
|
||
|
mapDispatchToProps,
|
||
4 years ago
|
)(HideTokenConfirmationModal);
|