mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #1335 from MetaMask/buyButtonRedoCleanUp
Buy button redo clean up
This commit is contained in:
commit
2e75011778
@ -16,7 +16,6 @@ const ExportAccountView = require('./components/account-export')
|
|||||||
const ethUtil = require('ethereumjs-util')
|
const ethUtil = require('ethereumjs-util')
|
||||||
const EditableLabel = require('./components/editable-label')
|
const EditableLabel = require('./components/editable-label')
|
||||||
const Tooltip = require('./components/tooltip')
|
const Tooltip = require('./components/tooltip')
|
||||||
const BuyButtonSubview = require('./components/buy-button-subview')
|
|
||||||
module.exports = connect(mapStateToProps)(AccountDetailScreen)
|
module.exports = connect(mapStateToProps)(AccountDetailScreen)
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
@ -238,8 +237,6 @@ AccountDetailScreen.prototype.subview = function () {
|
|||||||
case 'export':
|
case 'export':
|
||||||
var state = extend({key: 'export'}, this.props)
|
var state = extend({key: 'export'}, this.props)
|
||||||
return h(ExportAccountView, state)
|
return h(ExportAccountView, state)
|
||||||
case 'buyForm':
|
|
||||||
return h(BuyButtonSubview, extend({key: 'buyForm'}, this.props))
|
|
||||||
default:
|
default:
|
||||||
return this.transactionList()
|
return this.transactionList()
|
||||||
}
|
}
|
||||||
@ -262,15 +259,3 @@ AccountDetailScreen.prototype.transactionList = function () {
|
|||||||
AccountDetailScreen.prototype.requestAccountExport = function () {
|
AccountDetailScreen.prototype.requestAccountExport = function () {
|
||||||
this.props.dispatch(actions.requestExportAccount())
|
this.props.dispatch(actions.requestExportAccount())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AccountDetailScreen.prototype.buyButtonDeligator = function () {
|
|
||||||
var props = this.props
|
|
||||||
var selected = props.address || Object.keys(props.accounts)[0]
|
|
||||||
|
|
||||||
if (this.props.accountDetail.subview === 'buyForm') {
|
|
||||||
props.dispatch(actions.backToAccountDetail(props.address))
|
|
||||||
} else {
|
|
||||||
props.dispatch(actions.buyEthView(selected))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -134,10 +134,6 @@ var actions = {
|
|||||||
buyEth: buyEth,
|
buyEth: buyEth,
|
||||||
buyEthView: buyEthView,
|
buyEthView: buyEthView,
|
||||||
BUY_ETH_VIEW: 'BUY_ETH_VIEW',
|
BUY_ETH_VIEW: 'BUY_ETH_VIEW',
|
||||||
UPDATE_COINBASE_AMOUNT: 'UPDATE_COIBASE_AMOUNT',
|
|
||||||
updateCoinBaseAmount: updateCoinBaseAmount,
|
|
||||||
UPDATE_BUY_ADDRESS: 'UPDATE_BUY_ADDRESS',
|
|
||||||
updateBuyAddress: updateBuyAddress,
|
|
||||||
COINBASE_SUBVIEW: 'COINBASE_SUBVIEW',
|
COINBASE_SUBVIEW: 'COINBASE_SUBVIEW',
|
||||||
coinBaseSubview: coinBaseSubview,
|
coinBaseSubview: coinBaseSubview,
|
||||||
SHAPESHIFT_SUBVIEW: 'SHAPESHIFT_SUBVIEW',
|
SHAPESHIFT_SUBVIEW: 'SHAPESHIFT_SUBVIEW',
|
||||||
@ -852,20 +848,6 @@ function buyEthView (address) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCoinBaseAmount (value) {
|
|
||||||
return {
|
|
||||||
type: actions.UPDATE_COINBASE_AMOUNT,
|
|
||||||
value,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateBuyAddress (value) {
|
|
||||||
return {
|
|
||||||
type: actions.UPDATE_BUY_ADDRESS,
|
|
||||||
value,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function coinBaseSubview () {
|
function coinBaseSubview () {
|
||||||
return {
|
return {
|
||||||
type: actions.COINBASE_SUBVIEW,
|
type: actions.COINBASE_SUBVIEW,
|
||||||
|
@ -45,12 +45,7 @@ CoinbaseForm.prototype.render = function () {
|
|||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
CoinbaseForm.prototype.handleAmount = function (event) {
|
|
||||||
this.props.dispatch(actions.updateCoinBaseAmount(event.target.value))
|
|
||||||
}
|
|
||||||
CoinbaseForm.prototype.handleAddress = function (event) {
|
|
||||||
this.props.dispatch(actions.updateBuyAddress(event.target.value))
|
|
||||||
}
|
|
||||||
CoinbaseForm.prototype.toCoinbase = function () {
|
CoinbaseForm.prototype.toCoinbase = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const address = props.buyView.buyAddress
|
const address = props.buyView.buyAddress
|
||||||
|
@ -276,10 +276,6 @@ ShapeshiftForm.prototype.renderInfo = function () {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
ShapeshiftForm.prototype.handleAddress = function (event) {
|
|
||||||
this.props.dispatch(actions.updateBuyAddress(event.target.value))
|
|
||||||
}
|
|
||||||
|
|
||||||
ShapeshiftForm.prototype.activeToggle = function (elementType) {
|
ShapeshiftForm.prototype.activeToggle = function (elementType) {
|
||||||
if (!this.props.buyView.formView.response || this.props.warning) return elementType
|
if (!this.props.buyView.formView.response || this.props.warning) return elementType
|
||||||
return `${elementType}.inactive`
|
return `${elementType}.inactive`
|
||||||
|
@ -470,7 +470,6 @@ function reduceApp (state, action) {
|
|||||||
context: appState.currentView.name,
|
context: appState.currentView.name,
|
||||||
},
|
},
|
||||||
identity: state.metamask.identities[action.value],
|
identity: state.metamask.identities[action.value],
|
||||||
buyAddress: action.value,
|
|
||||||
buyView: {
|
buyView: {
|
||||||
subview: 'Coinbase',
|
subview: 'Coinbase',
|
||||||
amount: '15.00',
|
amount: '15.00',
|
||||||
@ -482,32 +481,6 @@ function reduceApp (state, action) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
case actions.UPDATE_BUY_ADDRESS:
|
|
||||||
return extend(appState, {
|
|
||||||
buyView: {
|
|
||||||
subview: appState.subview,
|
|
||||||
formView: {
|
|
||||||
coinbase: appState.buyView.formView.coinbase,
|
|
||||||
shapeshift: appState.buyView.formView.shapeshift,
|
|
||||||
},
|
|
||||||
buyAddress: action.value,
|
|
||||||
amount: appState.buyView.amount,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
case actions.UPDATE_COINBASE_AMOUNT:
|
|
||||||
return extend(appState, {
|
|
||||||
buyView: {
|
|
||||||
subview: 'Coinbase',
|
|
||||||
formView: {
|
|
||||||
coinbase: true,
|
|
||||||
shapeshift: false,
|
|
||||||
},
|
|
||||||
buyAddress: appState.buyView.buyAddress,
|
|
||||||
amount: action.value,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
case actions.COINBASE_SUBVIEW:
|
case actions.COINBASE_SUBVIEW:
|
||||||
return extend(appState, {
|
return extend(appState, {
|
||||||
buyView: {
|
buyView: {
|
||||||
|
Loading…
Reference in New Issue
Block a user