add currency ordering

This commit is contained in:
Barry Gitarts 2019-10-31 11:29:47 -04:00 committed by Barry G
parent aeb32072ed
commit 5acc0a22a1
2 changed files with 4 additions and 2 deletions

View File

@ -19,7 +19,7 @@ import { updateStalePledges, getAndAddPledges } from './actions/pledges'
import { updateDelegates } from './actions/delegates'
import { MySnackbarContentWrapper } from './components/base/SnackBars'
import { getUsdPrice, getPrices, generatePairKey } from './utils/prices'
import { currencies } from './utils/currencies'
import { currencies, currencyOrder } from './utils/currencies'
import { uris } from './remote/graph'
import { getKyberCurrencies } from './remote/kyber'
@ -48,7 +48,7 @@ class App extends React.Component {
setCurrencies = async network => {
const kyberCurrencies = await getKyberCurrencies(network)
this.currencies = [...currencies, ...kyberCurrencies]
this.currencies = [...currencies, ...kyberCurrencies].sort(currencyOrder)
this.getAndSetPrices()
}

View File

@ -100,3 +100,5 @@ export const generateHumanReadibleFn = decimals =>
export const generateChainReadibleFn = decimals =>
num => (num * (10**decimals)).toString()
const order = ['ETH', 'SNT'].reverse()
export const currencyOrder = (a, b) => order.indexOf(b.label) - order.indexOf(a.label)