1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 02:58:09 +01:00
metamask-extension/ui/app/pages/send/send-header/send-header.selectors.js
Whymarrh Whitby 4d88e1cf86 Enable indent linting via ESLint (#6936)
* Enable indent linting via ESLint

* yarn run lint:fix
2019-07-31 10:17:11 -10:00

43 lines
867 B
JavaScript

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' ]
}
}