vega-frontend-monorepo/apps/trading/client-pages/portfolio/portfolio.tsx
m.ray c5b6032184
feat(#469): account history with pennant price chart (#2434)
* feat: account hitory poc

* feat(#469): update account history and chart

* feat(#469): remove radix toggle group

* fix: add use memo and some tweaks to make sure you pass undefined to cancel all

* feat(#469): add new version pennant

* feat(#469): style account history chart and no data splash

* fix(#469): use splash only

* fix(#469): sort assets list

* feat(#469): new pennant version

* fix: update query

* fix: update query

* Update libs/orders/src/lib/components/order-list/order-list.tsx

* Update libs/assets/src/lib/asset-details-dialog.tsx

* feat(#469): update test on trading positions tab

* Update apps/trading-e2e/src/integration/trading-positions.cy.ts

* fix: click on positions in portfolio

* feat(#469): refactor with async renderer

* feat(#469): refactor date range in account history

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-12-20 11:22:35 +00:00

101 lines
3.4 KiB
TypeScript

import { t, titlefy } from '@vegaprotocol/react-helpers';
import { PositionsContainer } from '@vegaprotocol/positions';
import { OrderListContainer } from '@vegaprotocol/orders';
import { ResizableGridPanel, Tab, Tabs } from '@vegaprotocol/ui-toolkit';
import { WithdrawalsContainer } from './withdrawals-container';
import { FillsContainer } from '@vegaprotocol/fills';
import type { ReactNode } from 'react';
import { useEffect } from 'react';
import { VegaWalletContainer } from '../../components/vega-wallet-container';
import { DepositsContainer } from './deposits-container';
import { ResizableGrid } from '@vegaprotocol/ui-toolkit';
import { LayoutPriority } from 'allotment';
import { usePageTitleStore } from '../../stores';
import { LedgerContainer } from '@vegaprotocol/ledger';
import { AccountsContainer } from '../../components/accounts-container';
import { AccountHistoryContainer } from './account-history-container';
export const Portfolio = () => {
const { updateTitle } = usePageTitleStore((store) => ({
updateTitle: store.updateTitle,
}));
useEffect(() => {
updateTitle(titlefy([t('Portfolio')]));
}, [updateTitle]);
const wrapperClasses = 'h-full max-h-full flex flex-col';
return (
<div className={wrapperClasses}>
<ResizableGrid vertical>
<ResizableGridPanel minSize={75}>
<PortfolioGridChild>
<Tabs>
<Tab id="account-history" name={t('Account history')}>
<VegaWalletContainer>
<AccountHistoryContainer />
</VegaWalletContainer>
</Tab>
<Tab id="positions" name={t('Positions')}>
<VegaWalletContainer>
<PositionsContainer />
</VegaWalletContainer>
</Tab>
<Tab id="orders" name={t('Orders')}>
<VegaWalletContainer>
<OrderListContainer />
</VegaWalletContainer>
</Tab>
<Tab id="fills" name={t('Fills')}>
<VegaWalletContainer>
<FillsContainer />
</VegaWalletContainer>
</Tab>
<Tab id="ledger-entries" name={t('Ledger entries')}>
<VegaWalletContainer>
<LedgerContainer />
</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>
);
};
interface PortfolioGridChildProps {
children: ReactNode;
}
const PortfolioGridChild = ({ children }: PortfolioGridChildProps) => {
return (
<section className="bg-white dark:bg-black w-full h-full">
{children}
</section>
);
};