Map dollar sign to USD

This commit is contained in:
finned-palmer 2021-07-10 08:27:49 -05:00
parent 031d9d5a7d
commit 6bc8d247bd
2 changed files with 11 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import React, { createContext, useContext, useEffect, useState } from 'react';
import _ from 'lodash';
import { api } from '../api';
import { reduceHistory } from '../lib/util';
import { mapDenominationToSymbol, reduceHistory } from '../lib/util';
export const SettingsContext = createContext({
network: 'bitcoin',
@ -120,6 +120,7 @@ export const SettingsProvider = ({ channel, children }) => {
const newCurrencyRates = currencyRates;
for (let c in n) {
newCurrencyRates[c] = n[c];
newCurrencyRates[c].symbol = mapDenominationToSymbol(c);
}
setCurrencyRates(newCurrencyRates);
setTimeout(() => initializeCurrencyPoll(), 1000 * 60 * 15);

View File

@ -118,3 +118,12 @@ export function reduceHistory(history) {
return hest2.recvd - hest1.recvd;
});
}
export function mapDenominationToSymbol(denomination) {
switch (denomination) {
case 'USD':
return '$';
default:
return denomination;
}
}