mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Rename variables to proper currency state variables.
This commit is contained in:
parent
177f2dc948
commit
37ffcfcf0e
@ -621,7 +621,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
this.currencyController.updateConversionRate()
|
this.currencyController.updateConversionRate()
|
||||||
const data = {
|
const data = {
|
||||||
conversionRate: this.currencyController.getConversionRate(),
|
conversionRate: this.currencyController.getConversionRate(),
|
||||||
currentFiat: this.currencyController.getCurrentCurrency(),
|
currentCurrency: this.currencyController.getCurrentCurrency(),
|
||||||
conversionDate: this.currencyController.getConversionDate(),
|
conversionDate: this.currencyController.getConversionDate(),
|
||||||
}
|
}
|
||||||
cb(null, data)
|
cb(null, data)
|
||||||
|
@ -71,7 +71,7 @@ var actions = {
|
|||||||
SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE',
|
SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE',
|
||||||
SHOW_CONF_MSG_PAGE: 'SHOW_CONF_MSG_PAGE',
|
SHOW_CONF_MSG_PAGE: 'SHOW_CONF_MSG_PAGE',
|
||||||
SET_CURRENT_FIAT: 'SET_CURRENT_FIAT',
|
SET_CURRENT_FIAT: 'SET_CURRENT_FIAT',
|
||||||
setCurrentFiat: setCurrentFiat,
|
setCurrentCurrency: setCurrentCurrency,
|
||||||
// account detail screen
|
// account detail screen
|
||||||
SHOW_SEND_PAGE: 'SHOW_SEND_PAGE',
|
SHOW_SEND_PAGE: 'SHOW_SEND_PAGE',
|
||||||
showSendPage: showSendPage,
|
showSendPage: showSendPage,
|
||||||
@ -328,10 +328,10 @@ function showInfoPage () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCurrentFiat (currencyCode) {
|
function setCurrentCurrency (currencyCode) {
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
dispatch(this.showLoadingIndication())
|
dispatch(this.showLoadingIndication())
|
||||||
log.debug(`background.setCurrentFiat`)
|
log.debug(`background.setCurrentCurrency`)
|
||||||
background.setCurrentCurrency(currencyCode, (err, data) => {
|
background.setCurrentCurrency(currencyCode, (err, data) => {
|
||||||
dispatch(this.hideLoadingIndication())
|
dispatch(this.hideLoadingIndication())
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -341,7 +341,7 @@ function setCurrentFiat (currencyCode) {
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: this.SET_CURRENT_FIAT,
|
type: this.SET_CURRENT_FIAT,
|
||||||
value: {
|
value: {
|
||||||
currentFiat: data.currentFiat,
|
currentCurrency: data.currentCurrency,
|
||||||
conversionRate: data.conversionRate,
|
conversionRate: data.conversionRate,
|
||||||
conversionDate: data.conversionDate,
|
conversionDate: data.conversionDate,
|
||||||
},
|
},
|
||||||
|
@ -9,7 +9,7 @@ module.exports = connect(mapStateToProps)(FiatValue)
|
|||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
return {
|
return {
|
||||||
conversionRate: state.metamask.conversionRate,
|
conversionRate: state.metamask.conversionRate,
|
||||||
currentFiat: state.metamask.currentFiat,
|
currentCurrency: state.metamask.currentCurrency,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ FiatValue.prototype.render = function () {
|
|||||||
fiatTooltipNumber = 'Unknown'
|
fiatTooltipNumber = 'Unknown'
|
||||||
}
|
}
|
||||||
|
|
||||||
var fiatSuffix = props.currentFiat
|
var fiatSuffix = props.currentCurrency
|
||||||
|
|
||||||
return fiatDisplay(fiatDisplayNumber, fiatSuffix)
|
return fiatDisplay(fiatDisplayNumber, fiatSuffix)
|
||||||
}
|
}
|
||||||
|
@ -125,19 +125,19 @@ function rpcValidation (newRpc, state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function currentConversionInformation (metamaskState, state) {
|
function currentConversionInformation (metamaskState, state) {
|
||||||
var currentFiat = metamaskState.currentFiat
|
var currentCurrency = metamaskState.currentCurrency
|
||||||
var conversionDate = metamaskState.conversionDate
|
var conversionDate = metamaskState.conversionDate
|
||||||
return h('div', [
|
return h('div', [
|
||||||
h('span', {style: { fontWeight: 'bold', paddingRight: '10px'}}, 'Current Conversion'),
|
h('span', {style: { fontWeight: 'bold', paddingRight: '10px'}}, 'Current Conversion'),
|
||||||
h('span', {style: { fontWeight: 'bold', paddingRight: '10px', fontSize: '13px'}}, `Updated ${Date(conversionDate)}`),
|
h('span', {style: { fontWeight: 'bold', paddingRight: '10px', fontSize: '13px'}}, `Updated ${Date(conversionDate)}`),
|
||||||
h('select#currentFiat', {
|
h('select#currentCurrency', {
|
||||||
onChange (event) {
|
onChange (event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
var element = document.getElementById('currentFiat')
|
var element = document.getElementById('currentCurrency')
|
||||||
var newFiat = element.value
|
var newCurrency = element.value
|
||||||
state.dispatch(actions.setCurrentFiat(newFiat))
|
state.dispatch(actions.setCurrentCurrency(newCurrency))
|
||||||
},
|
},
|
||||||
defaultValue: currentFiat,
|
defaultValue: currentCurrency,
|
||||||
}, currencies.map((currency) => {
|
}, currencies.map((currency) => {
|
||||||
return h('option', {key: currency.code, value: currency.code}, `${currency.code} - ${currency.name}`)
|
return h('option', {key: currency.code, value: currency.code}, `${currency.code} - ${currency.name}`)
|
||||||
})
|
})
|
||||||
|
@ -13,9 +13,6 @@ function reduceMetamask (state, action) {
|
|||||||
rpcTarget: 'https://rawtestrpc.metamask.io/',
|
rpcTarget: 'https://rawtestrpc.metamask.io/',
|
||||||
identities: {},
|
identities: {},
|
||||||
unapprovedTxs: {},
|
unapprovedTxs: {},
|
||||||
currentFiat: 'USD',
|
|
||||||
conversionRate: 0,
|
|
||||||
conversionDate: 'N/A',
|
|
||||||
noActiveNotices: true,
|
noActiveNotices: true,
|
||||||
lastUnreadNotice: undefined,
|
lastUnreadNotice: undefined,
|
||||||
frequentRpcList: [],
|
frequentRpcList: [],
|
||||||
@ -126,7 +123,7 @@ function reduceMetamask (state, action) {
|
|||||||
|
|
||||||
case actions.SET_CURRENT_FIAT:
|
case actions.SET_CURRENT_FIAT:
|
||||||
return extend(metamaskState, {
|
return extend(metamaskState, {
|
||||||
currentFiat: action.value.currentFiat,
|
currentCurrency: action.value.currentCurrency,
|
||||||
conversionRate: action.value.conversionRate,
|
conversionRate: action.value.conversionRate,
|
||||||
conversionDate: action.value.conversionDate,
|
conversionDate: action.value.conversionDate,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user