|
|
@ -3,78 +3,73 @@ const h = require('react-hyperscript') |
|
|
|
const inherits = require('util').inherits |
|
|
|
const inherits = require('util').inherits |
|
|
|
const connect = require('react-redux').connect |
|
|
|
const connect = require('react-redux').connect |
|
|
|
const actions = require('../../actions') |
|
|
|
const actions = require('../../actions') |
|
|
|
|
|
|
|
const { getSelectedAccount } = require('../../selectors') |
|
|
|
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
function mapStateToProps (state) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
network: state.metamask.network, |
|
|
|
selectedAccount: getSelectedAccount(state), |
|
|
|
address: state.metamask.selectedAddress, |
|
|
|
identity: state.appState.modal.modalState.identity, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function mapDispatchToProps (dispatch) { |
|
|
|
function mapDispatchToProps (dispatch) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
toCoinbase: (address) => { |
|
|
|
|
|
|
|
dispatch(actions.buyEth({ network: '1', address, amount: 0 })) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
hideModal: () => { |
|
|
|
hideModal: () => { |
|
|
|
dispatch(actions.hideModal()) |
|
|
|
dispatch(actions.hideModal()) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
saveAccountLabel: (account, label) => { |
|
|
|
|
|
|
|
dispatch(actions.saveAccountLabel(account, label)) |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inherits(BuyOptions, Component) |
|
|
|
inherits(EditAccountNameModal, Component) |
|
|
|
function BuyOptions () { |
|
|
|
function EditAccountNameModal () { |
|
|
|
Component.call(this) |
|
|
|
Component.call(this) |
|
|
|
|
|
|
|
this.state = { |
|
|
|
|
|
|
|
inputText: '', |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = connect(mapStateToProps, mapDispatchToProps)(BuyOptions) |
|
|
|
module.exports = connect(mapStateToProps, mapDispatchToProps)(EditAccountNameModal) |
|
|
|
|
|
|
|
|
|
|
|
// BuyOptions is currently meant to be rendered inside <Modal />
|
|
|
|
// EditAccountNameModal is currently meant to be rendered inside <Modal />
|
|
|
|
// It is the only component in this codebase that does so
|
|
|
|
// It is the only component in this codebase that does so
|
|
|
|
// It utilizes modal styles
|
|
|
|
// It utilizes modal styles
|
|
|
|
BuyOptions.prototype.render = function () { |
|
|
|
EditAccountNameModal.prototype.render = function () { |
|
|
|
|
|
|
|
const { hideModal, saveAccountLabel, identity } = this.props |
|
|
|
|
|
|
|
|
|
|
|
return h('div', {}, [ |
|
|
|
return h('div', {}, [ |
|
|
|
h('div.modal-content.transfers-subview', { |
|
|
|
h('div.flex-column.edit-account-name-modal-content', { |
|
|
|
}, [ |
|
|
|
}, [ |
|
|
|
h('div.modal-content-title-wrapper.flex-column.flex-center', { |
|
|
|
|
|
|
|
style: {}, |
|
|
|
|
|
|
|
}, [ |
|
|
|
|
|
|
|
h('div.modal-content-title', { |
|
|
|
|
|
|
|
style: {}, |
|
|
|
|
|
|
|
}, 'Edit Account Name Modal'), |
|
|
|
|
|
|
|
h('div', {}, 'How would you like to buy Ether?'), |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
h('div.modal-content-options.flex-column.flex-center', {}, [ |
|
|
|
h('div.edit-account-name-modal-cancel', {}, [ |
|
|
|
|
|
|
|
h('i.fa.fa-times'), |
|
|
|
h('div.modal-content-option', { |
|
|
|
]), |
|
|
|
onClick: () => { |
|
|
|
|
|
|
|
const { toCoinbase, address } = this.props |
|
|
|
|
|
|
|
toCoinbase(address) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, [ |
|
|
|
|
|
|
|
h('div.modal-content-option-title', {}, 'Coinbase'), |
|
|
|
|
|
|
|
h('div.modal-content-option-subtitle', {}, 'Buy with Fiat'), |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
h('div.modal-content-option', {}, [ |
|
|
|
h('div.edit-account-name-modal-title', { |
|
|
|
h('div.modal-content-option-title', {}, 'Shapeshift'), |
|
|
|
}, ['Edit Account Name']), |
|
|
|
h('div.modal-content-option-subtitle', {}, 'Trade any digital asset for any other'), |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
h('div.modal-content-option', {}, [ |
|
|
|
h('input.edit-account-name-modal-input', { |
|
|
|
h('div.modal-content-option-title', {}, 'Direct Deposit'), |
|
|
|
placeholder: identity.name, |
|
|
|
h('div.modal-content-option-subtitle', {}, 'Deposit from another account'), |
|
|
|
onChange: (event) => { |
|
|
|
]), |
|
|
|
this.setState({ inputText: event.target.value }) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
value: this.state.inputText, |
|
|
|
|
|
|
|
}, []), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
h('button.btn-clear.edit-account-name-modal-save-button', { |
|
|
|
|
|
|
|
onClick: () => { |
|
|
|
|
|
|
|
if (this.state.inputText.length !== 0) { |
|
|
|
|
|
|
|
saveAccountLabel(identity.address, this.state.inputText) |
|
|
|
|
|
|
|
hideModal() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
disabled: this.state.inputText.length === 0, |
|
|
|
|
|
|
|
}, [ |
|
|
|
|
|
|
|
'SAVE', |
|
|
|
]), |
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
h('button', { |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
background: 'white', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onClick: () => { this.props.hideModal() }, |
|
|
|
|
|
|
|
}, h('div.modal-content-footer#modal-content-footer-text',{}, 'Cancel')), |
|
|
|
|
|
|
|
]) |
|
|
|
]) |
|
|
|
]) |
|
|
|
]) |
|
|
|
} |
|
|
|
} |
|
|
|