lbry-desktop/ui/page/wallet/view.jsx

46 lines
1.1 KiB
React
Raw Normal View History

// @flow
2019-06-17 22:32:38 +02:00
import React from 'react';
import { withRouter } from 'react-router';
2019-06-17 22:32:38 +02:00
import WalletBalance from 'component/walletBalance';
import TxoList from 'component/txoList';
2019-06-17 22:32:38 +02:00
import Page from 'component/page';
2020-06-01 19:03:19 +02:00
import Spinner from 'component/spinner';
import YrblWalletEmpty from 'component/yrblWalletEmpty';
2019-06-17 22:32:38 +02:00
type Props = {
history: { action: string, push: string => void, replace: string => void },
location: { search: string, pathname: string },
2020-06-01 19:03:19 +02:00
balance: number,
};
2019-06-17 22:32:38 +02:00
const WalletPage = (props: Props) => {
const { location, balance } = props;
const { search } = location;
2020-06-01 19:03:19 +02:00
const showIntro = balance === 0;
const loading = balance === undefined;
return (
<Page>
2020-06-01 19:03:19 +02:00
{loading && (
<div className="main--empty">
<Spinner delayed />
</div>
)}
{!loading && (
<>
{showIntro ? (
<YrblWalletEmpty includeWalletLink />
2020-06-01 19:03:19 +02:00
) : (
<div className="card-stack">
2020-06-01 19:03:19 +02:00
<WalletBalance />
<TxoList search={search} />
</div>
2020-06-01 19:03:19 +02:00
)}
</>
)}
</Page>
);
};
export default withRouter(WalletPage);