diff options
author | sdtsui <szehungdanieltsui@gmail.com> | 2017-08-21 19:46:38 +0800 |
---|---|---|
committer | sdtsui <szehungdanieltsui@gmail.com> | 2017-08-21 19:46:38 +0800 |
commit | d82233b95c5c3c4297a2d18b981ec6188de003c1 (patch) | |
tree | b56639a97156a6d1935c7eb0033c990f6999cad5 /ui/app/components/modals | |
parent | 80a2cba38ef4fe6c01a624c5a504a7803b1a8316 (diff) | |
download | tangerine-wallet-browser-d82233b95c5c3c4297a2d18b981ec6188de003c1.tar tangerine-wallet-browser-d82233b95c5c3c4297a2d18b981ec6188de003c1.tar.gz tangerine-wallet-browser-d82233b95c5c3c4297a2d18b981ec6188de003c1.tar.bz2 tangerine-wallet-browser-d82233b95c5c3c4297a2d18b981ec6188de003c1.tar.lz tangerine-wallet-browser-d82233b95c5c3c4297a2d18b981ec6188de003c1.tar.xz tangerine-wallet-browser-d82233b95c5c3c4297a2d18b981ec6188de003c1.tar.zst tangerine-wallet-browser-d82233b95c5c3c4297a2d18b981ec6188de003c1.zip |
Hook up actions to EditAccountNameModal
Diffstat (limited to 'ui/app/components/modals')
-rw-r--r-- | ui/app/components/modals/account-details-modal.js | 28 | ||||
-rw-r--r-- | ui/app/components/modals/buy-options-modal.js | 28 | ||||
-rw-r--r-- | ui/app/components/modals/edit-account-name-modal.js | 85 | ||||
-rw-r--r-- | ui/app/components/modals/new-account-modal.js | 28 |
4 files changed, 82 insertions, 87 deletions
diff --git a/ui/app/components/modals/account-details-modal.js b/ui/app/components/modals/account-details-modal.js index 45f54908f..38d08314b 100644 --- a/ui/app/components/modals/account-details-modal.js +++ b/ui/app/components/modals/account-details-modal.js @@ -30,34 +30,34 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDetailsModa // It utilizes modal styles AccountDetailsModal.prototype.render = function () { return h('div', {}, [ - h('div.modal-content.transfers-subview', { + h('div.buy-modal-content.transfers-subview', { }, [ - h('div.modal-content-title-wrapper.flex-column.flex-center', { + h('div.buy-modal-content-title-wrapper.flex-column.flex-center', { style: {}, }, [ - h('div.modal-content-title', { + h('div.buy-modal-content-title', { style: {}, }, 'Account Details Modal'), h('div', {}, 'How would you like to buy Ether?'), ]), - h('div.modal-content-options.flex-column.flex-center', {}, [ + h('div.buy-modal-content-options.flex-column.flex-center', {}, [ - h('div.modal-content-option', { + h('div.buy-modal-content-option', { onClick: () => {}, }, [ - h('div.modal-content-option-title', {}, 'Coinbase'), - h('div.modal-content-option-subtitle', {}, 'Buy with Fiat'), + h('div.buy-modal-content-option-title', {}, 'Coinbase'), + h('div.buy-modal-content-option-subtitle', {}, 'Buy with Fiat'), ]), - h('div.modal-content-option', {}, [ - h('div.modal-content-option-title', {}, 'Shapeshift'), - h('div.modal-content-option-subtitle', {}, 'Trade any digital asset for any other'), + h('div.buy-modal-content-option', {}, [ + h('div.buy-modal-content-option-title', {}, 'Shapeshift'), + h('div.buy-modal-content-option-subtitle', {}, 'Trade any digital asset for any other'), ]), - h('div.modal-content-option', {}, [ - h('div.modal-content-option-title', {}, 'Direct Deposit'), - h('div.modal-content-option-subtitle', {}, 'Deposit from another account'), + h('div.buy-modal-content-option', {}, [ + h('div.buy-modal-content-option-title', {}, 'Direct Deposit'), + h('div.buy-modal-content-option-subtitle', {}, 'Deposit from another account'), ]), ]), @@ -67,7 +67,7 @@ AccountDetailsModal.prototype.render = function () { background: 'white', }, onClick: () => { this.props.hideModal() }, - }, h('div.modal-content-footer#modal-content-footer-text',{}, 'Cancel')), + }, h('div.buy-modal-content-footer#buy-modal-content-footer-text',{}, 'Cancel')), ]) ]) } diff --git a/ui/app/components/modals/buy-options-modal.js b/ui/app/components/modals/buy-options-modal.js index 170ac96b8..76e0da4f1 100644 --- a/ui/app/components/modals/buy-options-modal.js +++ b/ui/app/components/modals/buy-options-modal.js @@ -34,37 +34,37 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(BuyOptions) // It utilizes modal styles BuyOptions.prototype.render = function () { return h('div', {}, [ - h('div.modal-content.transfers-subview', { + h('div.buy-modal-content.transfers-subview', { }, [ - h('div.modal-content-title-wrapper.flex-column.flex-center', { + h('div.buy-modal-content-title-wrapper.flex-column.flex-center', { style: {}, }, [ - h('div.modal-content-title', { + h('div.buy-modal-content-title', { style: {}, }, 'Transfers'), h('div', {}, 'How would you like to buy Ether?'), ]), - h('div.modal-content-options.flex-column.flex-center', {}, [ + h('div.buy-modal-content-options.flex-column.flex-center', {}, [ - h('div.modal-content-option', { + h('div.buy-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.buy-modal-content-option-title', {}, 'Coinbase'), + h('div.buy-modal-content-option-subtitle', {}, 'Buy with Fiat'), ]), - h('div.modal-content-option', {}, [ - h('div.modal-content-option-title', {}, 'Shapeshift'), - h('div.modal-content-option-subtitle', {}, 'Trade any digital asset for any other'), + h('div.buy-modal-content-option', {}, [ + h('div.buy-modal-content-option-title', {}, 'Shapeshift'), + h('div.buy-modal-content-option-subtitle', {}, 'Trade any digital asset for any other'), ]), - h('div.modal-content-option', {}, [ - h('div.modal-content-option-title', {}, 'Direct Deposit'), - h('div.modal-content-option-subtitle', {}, 'Deposit from another account'), + h('div.buy-modal-content-option', {}, [ + h('div.buy-modal-content-option-title', {}, 'Direct Deposit'), + h('div.buy-modal-content-option-subtitle', {}, 'Deposit from another account'), ]), ]), @@ -74,7 +74,7 @@ BuyOptions.prototype.render = function () { background: 'white', }, onClick: () => { this.props.hideModal() }, - }, h('div.modal-content-footer#modal-content-footer-text',{}, 'Cancel')), + }, h('div.buy-modal-content-footer#buy-modal-content-footer-text',{}, 'Cancel')), ]) ]) } diff --git a/ui/app/components/modals/edit-account-name-modal.js b/ui/app/components/modals/edit-account-name-modal.js index 5d2d2e120..0128fe412 100644 --- a/ui/app/components/modals/edit-account-name-modal.js +++ b/ui/app/components/modals/edit-account-name-modal.js @@ -3,78 +3,73 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const connect = require('react-redux').connect const actions = require('../../actions') +const { getSelectedAccount } = require('../../selectors') function mapStateToProps (state) { return { - network: state.metamask.network, - address: state.metamask.selectedAddress, + selectedAccount: getSelectedAccount(state), + identity: state.appState.modal.modalState.identity, } } function mapDispatchToProps (dispatch) { return { - toCoinbase: (address) => { - dispatch(actions.buyEth({ network: '1', address, amount: 0 })) - }, hideModal: () => { dispatch(actions.hideModal()) - } + }, + saveAccountLabel: (account, label) => { + dispatch(actions.saveAccountLabel(account, label)) + }, } } -inherits(BuyOptions, Component) -function BuyOptions () { +inherits(EditAccountNameModal, Component) +function EditAccountNameModal () { 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 utilizes modal styles -BuyOptions.prototype.render = function () { +EditAccountNameModal.prototype.render = function () { + const { hideModal, saveAccountLabel, identity } = this.props + 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.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.edit-account-name-modal-cancel', {}, [ + h('i.fa.fa-times'), + ]), - h('div.modal-content-option', {}, [ - h('div.modal-content-option-title', {}, 'Shapeshift'), - h('div.modal-content-option-subtitle', {}, 'Trade any digital asset for any other'), - ]), + h('div.edit-account-name-modal-title', { + }, ['Edit Account Name']), - h('div.modal-content-option', {}, [ - h('div.modal-content-option-title', {}, 'Direct Deposit'), - h('div.modal-content-option-subtitle', {}, 'Deposit from another account'), - ]), + h('input.edit-account-name-modal-input', { + placeholder: identity.name, + 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')), ]) ]) } diff --git a/ui/app/components/modals/new-account-modal.js b/ui/app/components/modals/new-account-modal.js index e4b3ca328..c55d69964 100644 --- a/ui/app/components/modals/new-account-modal.js +++ b/ui/app/components/modals/new-account-modal.js @@ -34,37 +34,37 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(BuyOptions) // It utilizes modal styles BuyOptions.prototype.render = function () { return h('div', {}, [ - h('div.modal-content.transfers-subview', { + h('div.buy-modal-content.transfers-subview', { }, [ - h('div.modal-content-title-wrapper.flex-column.flex-center', { + h('div.buy-modal-content-title-wrapper.flex-column.flex-center', { style: {}, }, [ - h('div.modal-content-title', { + h('div.buy-modal-content-title', { style: {}, }, 'New Account Modal'), h('div', {}, 'How would you like to buy Ether?'), ]), - h('div.modal-content-options.flex-column.flex-center', {}, [ + h('div.buy-modal-content-options.flex-column.flex-center', {}, [ - h('div.modal-content-option', { + h('div.buy-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.buy-modal-content-option-title', {}, 'Coinbase'), + h('div.buy-modal-content-option-subtitle', {}, 'Buy with Fiat'), ]), - h('div.modal-content-option', {}, [ - h('div.modal-content-option-title', {}, 'Shapeshift'), - h('div.modal-content-option-subtitle', {}, 'Trade any digital asset for any other'), + h('div.buy-modal-content-option', {}, [ + h('div.buy-modal-content-option-title', {}, 'Shapeshift'), + h('div.buy-modal-content-option-subtitle', {}, 'Trade any digital asset for any other'), ]), - h('div.modal-content-option', {}, [ - h('div.modal-content-option-title', {}, 'Direct Deposit'), - h('div.modal-content-option-subtitle', {}, 'Deposit from another account'), + h('div.buy-modal-content-option', {}, [ + h('div.buy-modal-content-option-title', {}, 'Direct Deposit'), + h('div.buy-modal-content-option-subtitle', {}, 'Deposit from another account'), ]), ]), @@ -74,7 +74,7 @@ BuyOptions.prototype.render = function () { background: 'white', }, onClick: () => { this.props.hideModal() }, - }, h('div.modal-content-footer#modal-content-footer-text',{}, 'Cancel')), + }, h('div.buy-modal-content-footer#buy-modal-content-footer-text',{}, 'Cancel')), ]) ]) } |