aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/modals
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/modals')
-rw-r--r--ui/app/components/modals/account-details-modal.js7
-rw-r--r--ui/app/components/modals/account-modal-container.js5
-rw-r--r--ui/app/components/modals/buy-options-modal.js17
-rw-r--r--ui/app/components/modals/deposit-ether-modal.js51
-rw-r--r--ui/app/components/modals/edit-account-name-modal.js7
-rw-r--r--ui/app/components/modals/export-private-key-modal.js15
-rw-r--r--ui/app/components/modals/hide-token-confirmation-modal.js11
-rw-r--r--ui/app/components/modals/modal.js9
-rw-r--r--ui/app/components/modals/new-account-modal.js18
-rw-r--r--ui/app/components/modals/notification-modal.js7
-rw-r--r--ui/app/components/modals/notification-modals/confirm-reset-account.js2
-rw-r--r--ui/app/components/modals/shapeshift-deposit-tx-modal.js2
12 files changed, 77 insertions, 74 deletions
diff --git a/ui/app/components/modals/account-details-modal.js b/ui/app/components/modals/account-details-modal.js
index 927d73482..c43e3e3a5 100644
--- a/ui/app/components/modals/account-details-modal.js
+++ b/ui/app/components/modals/account-details-modal.js
@@ -1,14 +1,13 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
const AccountModalContainer = require('./account-modal-container')
const { getSelectedIdentity } = require('../../selectors')
const genAccountLink = require('../../../lib/account-link.js')
const QrView = require('../qr-code')
const EditableLabel = require('../editable-label')
-const t = require('../../../i18n')
function mapStateToProps (state) {
return {
@@ -65,12 +64,12 @@ AccountDetailsModal.prototype.render = function () {
h('button.btn-primary.account-modal__button', {
onClick: () => global.platform.openWindow({ url: genAccountLink(address, network) }),
- }, t('etherscanView')),
+ }, this.props.t('etherscanView')),
// Holding on redesign for Export Private Key functionality
h('button.btn-primary.account-modal__button', {
onClick: () => showExportPrivateKeyModal(),
- }, t('exportPrivateKey')),
+ }, this.props.t('exportPrivateKey')),
])
}
diff --git a/ui/app/components/modals/account-modal-container.js b/ui/app/components/modals/account-modal-container.js
index 08540aa76..70efe16cb 100644
--- a/ui/app/components/modals/account-modal-container.js
+++ b/ui/app/components/modals/account-modal-container.js
@@ -1,11 +1,10 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
const { getSelectedIdentity } = require('../../selectors')
const Identicon = require('../identicon')
-const t = require('../../../i18n')
function mapStateToProps (state) {
return {
@@ -60,7 +59,7 @@ AccountModalContainer.prototype.render = function () {
h('i.fa.fa-angle-left.fa-lg'),
- h('span.account-modal-back__text', ' ' + t('back')),
+ h('span.account-modal-back__text', ' ' + this.props.t('back')),
]),
diff --git a/ui/app/components/modals/buy-options-modal.js b/ui/app/components/modals/buy-options-modal.js
index 7eb73c3a6..c0ee3632e 100644
--- a/ui/app/components/modals/buy-options-modal.js
+++ b/ui/app/components/modals/buy-options-modal.js
@@ -1,10 +1,9 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
const networkNames = require('../../../../app/scripts/config.js').networkNames
-const t = require('../../../i18n')
function mapStateToProps (state) {
return {
@@ -57,15 +56,15 @@ BuyOptions.prototype.render = function () {
}, [
h('div.buy-modal-content-title', {
style: {},
- }, t('transfers')),
- h('div', {}, t('howToDeposit')),
+ }, this.props.t('transfers')),
+ h('div', {}, this.props.t('howToDeposit')),
]),
h('div.buy-modal-content-options.flex-column.flex-center', {}, [
isTestNetwork
- ? this.renderModalContentOption(networkName, t('testFaucet'), () => toFaucet(network))
- : this.renderModalContentOption('Coinbase', t('depositFiat'), () => toCoinbase(address)),
+ ? this.renderModalContentOption(networkName, this.props.t('testFaucet'), () => toFaucet(network))
+ : this.renderModalContentOption('Coinbase', this.props.t('depositFiat'), () => toCoinbase(address)),
// h('div.buy-modal-content-option', {}, [
// h('div.buy-modal-content-option-title', {}, 'Shapeshift'),
@@ -73,8 +72,8 @@ BuyOptions.prototype.render = function () {
// ]),,
this.renderModalContentOption(
- t('directDeposit'),
- t('depositFromAccount'),
+ this.props.t('directDeposit'),
+ this.props.t('depositFromAccount'),
() => this.goToAccountDetailsModal()
),
@@ -85,7 +84,7 @@ BuyOptions.prototype.render = function () {
background: 'white',
},
onClick: () => { this.props.hideModal() },
- }, h('div.buy-modal-content-footer#buy-modal-content-footer-text', {}, t('cancel'))),
+ }, h('div.buy-modal-content-footer#buy-modal-content-footer-text', {}, this.props.t('cancel'))),
]),
])
}
diff --git a/ui/app/components/modals/deposit-ether-modal.js b/ui/app/components/modals/deposit-ether-modal.js
index 2de1240fc..e38899d04 100644
--- a/ui/app/components/modals/deposit-ether-modal.js
+++ b/ui/app/components/modals/deposit-ether-modal.js
@@ -1,22 +1,18 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
const networkNames = require('../../../../app/scripts/config.js').networkNames
const ShapeshiftForm = require('../shapeshift-form')
-const t = require('../../../i18n')
-
-const DIRECT_DEPOSIT_ROW_TITLE = t('directDepositEther')
-const DIRECT_DEPOSIT_ROW_TEXT = t('directDepositEtherExplainer')
-const COINBASE_ROW_TITLE = t('buyCoinbase')
-const COINBASE_ROW_TEXT = t('buyCoinbaseExplainer')
-const SHAPESHIFT_ROW_TITLE = t('depositShapeShift')
-const SHAPESHIFT_ROW_TEXT = t('depositShapeShiftExplainer')
-const FAUCET_ROW_TITLE = t('testFaucet')
-const facuetRowText = (networkName) => {
- return t('getEtherFromFaucet', [networkName])
-}
+
+let DIRECT_DEPOSIT_ROW_TITLE
+let DIRECT_DEPOSIT_ROW_TEXT
+let COINBASE_ROW_TITLE
+let COINBASE_ROW_TEXT
+let SHAPESHIFT_ROW_TITLE
+let SHAPESHIFT_ROW_TEXT
+let FAUCET_ROW_TITLE
function mapStateToProps (state) {
return {
@@ -44,9 +40,18 @@ function mapDispatchToProps (dispatch) {
}
inherits(DepositEtherModal, Component)
-function DepositEtherModal () {
+function DepositEtherModal (props) {
Component.call(this)
+ // need to set after i18n locale has loaded
+ DIRECT_DEPOSIT_ROW_TITLE = props.t('directDepositEther')
+ DIRECT_DEPOSIT_ROW_TEXT = props.t('directDepositEtherExplainer')
+ COINBASE_ROW_TITLE = props.t('buyCoinbase')
+ COINBASE_ROW_TEXT = props.t('buyCoinbaseExplainer')
+ SHAPESHIFT_ROW_TITLE = props.t('depositShapeShift')
+ SHAPESHIFT_ROW_TEXT = props.t('depositShapeShiftExplainer')
+ FAUCET_ROW_TITLE = props.t('testFaucet')
+
this.state = {
buyingWithShapeshift: false,
}
@@ -54,6 +59,10 @@ function DepositEtherModal () {
module.exports = connect(mapStateToProps, mapDispatchToProps)(DepositEtherModal)
+DepositEtherModal.prototype.facuetRowText = function (networkName) {
+ return this.props.t('getEtherFromFaucet', [networkName])
+}
+
DepositEtherModal.prototype.renderRow = function ({
logo,
title,
@@ -113,10 +122,10 @@ DepositEtherModal.prototype.render = function () {
h('div.page-container__header', [
- h('div.page-container__title', [t('depositEther')]),
+ h('div.page-container__title', [this.props.t('depositEther')]),
h('div.page-container__subtitle', [
- t('needEtherInWallet'),
+ this.props.t('needEtherInWallet'),
]),
h('div.page-container__header-close', {
@@ -139,7 +148,7 @@ DepositEtherModal.prototype.render = function () {
}),
title: DIRECT_DEPOSIT_ROW_TITLE,
text: DIRECT_DEPOSIT_ROW_TEXT,
- buttonLabel: t('viewAccount'),
+ buttonLabel: this.props.t('viewAccount'),
onButtonClick: () => this.goToAccountDetailsModal(),
hide: buyingWithShapeshift,
}),
@@ -147,8 +156,8 @@ DepositEtherModal.prototype.render = function () {
this.renderRow({
logo: h('i.fa.fa-tint.fa-2x'),
title: FAUCET_ROW_TITLE,
- text: facuetRowText(networkName),
- buttonLabel: t('getEther'),
+ text: this.facuetRowText(networkName),
+ buttonLabel: this.props.t('getEther'),
onButtonClick: () => toFaucet(network),
hide: !isTestNetwork || buyingWithShapeshift,
}),
@@ -162,7 +171,7 @@ DepositEtherModal.prototype.render = function () {
}),
title: COINBASE_ROW_TITLE,
text: COINBASE_ROW_TEXT,
- buttonLabel: t('continueToCoinbase'),
+ buttonLabel: this.props.t('continueToCoinbase'),
onButtonClick: () => toCoinbase(address),
hide: isTestNetwork || buyingWithShapeshift,
}),
@@ -175,7 +184,7 @@ DepositEtherModal.prototype.render = function () {
}),
title: SHAPESHIFT_ROW_TITLE,
text: SHAPESHIFT_ROW_TEXT,
- buttonLabel: t('shapeshiftBuy'),
+ buttonLabel: this.props.t('shapeshiftBuy'),
onButtonClick: () => this.setState({ buyingWithShapeshift: true }),
hide: isTestNetwork,
hideButton: buyingWithShapeshift,
diff --git a/ui/app/components/modals/edit-account-name-modal.js b/ui/app/components/modals/edit-account-name-modal.js
index 6efa8d476..4f5bc001a 100644
--- a/ui/app/components/modals/edit-account-name-modal.js
+++ b/ui/app/components/modals/edit-account-name-modal.js
@@ -1,10 +1,9 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
const { getSelectedAccount } = require('../../selectors')
-const t = require('../../../i18n')
function mapStateToProps (state) {
return {
@@ -51,7 +50,7 @@ EditAccountNameModal.prototype.render = function () {
]),
h('div.edit-account-name-modal-title', {
- }, [t('editAccountName')]),
+ }, [this.props.t('editAccountName')]),
h('input.edit-account-name-modal-input', {
placeholder: identity.name,
@@ -70,7 +69,7 @@ EditAccountNameModal.prototype.render = function () {
},
disabled: this.state.inputText.length === 0,
}, [
- t('save'),
+ this.props.t('save'),
]),
]),
diff --git a/ui/app/components/modals/export-private-key-modal.js b/ui/app/components/modals/export-private-key-modal.js
index cf42e4fa2..d5a1ba7b8 100644
--- a/ui/app/components/modals/export-private-key-modal.js
+++ b/ui/app/components/modals/export-private-key-modal.js
@@ -1,13 +1,12 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
+const connect = require('../../metamask-connect')
const ethUtil = require('ethereumjs-util')
const actions = require('../../actions')
const AccountModalContainer = require('./account-modal-container')
const { getSelectedIdentity } = require('../../selectors')
const ReadOnlyInput = require('../readonly-input')
-const t = require('../../../i18n')
const copyToClipboard = require('copy-to-clipboard')
function mapStateToProps (state) {
@@ -49,8 +48,8 @@ ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (passwo
ExportPrivateKeyModal.prototype.renderPasswordLabel = function (privateKey) {
return h('span.private-key-password-label', privateKey
- ? t('copyPrivateKey')
- : t('typePassword')
+ ? this.props.t('copyPrivateKey')
+ : this.props.t('typePassword')
)
}
@@ -87,8 +86,8 @@ ExportPrivateKeyModal.prototype.renderButtons = function (privateKey, password,
),
(privateKey
- ? this.renderButton('btn-primary--lg export-private-key__button', () => hideModal(), t('done'))
- : this.renderButton('btn-primary--lg export-private-key__button', () => this.exportAccountAndGetPrivateKey(this.state.password, address), t('confirm'))
+ ? this.renderButton('btn-primary--lg export-private-key__button', () => hideModal(), this.props.t('done'))
+ : this.renderButton('btn-primary--lg export-private-key__button', () => this.exportAccountAndGetPrivateKey(this.state.password, address), this.props.t('confirm'))
),
])
@@ -121,7 +120,7 @@ ExportPrivateKeyModal.prototype.render = function () {
h('div.account-modal-divider'),
- h('span.modal-body-title', t('showPrivateKeys')),
+ h('span.modal-body-title', this.props.t('showPrivateKeys')),
h('div.private-key-password', {}, [
this.renderPasswordLabel(privateKey),
@@ -131,7 +130,7 @@ ExportPrivateKeyModal.prototype.render = function () {
!warning ? null : h('span.private-key-password-error', warning),
]),
- h('div.private-key-password-warning', t('privateKeyWarning')),
+ h('div.private-key-password-warning', this.props.t('privateKeyWarning')),
this.renderButtons(privateKey, this.state.password, address, hideModal),
diff --git a/ui/app/components/modals/hide-token-confirmation-modal.js b/ui/app/components/modals/hide-token-confirmation-modal.js
index 33d8062c6..5207b4c95 100644
--- a/ui/app/components/modals/hide-token-confirmation-modal.js
+++ b/ui/app/components/modals/hide-token-confirmation-modal.js
@@ -1,10 +1,9 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
const Identicon = require('../identicon')
-const t = require('../../../i18n')
function mapStateToProps (state) {
return {
@@ -42,7 +41,7 @@ HideTokenConfirmationModal.prototype.render = function () {
h('div.hide-token-confirmation__container', {
}, [
h('div.hide-token-confirmation__title', {}, [
- t('hideTokenPrompt'),
+ this.props.t('hideTokenPrompt'),
]),
h(Identicon, {
@@ -55,19 +54,19 @@ HideTokenConfirmationModal.prototype.render = function () {
h('div.hide-token-confirmation__symbol', {}, symbol),
h('div.hide-token-confirmation__copy', {}, [
- t('readdToken'),
+ this.props.t('readdToken'),
]),
h('div.hide-token-confirmation__buttons', {}, [
h('button.btn-cancel.hide-token-confirmation__button.allcaps', {
onClick: () => hideModal(),
}, [
- t('cancel'),
+ this.props.t('cancel'),
]),
h('button.btn-clear.hide-token-confirmation__button.allcaps', {
onClick: () => hideToken(address),
}, [
- t('hide'),
+ this.props.t('hide'),
]),
]),
]),
diff --git a/ui/app/components/modals/modal.js b/ui/app/components/modals/modal.js
index 501b83430..9250cc77e 100644
--- a/ui/app/components/modals/modal.js
+++ b/ui/app/components/modals/modal.js
@@ -6,7 +6,6 @@ const FadeModal = require('boron').FadeModal
const actions = require('../../actions')
const isMobileView = require('../../../lib/is-mobile-view')
const isPopupOrNotification = require('../../../../app/scripts/lib/is-popup-or-notification')
-const t = require('../../../i18n')
// Modal Components
const BuyOptions = require('./buy-options-modal')
@@ -174,8 +173,8 @@ const MODALS = {
BETA_UI_NOTIFICATION_MODAL: {
contents: [
h(NotifcationModal, {
- header: t('uiWelcome'),
- message: t('uiWelcomeMessage'),
+ header: 'uiWelcome',
+ message: 'uiWelcomeMessage',
}),
],
mobileModalStyle: {
@@ -191,8 +190,8 @@ const MODALS = {
OLD_UI_NOTIFICATION_MODAL: {
contents: [
h(NotifcationModal, {
- header: t('oldUI'),
- message: t('oldUIMessage'),
+ header: 'oldUI',
+ message: 'oldUIMessage',
}),
],
mobileModalStyle: {
diff --git a/ui/app/components/modals/new-account-modal.js b/ui/app/components/modals/new-account-modal.js
index 298b76af4..372b65251 100644
--- a/ui/app/components/modals/new-account-modal.js
+++ b/ui/app/components/modals/new-account-modal.js
@@ -1,9 +1,8 @@
const { Component } = require('react')
const PropTypes = require('prop-types')
const h = require('react-hyperscript')
-const { connect } = require('react-redux')
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
-const t = require('../../../i18n')
class NewAccountModal extends Component {
constructor (props) {
@@ -12,7 +11,7 @@ class NewAccountModal extends Component {
const newAccountNumber = numberOfExistingAccounts + 1
this.state = {
- newAccountName: `${t('account')} ${newAccountNumber}`,
+ newAccountName: `${props.t('account')} ${newAccountNumber}`,
}
}
@@ -23,7 +22,7 @@ class NewAccountModal extends Component {
h('div.new-account-modal-wrapper', {
}, [
h('div.new-account-modal-header', {}, [
- t('newAccount'),
+ this.props.t('newAccount'),
]),
h('div.modal-close-x', {
@@ -31,19 +30,19 @@ class NewAccountModal extends Component {
}),
h('div.new-account-modal-content', {}, [
- t('accountName'),
+ this.props.t('accountName'),
]),
h('div.new-account-input-wrapper', {}, [
h('input.new-account-input', {
value: this.state.newAccountName,
- placeholder: t('sampleAccountName'),
+ placeholder: this.props.t('sampleAccountName'),
onChange: event => this.setState({ newAccountName: event.target.value }),
}, []),
]),
h('div.new-account-modal-content.after-input', {}, [
- t('or'),
+ this.props.t('or'),
]),
h('div.new-account-modal-content.after-input.pointer', {
@@ -51,13 +50,13 @@ class NewAccountModal extends Component {
this.props.hideModal()
this.props.showImportPage()
},
- }, t('importAnAccount')),
+ }, this.props.t('importAnAccount')),
h('div.new-account-modal-content.button.allcaps', {}, [
h('button.btn-clear', {
onClick: () => this.props.createAccount(newAccountName),
}, [
- t('save'),
+ this.props.t('save'),
]),
]),
]),
@@ -70,6 +69,7 @@ NewAccountModal.propTypes = {
showImportPage: PropTypes.func,
createAccount: PropTypes.func,
numberOfExistingAccounts: PropTypes.number,
+ t: PropTypes.func,
}
const mapStateToProps = state => {
diff --git a/ui/app/components/modals/notification-modal.js b/ui/app/components/modals/notification-modal.js
index 621a974d0..5d6dca177 100644
--- a/ui/app/components/modals/notification-modal.js
+++ b/ui/app/components/modals/notification-modal.js
@@ -1,7 +1,7 @@
const { Component } = require('react')
const PropTypes = require('prop-types')
const h = require('react-hyperscript')
-const { connect } = require('react-redux')
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
class NotificationModal extends Component {
@@ -22,12 +22,12 @@ class NotificationModal extends Component {
}, [
h('div.notification-modal__header', {}, [
- header,
+ this.props.t(header),
]),
h('div.notification-modal__message-wrapper', {}, [
h('div.notification-modal__message', {}, [
- message,
+ this.props.t(message),
]),
]),
@@ -62,6 +62,7 @@ NotificationModal.propTypes = {
showCancelButton: PropTypes.bool,
showConfirmButton: PropTypes.bool,
onConfirm: PropTypes.func,
+ t: PropTypes.func,
}
const mapDispatchToProps = dispatch => {
diff --git a/ui/app/components/modals/notification-modals/confirm-reset-account.js b/ui/app/components/modals/notification-modals/confirm-reset-account.js
index e1bc91b24..94ee997ab 100644
--- a/ui/app/components/modals/notification-modals/confirm-reset-account.js
+++ b/ui/app/components/modals/notification-modals/confirm-reset-account.js
@@ -1,7 +1,7 @@
const { Component } = require('react')
const PropTypes = require('prop-types')
const h = require('react-hyperscript')
-const { connect } = require('react-redux')
+const connect = require('../../../metamask-connect')
const actions = require('../../../actions')
const NotifcationModal = require('../notification-modal')
diff --git a/ui/app/components/modals/shapeshift-deposit-tx-modal.js b/ui/app/components/modals/shapeshift-deposit-tx-modal.js
index 24af5a0de..28dcb1902 100644
--- a/ui/app/components/modals/shapeshift-deposit-tx-modal.js
+++ b/ui/app/components/modals/shapeshift-deposit-tx-modal.js
@@ -1,7 +1,7 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
+const connect = require('../../metamask-connect')
const actions = require('../../actions')
const QrView = require('../qr-code')
const AccountModalContainer = require('./account-modal-container')