2022-06-07 09:26:45 +00:00
|
|
|
import { Web3Container } from '../../components/web3-container';
|
2022-03-31 01:08:25 +00:00
|
|
|
import { t } from '@vegaprotocol/react-helpers';
|
2022-06-07 09:26:45 +00:00
|
|
|
import { PositionsContainer } from '@vegaprotocol/positions';
|
2022-07-13 14:23:46 +00:00
|
|
|
import { OrderListContainer } from '@vegaprotocol/orders';
|
2022-06-07 09:26:45 +00:00
|
|
|
import { AccountsContainer } from '@vegaprotocol/accounts';
|
2022-06-24 03:16:01 +00:00
|
|
|
import { AnchorButton, Tab, Tabs } from '@vegaprotocol/ui-toolkit';
|
2022-06-07 09:26:45 +00:00
|
|
|
import { WithdrawalsContainer } from './withdrawals/withdrawals-container';
|
2022-06-30 07:52:25 +00:00
|
|
|
import { FillsContainer } from '@vegaprotocol/fills';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import type { ReactNode } from 'react';
|
2022-06-07 09:26:45 +00:00
|
|
|
|
2022-02-17 05:03:46 +00:00
|
|
|
const Portfolio = () => {
|
2022-06-30 07:52:25 +00:00
|
|
|
const wrapperClasses = classNames(
|
|
|
|
'h-full max-h-full',
|
|
|
|
'grid gap-4 grid-rows-[1fr_300px]',
|
|
|
|
'bg-black-10 dark:bg-white-10',
|
|
|
|
'text-ui'
|
|
|
|
);
|
|
|
|
const tabContentClassName = 'h-full grid gap-4 grid-rows-[min-content_1fr]';
|
2022-02-17 05:03:46 +00:00
|
|
|
return (
|
2022-06-30 07:52:25 +00:00
|
|
|
<div className={wrapperClasses}>
|
|
|
|
<PortfolioGridChild>
|
|
|
|
<Tabs>
|
|
|
|
<Tab id="positions" name={t('Positions')}>
|
|
|
|
<div className={tabContentClassName}>
|
|
|
|
<h4 className="text-h4 text-black dark:text-white p-8">
|
|
|
|
{t('Positions')}
|
|
|
|
</h4>
|
|
|
|
<div>
|
|
|
|
<PositionsContainer />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Tab>
|
|
|
|
<Tab id="orders" name={t('Orders')}>
|
|
|
|
<div className={tabContentClassName}>
|
|
|
|
<h4 className="text-h4 text-black dark:text-white p-8">
|
|
|
|
{t('Orders')}
|
|
|
|
</h4>
|
|
|
|
<div>
|
|
|
|
<OrderListContainer />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Tab>
|
|
|
|
<Tab id="fills" name={t('Fills')}>
|
|
|
|
<div className={tabContentClassName}>
|
|
|
|
<h4 className="text-h4 text-black dark:text-white p-8">
|
|
|
|
{t('Fills')}
|
|
|
|
</h4>
|
|
|
|
<div>
|
|
|
|
<FillsContainer />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
</PortfolioGridChild>
|
|
|
|
<PortfolioGridChild>
|
|
|
|
<Tabs>
|
|
|
|
<Tab id="collateral" name={t('Collateral')}>
|
|
|
|
<AccountsContainer />
|
|
|
|
</Tab>
|
|
|
|
<Tab id="deposits" name={t('Deposits')}>
|
|
|
|
<div className={tabContentClassName}>
|
|
|
|
<div className="p-8">
|
|
|
|
<AnchorButton data-testid="deposit" href="/portfolio/deposit">
|
|
|
|
{t('Deposit')}
|
|
|
|
</AnchorButton>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Tab>
|
|
|
|
<Tab id="withdrawals" name={t('Withdrawals')}>
|
|
|
|
<Web3Container>
|
2022-06-07 22:08:40 +00:00
|
|
|
<WithdrawalsContainer />
|
2022-06-30 07:52:25 +00:00
|
|
|
</Web3Container>
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
</PortfolioGridChild>
|
|
|
|
</div>
|
2022-02-17 05:03:46 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-04-12 11:04:26 +00:00
|
|
|
Portfolio.getInitialProps = () => ({
|
|
|
|
page: 'portfolio',
|
|
|
|
});
|
|
|
|
|
2022-02-17 05:03:46 +00:00
|
|
|
export default Portfolio;
|
2022-06-30 07:52:25 +00:00
|
|
|
|
|
|
|
interface PortfolioGridChildProps {
|
|
|
|
children: ReactNode;
|
|
|
|
className?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const PortfolioGridChild = ({
|
|
|
|
children,
|
|
|
|
className,
|
|
|
|
}: PortfolioGridChildProps) => {
|
|
|
|
const gridChildClasses = classNames('bg-white dark:bg-black', className);
|
|
|
|
return <section className={gridChildClasses}>{children}</section>;
|
|
|
|
};
|