|
|
|
@ -1,45 +1,28 @@ |
|
|
|
|
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 { createAccountLink as genAccountLink } from 'etherscan-link' |
|
|
|
|
import { Menu, Item, CloseArea } from './components/menu' |
|
|
|
|
|
|
|
|
|
TokenMenuDropdown.contextTypes = { |
|
|
|
|
class TokenMenuDropdown extends Component { |
|
|
|
|
static contextTypes = { |
|
|
|
|
t: PropTypes.func, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(TokenMenuDropdown) |
|
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
|
return { |
|
|
|
|
network: state.metamask.network, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function mapDispatchToProps (dispatch) { |
|
|
|
|
return { |
|
|
|
|
showHideTokenConfirmationModal: (token) => { |
|
|
|
|
dispatch(actions.showModal({ name: 'HIDE_TOKEN_CONFIRMATION', token })) |
|
|
|
|
}, |
|
|
|
|
static propTypes = { |
|
|
|
|
onClose: PropTypes.func.isRequired, |
|
|
|
|
showHideTokenConfirmationModal: PropTypes.func.isRequired, |
|
|
|
|
token: PropTypes.object.isRequired, |
|
|
|
|
network: PropTypes.number.isRequired, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inherits(TokenMenuDropdown, Component) |
|
|
|
|
function TokenMenuDropdown () { |
|
|
|
|
Component.call(this) |
|
|
|
|
|
|
|
|
|
this.onClose = this.onClose.bind(this) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TokenMenuDropdown.prototype.onClose = function (e) { |
|
|
|
|
onClose = (e) => { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
this.props.onClose() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TokenMenuDropdown.prototype.render = function TokenMenuDropdown () { |
|
|
|
|
render () { |
|
|
|
|
const { showHideTokenConfirmationModal } = this.props |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
@ -64,4 +47,21 @@ TokenMenuDropdown.prototype.render = function TokenMenuDropdown () { |
|
|
|
|
/> |
|
|
|
|
</Menu> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(TokenMenuDropdown) |
|
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
|
return { |
|
|
|
|
network: state.metamask.network, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function mapDispatchToProps (dispatch) { |
|
|
|
|
return { |
|
|
|
|
showHideTokenConfirmationModal: (token) => { |
|
|
|
|
dispatch(actions.showModal({ name: 'HIDE_TOKEN_CONFIRMATION', token })) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|