2020-04-10 13:31:36 -04:00
|
|
|
// @flow
|
2019-06-17 16:32:38 -04:00
|
|
|
import React from 'react';
|
2021-08-13 19:59:43 +02:00
|
|
|
import { useHistory } from 'react-router';
|
2020-04-10 13:31:36 -04:00
|
|
|
import TxoList from 'component/txoList';
|
2019-06-17 16:32:38 -04:00
|
|
|
import Page from 'component/page';
|
2021-11-28 15:05:10 -05:00
|
|
|
import WalletBalance from 'component/walletBalance';
|
2020-06-01 13:03:19 -04:00
|
|
|
import Spinner from 'component/spinner';
|
2020-08-26 13:19:03 -04:00
|
|
|
import YrblWalletEmpty from 'component/yrblWalletEmpty';
|
2021-08-13 19:59:43 +02:00
|
|
|
|
2020-04-10 13:31:36 -04:00
|
|
|
type Props = {
|
2021-07-03 14:32:06 -04:00
|
|
|
history: { action: string, push: (string) => void, replace: (string) => void },
|
2020-04-10 13:31:36 -04:00
|
|
|
location: { search: string, pathname: string },
|
2021-02-05 12:46:07 -05:00
|
|
|
totalBalance: ?number,
|
2020-04-10 13:31:36 -04:00
|
|
|
};
|
2019-06-17 16:32:38 -04:00
|
|
|
|
2020-04-10 13:31:36 -04:00
|
|
|
const WalletPage = (props: Props) => {
|
2021-08-13 19:59:43 +02:00
|
|
|
const {
|
|
|
|
location: { search },
|
|
|
|
} = useHistory();
|
|
|
|
|
|
|
|
const { totalBalance } = props;
|
2021-02-05 12:46:07 -05:00
|
|
|
const showIntro = totalBalance === 0;
|
|
|
|
const loading = totalBalance === undefined;
|
2020-04-10 13:31:36 -04:00
|
|
|
|
|
|
|
return (
|
2021-10-18 19:37:58 -04:00
|
|
|
<Page>
|
|
|
|
{loading && (
|
|
|
|
<div className="main--empty">
|
|
|
|
<Spinner delayed />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{!loading && (
|
|
|
|
<>
|
|
|
|
{showIntro ? (
|
|
|
|
<YrblWalletEmpty includeWalletLink />
|
|
|
|
) : (
|
|
|
|
<div className="card-stack">
|
2021-11-28 15:05:10 -05:00
|
|
|
<WalletBalance />
|
2021-10-18 19:37:58 -04:00
|
|
|
<TxoList search={search} />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</Page>
|
2020-04-10 13:31:36 -04:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-08-13 19:59:43 +02:00
|
|
|
export default WalletPage;
|