2020-04-10 19:31:36 +02:00
|
|
|
// @flow
|
2019-06-17 22:32:38 +02:00
|
|
|
import React from 'react';
|
2020-04-10 19:31:36 +02:00
|
|
|
import { withRouter } from 'react-router';
|
2019-06-17 22:32:38 +02:00
|
|
|
import WalletBalance from 'component/walletBalance';
|
2020-04-10 19:31:36 +02:00
|
|
|
import TxoList from 'component/txoList';
|
2021-07-03 19:19:23 +02:00
|
|
|
import StripeAccountConnection from 'component/stripeAccountConnection';
|
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';
|
2020-08-26 19:19:03 +02:00
|
|
|
import YrblWalletEmpty from 'component/yrblWalletEmpty';
|
2019-06-17 22:32:38 +02:00
|
|
|
|
2020-04-10 19:31:36 +02:00
|
|
|
type Props = {
|
2021-07-03 20:32:06 +02:00
|
|
|
history: { action: string, push: (string) => void, replace: (string) => void },
|
2020-04-10 19:31:36 +02:00
|
|
|
location: { search: string, pathname: string },
|
2021-02-05 18:46:07 +01:00
|
|
|
totalBalance: ?number,
|
2020-04-10 19:31:36 +02:00
|
|
|
};
|
2019-06-17 22:32:38 +02:00
|
|
|
|
2020-04-10 19:31:36 +02:00
|
|
|
const WalletPage = (props: Props) => {
|
2021-02-05 18:46:07 +01:00
|
|
|
const { location, totalBalance } = props;
|
2020-04-10 19:31:36 +02:00
|
|
|
const { search } = location;
|
2021-02-05 18:46:07 +01:00
|
|
|
const showIntro = totalBalance === 0;
|
|
|
|
const loading = totalBalance === undefined;
|
2020-04-10 19:31:36 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Page>
|
2020-06-01 19:03:19 +02:00
|
|
|
{loading && (
|
|
|
|
<div className="main--empty">
|
|
|
|
<Spinner delayed />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{!loading && (
|
|
|
|
<>
|
|
|
|
{showIntro ? (
|
2020-08-26 19:19:03 +02:00
|
|
|
<YrblWalletEmpty includeWalletLink />
|
2020-06-01 19:03:19 +02:00
|
|
|
) : (
|
2021-01-12 16:25:51 +01:00
|
|
|
<div className="card-stack">
|
2020-06-01 19:03:19 +02:00
|
|
|
<WalletBalance />
|
2021-07-03 20:32:06 +02:00
|
|
|
{/* @if TARGET='web' */}
|
2021-07-03 19:19:23 +02:00
|
|
|
<StripeAccountConnection />
|
2021-07-03 20:32:06 +02:00
|
|
|
{/* @endif */}
|
2020-06-01 19:03:19 +02:00
|
|
|
<TxoList search={search} />
|
2021-01-12 16:25:51 +01:00
|
|
|
</div>
|
2020-06-01 19:03:19 +02:00
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)}
|
2020-04-10 19:31:36 +02:00
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default withRouter(WalletPage);
|