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