You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
885 B
42 lines
885 B
const {
|
|
getSelectedToken,
|
|
getSendEditingTransactionId,
|
|
getSendTo,
|
|
} = require('../send.selectors.js')
|
|
|
|
const selectors = {
|
|
getTitleKey,
|
|
getSubtitleParams,
|
|
}
|
|
|
|
module.exports = selectors
|
|
|
|
function getTitleKey (state) {
|
|
const isEditing = Boolean(getSendEditingTransactionId(state))
|
|
const isToken = Boolean(getSelectedToken(state))
|
|
|
|
if (!getSendTo(state)) {
|
|
return 'addRecipient'
|
|
}
|
|
|
|
if (isEditing) {
|
|
return 'edit'
|
|
} else if (isToken) {
|
|
return 'sendTokens'
|
|
} else {
|
|
return 'sendETH'
|
|
}
|
|
}
|
|
|
|
function getSubtitleParams (state) {
|
|
const isEditing = Boolean(getSendEditingTransactionId(state))
|
|
const token = getSelectedToken(state)
|
|
|
|
if (isEditing) {
|
|
return [ 'editingTransaction' ]
|
|
} else if (token) {
|
|
return [ 'onlySendTokensToAccountAddress', [ token.symbol ] ]
|
|
} else {
|
|
return [ 'onlySendToEtherAddress' ]
|
|
}
|
|
}
|
|
|