Merge pull request #453 from trezor/fix/xrp-currency-format

Fix/add missing formatter for xrp
pull/456/head
Vladimir Volek 5 years ago committed by GitHub
commit 5fb9656f2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,6 +11,11 @@ const definedMessages: Messages = defineMessages({
id: 'TR_RATE', id: 'TR_RATE',
defaultMessage: 'Rate', defaultMessage: 'Rate',
}, },
TR_RESERVE: {
id: 'TR_RESERVE',
defaultMessage: 'Reserve',
description: 'Label for minimal XRP account reserve',
},
}); });
export default definedMessages; export default definedMessages;

@ -5,9 +5,11 @@ import styled from 'styled-components';
import Icon from 'components/Icon'; import Icon from 'components/Icon';
import colors from 'config/colors'; import colors from 'config/colors';
import ICONS from 'config/icons'; import ICONS from 'config/icons';
import { FormattedMessage, FormattedNumber } from 'react-intl';
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables'; import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
import Tooltip from 'components/Tooltip'; import Tooltip from 'components/Tooltip';
import type { Network, State as ReducersState } from 'flowtype'; import type { Network, State as ReducersState } from 'flowtype';
import l10nMessages from '../../../components/Balance/index.messages';
type Props = { type Props = {
network: Network, network: Network,
@ -154,7 +156,17 @@ class AccountBalance extends PureComponent<Props, State> {
<Label>Balance</Label> <Label>Balance</Label>
<TooltipWrapper> <TooltipWrapper>
<FiatValue> <FiatValue>
{fiatRates ? `${fiat} ${localCurrency}` : 'N/A'} {fiatRates ? (
<FormattedNumber
currency={localCurrency}
value={fiat}
minimumFractionDigits={2}
// eslint-disable-next-line react/style-prop-object
style="currency"
/>
) : (
'N/A'
)}
</FiatValue> </FiatValue>
{!fiatRates && NoRatesTooltip} {!fiatRates && NoRatesTooltip}
</TooltipWrapper> </TooltipWrapper>
@ -164,7 +176,9 @@ class AccountBalance extends PureComponent<Props, State> {
</BalanceWrapper> </BalanceWrapper>
{this.props.reserve !== '0' && ( {this.props.reserve !== '0' && (
<BalanceWrapper> <BalanceWrapper>
<Label>Reserve</Label> <Label>
<FormattedMessage {...l10nMessages.TR_RESERVE} />
</Label>
<FiatValueRate> <FiatValueRate>
{this.props.reserve} {network.symbol} {this.props.reserve} {network.symbol}
</FiatValueRate> </FiatValueRate>
@ -172,10 +186,22 @@ class AccountBalance extends PureComponent<Props, State> {
)} )}
<BalanceRateWrapper> <BalanceRateWrapper>
<Label>Rate</Label> <Label>
<FormattedMessage {...l10nMessages.TR_RATE} />
</Label>
<TooltipWrapper> <TooltipWrapper>
<FiatValueRate> <FiatValueRate>
{fiatRates ? `${fiatRateValue} ${localCurrency}` : 'N/A'} {fiatRates ? (
<FormattedNumber
currency={localCurrency}
value={fiatRateValue}
minimumFractionDigits={2}
// eslint-disable-next-line react/style-prop-object
style="currency"
/>
) : (
'N/A'
)}
</FiatValueRate> </FiatValueRate>
{!fiatRates && NoRatesTooltip} {!fiatRates && NoRatesTooltip}
</TooltipWrapper> </TooltipWrapper>

Loading…
Cancel
Save