vega-frontend-monorepo/apps/trading/pages/portfolio/index.page.tsx
Matthew Russell 5eb06254de
feat (#896): large withdraws (#1180)
* feat: add deposits table to deposits tab on portfolio page

* feat: refactor use-withdraw hook to not invoke eth tx

* feat: rename hook for clarity

* feat: fix withdrawal creation test

* feat: update withdraw-manager and withrawals-table tests

* chore: fix lint

* feat: remove web3 input to avoid double dialog

* chore: use renderHook from testing-library/react

* chore: update to use non deprecated fields

* chore: remove usage of all bridge contract

* feat: correctly merge cache update in withdrawals table

* feat: changes to support token app withdrawals

* chore: add height to ag grid table wrapping element

* feat: add txhash col to withdraw table

* feat: provide better ui if withdrawal is not ready to be completed

* feat: use separate dialogs for txs

* feat: allow user to immediately complete withdrawal if delay not triggered

* feat: add withdraw store to tidy up state management

* chore: fix tests

* chore: convert callback to promises, fix tests, delete withdraw page

* chore: fix lint errors

* fix: withdrawals link in nav

* feat: style changes after design update

* fix: proposal form test

* chore: tidy error ui logic

* feat: review comments

* chore: lint

* feat: add better typing for tables

* chore: put withdrawals tab at the end

* chore: update i18n

* fix: dialog in positions manager due to rename

* chore: increase spacing in withdrawal form

* chore: update tests

* chore: lint

* chore: use new assetsConnection and update cy test

* fix: incorrect shape of withdrawal generate function

* feat: delete withdrawals page now that its shown on the portfolio page

* chore: update tests to check for withdrawals page

* chore: fix tests again

* fix: page title test
2022-09-05 18:30:13 -07:00

101 lines
3.4 KiB
TypeScript

import { t } from '@vegaprotocol/react-helpers';
import { PositionsContainer } from '@vegaprotocol/positions';
import { OrderListContainer } from '@vegaprotocol/orders';
import { AccountsContainer } from '@vegaprotocol/accounts';
import { ResizableGridPanel, Tab, Tabs } from '@vegaprotocol/ui-toolkit';
import { WithdrawalsContainer } from './withdrawals-container';
import { FillsContainer } from '@vegaprotocol/fills';
import type { ReactNode } from 'react';
import { VegaWalletContainer } from '../../components/vega-wallet-container';
import { DepositsContainer } from './deposits-container';
import { ResizableGrid } from '@vegaprotocol/ui-toolkit';
import { LayoutPriority } from 'allotment';
const Portfolio = () => {
const wrapperClasses = 'h-full max-h-full flex flex-col';
const tabContentClassName = 'h-full grid grid-rows-[min-content_1fr]';
return (
<div className={wrapperClasses}>
<ResizableGrid vertical={true}>
<ResizableGridPanel minSize={75}>
<PortfolioGridChild>
<Tabs>
<Tab id="positions" name={t('Positions')}>
<VegaWalletContainer>
<div className={tabContentClassName}>
<h4 className="text-xl p-4">{t('Positions')}</h4>
<div>
<PositionsContainer />
</div>
</div>
</VegaWalletContainer>
</Tab>
<Tab id="orders" name={t('Orders')}>
<VegaWalletContainer>
<div className={tabContentClassName}>
<h4 className="text-xl p-4">{t('Orders')}</h4>
<div>
<OrderListContainer />
</div>
</div>
</VegaWalletContainer>
</Tab>
<Tab id="fills" name={t('Fills')}>
<VegaWalletContainer>
<div className={tabContentClassName}>
<h4 className="text-xl p-4">{t('Fills')}</h4>
<div>
<FillsContainer />
</div>
</div>
</VegaWalletContainer>
</Tab>
</Tabs>
</PortfolioGridChild>
</ResizableGridPanel>
<ResizableGridPanel
priority={LayoutPriority.Low}
preferredSize={300}
minSize={50}
>
<PortfolioGridChild>
<Tabs>
<Tab id="collateral" name={t('Collateral')}>
<VegaWalletContainer>
<AccountsContainer />
</VegaWalletContainer>
</Tab>
<Tab id="deposits" name={t('Deposits')}>
<VegaWalletContainer>
<DepositsContainer />
</VegaWalletContainer>
</Tab>
<Tab id="withdrawals" name={t('Withdrawals')}>
<WithdrawalsContainer />
</Tab>
</Tabs>
</PortfolioGridChild>
</ResizableGridPanel>
</ResizableGrid>
</div>
);
};
Portfolio.getInitialProps = () => ({
page: 'portfolio',
});
export default Portfolio;
interface PortfolioGridChildProps {
children: ReactNode;
}
const PortfolioGridChild = ({ children }: PortfolioGridChildProps) => {
return (
<section className="bg-white dark:bg-black w-full h-full">
{children}
</section>
);
};