A Metamask fork with Infura removed and default networks editable
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.
ciphermask/ui/components/app/modals/hide-token-confirmation-modal/hide-token-confirmation-mod...

90 lines
2.5 KiB

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';
function mapStateToProps(state) {
return {
token: state.appState.modal.modalState.props.token,
};
}
function mapDispatchToProps(dispatch) {
return {
hideModal: () => dispatch(actions.hideModal()),
hideToken: (address) => {
dispatch(actions.removeToken(address)).then(() => {
dispatch(actions.hideModal());
});
},
};
}
class HideTokenConfirmationModal extends Component {
static contextTypes = {
t: PropTypes.func,
};
static propTypes = {
hideToken: PropTypes.func.isRequired,
hideModal: PropTypes.func.isRequired,
token: PropTypes.shape({
symbol: PropTypes.string,
address: PropTypes.string,
image: PropTypes.string,
}),
};
state = {};
render() {
const { token, hideToken, hideModal } = this.props;
const { symbol, address, image } = token;
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">
<Button
type="default"
className="hide-token-confirmation__button"
data-testid="hide-token-confirmation__cancel"
onClick={() => hideModal()}
>
{this.context.t('cancel')}
</Button>
<Button
type="secondary"
className="hide-token-confirmation__button"
data-testid="hide-token-confirmation__hide"
onClick={() => hideToken(address)}
>
{this.context.t('hide')}
</Button>
</div>
</div>
</div>
);
}
}
export default connect(
mapStateToProps,
mapDispatchToProps,
)(HideTokenConfirmationModal);