From fa1482ef7698e7327b468e795bab40459b04ed33 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 10 Jan 2020 11:51:47 -0330 Subject: [PATCH] Convert HideTokenConfirmationModal to an ES6 class (#7782) --- .../modals/hide-token-confirmation-modal.js | 104 +++++++++--------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/ui/app/components/app/modals/hide-token-confirmation-modal.js b/ui/app/components/app/modals/hide-token-confirmation-modal.js index ff82ff4f9..e70e0c877 100644 --- a/ui/app/components/app/modals/hide-token-confirmation-modal.js +++ b/ui/app/components/app/modals/hide-token-confirmation-modal.js @@ -1,6 +1,5 @@ import PropTypes from 'prop-types' import React, { Component } from 'react' -import { inherits } from 'util' import { connect } from 'react-redux' import * as actions from '../../../store/actions' import Identicon from '../../ui/identicon' @@ -25,57 +24,62 @@ function mapDispatchToProps (dispatch) { } } -inherits(HideTokenConfirmationModal, Component) -function HideTokenConfirmationModal () { - Component.call(this) +class HideTokenConfirmationModal extends Component { + static contextTypes = { + t: PropTypes.func, + } - this.state = {} -} + static propTypes = { + hideToken: PropTypes.func.isRequired, + hideModal: PropTypes.func.isRequired, + assetImages: PropTypes.object.isRequired, + token: PropTypes.shape({ + symbol: PropTypes.string, + address: PropTypes.string, + }), + } -HideTokenConfirmationModal.contextTypes = { - t: PropTypes.func, + state = {} + + render () { + const { token, hideToken, hideModal, assetImages } = this.props + const { symbol, address } = token + const image = assetImages[address] + + return ( +
+
+
+ {this.context.t('hideTokenPrompt')} +
+ +
{symbol}
+
+ {this.context.t('readdToken')} +
+
+ + +
+
+
+ ) + } } export default connect(mapStateToProps, mapDispatchToProps)(HideTokenConfirmationModal) - - -HideTokenConfirmationModal.prototype.render = function HideTokenConfirmationModal () { - const { token, network, hideToken, hideModal, assetImages } = this.props - const { symbol, address } = token - const image = assetImages[address] - - return ( -
-
-
- {this.context.t('hideTokenPrompt')} -
- -
{symbol}
-
- {this.context.t('readdToken')} -
-
- - -
-
-
- ) -}