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-08-31 04:35:46 +00:00
|
|
|
import { ResizableGridPanel, Tab, Tabs } from '@vegaprotocol/ui-toolkit';
|
2022-07-14 16:12:28 +00:00
|
|
|
import { WithdrawalsContainer } from './withdrawals-container';
|
2022-06-30 07:52:25 +00:00
|
|
|
import { FillsContainer } from '@vegaprotocol/fills';
|
|
|
|
import type { ReactNode } from 'react';
|
2022-07-14 16:12:28 +00:00
|
|
|
import { VegaWalletContainer } from '../../components/vega-wallet-container';
|
|
|
|
import { DepositsContainer } from './deposits-container';
|
2022-08-31 04:35:46 +00:00
|
|
|
import { ResizableGrid } from '@vegaprotocol/ui-toolkit';
|
|
|
|
import { LayoutPriority } from 'allotment';
|
2022-06-07 09:26:45 +00:00
|
|
|
|
2022-02-17 05:03:46 +00:00
|
|
|
const Portfolio = () => {
|
2022-08-31 04:35:46 +00:00
|
|
|
const wrapperClasses = 'h-full max-h-full flex flex-col';
|
|
|
|
const tabContentClassName = 'h-full grid 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}>
|
2022-08-31 04:35:46 +00:00
|
|
|
<ResizableGrid vertical={true}>
|
|
|
|
<ResizableGridPanel minSize={75}>
|
|
|
|
<PortfolioGridChild>
|
2022-08-05 13:24:46 +00:00
|
|
|
<Tabs>
|
|
|
|
<Tab id="positions" name={t('Positions')}>
|
|
|
|
<VegaWalletContainer>
|
|
|
|
<div className={tabContentClassName}>
|
2022-08-31 04:35:46 +00:00
|
|
|
<h4 className="text-xl p-4">{t('Positions')}</h4>
|
2022-08-05 13:24:46 +00:00
|
|
|
<div>
|
|
|
|
<PositionsContainer />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</VegaWalletContainer>
|
|
|
|
</Tab>
|
|
|
|
<Tab id="orders" name={t('Orders')}>
|
|
|
|
<VegaWalletContainer>
|
|
|
|
<div className={tabContentClassName}>
|
2022-08-31 04:35:46 +00:00
|
|
|
<h4 className="text-xl p-4">{t('Orders')}</h4>
|
2022-08-05 13:24:46 +00:00
|
|
|
<div>
|
|
|
|
<OrderListContainer />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</VegaWalletContainer>
|
|
|
|
</Tab>
|
|
|
|
<Tab id="fills" name={t('Fills')}>
|
|
|
|
<VegaWalletContainer>
|
|
|
|
<div className={tabContentClassName}>
|
2022-08-31 04:35:46 +00:00
|
|
|
<h4 className="text-xl p-4">{t('Fills')}</h4>
|
2022-08-05 13:24:46 +00:00
|
|
|
<div>
|
|
|
|
<FillsContainer />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</VegaWalletContainer>
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
</PortfolioGridChild>
|
2022-08-31 04:35:46 +00:00
|
|
|
</ResizableGridPanel>
|
|
|
|
<ResizableGridPanel
|
2022-08-05 13:24:46 +00:00
|
|
|
priority={LayoutPriority.Low}
|
|
|
|
preferredSize={300}
|
|
|
|
minSize={50}
|
|
|
|
>
|
2022-08-31 04:35:46 +00:00
|
|
|
<PortfolioGridChild>
|
2022-08-05 13:24:46 +00:00
|
|
|
<Tabs>
|
|
|
|
<Tab id="collateral" name={t('Collateral')}>
|
|
|
|
<VegaWalletContainer>
|
|
|
|
<AccountsContainer />
|
|
|
|
</VegaWalletContainer>
|
|
|
|
</Tab>
|
|
|
|
<Tab id="deposits" name={t('Deposits')}>
|
2022-09-06 01:30:13 +00:00
|
|
|
<VegaWalletContainer>
|
|
|
|
<DepositsContainer />
|
|
|
|
</VegaWalletContainer>
|
2022-08-05 13:24:46 +00:00
|
|
|
</Tab>
|
|
|
|
<Tab id="withdrawals" name={t('Withdrawals')}>
|
2022-09-06 01:30:13 +00:00
|
|
|
<WithdrawalsContainer />
|
2022-08-05 13:24:46 +00:00
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
</PortfolioGridChild>
|
2022-08-31 04:35:46 +00:00
|
|
|
</ResizableGridPanel>
|
|
|
|
</ResizableGrid>
|
2022-06-30 07:52:25 +00:00
|
|
|
</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;
|
|
|
|
}
|
|
|
|
|
2022-08-31 04:35:46 +00:00
|
|
|
const PortfolioGridChild = ({ children }: PortfolioGridChildProps) => {
|
|
|
|
return (
|
|
|
|
<section className="bg-white dark:bg-black w-full h-full">
|
|
|
|
{children}
|
|
|
|
</section>
|
|
|
|
);
|
2022-06-30 07:52:25 +00:00
|
|
|
};
|