lbry-desktop/ui/component/walletSpendableBalanceHelp/view.jsx
infinite-persistence aa5e4d6c13
Fix double translation
No need for the macro when `<I18nMessage>` is used.
2022-03-31 17:46:12 +08:00

22 lines
719 B
JavaScript

// @flow
import CreditAmount from 'component/common/credit-amount';
import I18nMessage from 'component/i18nMessage';
import React from 'react';
type Props = { balance: number, inline?: boolean };
function WalletSpendableBalanceHelp(props: Props) {
const { balance, inline } = props;
const getMessage = (text: string) => (
<I18nMessage tokens={{ balance: <CreditAmount amount={balance} precision={4} /> }}>{text}</I18nMessage>
);
return !balance ? null : inline ? (
<span className="help--spendable">{getMessage('%balance% available.')}</span>
) : (
<div className="help">{getMessage('Your immediately spendable balance is %balance%.')}</div>
);
}
export default WalletSpendableBalanceHelp;