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