/* @flow */
import * as React from 'react';
import { Notification, Link } from 'trezor-ui-components';
import Bignumber from 'bignumber.js';
import { FormattedMessage } from 'react-intl';
import { withRouter } from 'react-router-dom';
import l10nCommonMessages from 'views/common.messages';
import { matchPath } from 'react-router';
import { getPattern } from 'support/routes';
import l10nMessages from './index.messages';
import type { Props } from '../../index';
export default withRouter((props: Props) => {
const { selectedAccount } = props;
const { account } = selectedAccount;
const { location } = props.router;
const notifications = [];
if (!location) return null;
// Ripple minimum reserve notification
if (selectedAccount && account && account.networkType === 'ripple') {
const { reserve, balance } = account;
const bigBalance = new Bignumber(balance);
const bigReserve = new Bignumber(reserve);
if (bigBalance.isLessThan(bigReserve)) {
notifications.push(
}
message={
<>
),
}}
/>
>
}
/>
);
}
}
// Import tool notification
if (matchPath(location.pathname, { path: getPattern('wallet-import') })) {
notifications.push(
);
}
if (account && account.imported) {
notifications.push(
);
}
return {notifications};
});