Feat/248: portfolio layout (#476)
* feat: add base portfolio layout * feat: add positions, order list and withdrawals to portfolio page * feat: add account container to portfolio page plus wallet management improvments * fix: remove duplication from portfolio page containers * fix: format and lint * fix: remove buggy wallet dialog from portfolio page * fix: deposit e2e test navigation * fix: temporarily go straight to withdrawal pages * fix: formatting * fix: add formatting Co-authored-by: Joe <joe@vega.xyz>
This commit is contained in:
parent
18b622edd7
commit
d4420d6038
@ -7,8 +7,7 @@ export default class DepositsPage extends BasePage {
|
||||
amountError = '[role="alert"][aria-describedby="amount"]';
|
||||
|
||||
navigateToDeposits() {
|
||||
cy.visit('/portfolio');
|
||||
cy.get(`a[href='/portfolio/deposit']`).click();
|
||||
cy.visit('/portfolio/deposit');
|
||||
cy.url().should('include', '/portfolio/deposit');
|
||||
cy.getByTestId('deposit-form').should('be.visible');
|
||||
}
|
||||
|
@ -11,13 +11,18 @@ Given('I navigate to withdrawal page', () => {
|
||||
cy.visit('/');
|
||||
portfolioPage.closeDialog();
|
||||
marketPage.validateMarketsAreDisplayed();
|
||||
portfolioPage.navigateToPortfolio();
|
||||
portfolioPage.navigateToWithdraw();
|
||||
|
||||
// portfolioPage.navigateToPortfolio();
|
||||
// portfolioPage.navigateToWithdraw();
|
||||
// Navigation functions commented out due to button being removed and not added back in yet
|
||||
cy.visit('/portfolio/withdraw');
|
||||
});
|
||||
|
||||
Given('I navigate to withdrawals page', () => {
|
||||
portfolioPage.navigateToPortfolio();
|
||||
portfolioPage.navigateToWithdrawals();
|
||||
// portfolioPage.navigateToPortfolio();
|
||||
// portfolioPage.navigateToWithdrawals();
|
||||
// Navigation functions commented out due to button being removed and not added back in yet
|
||||
cy.visit('/portfolio/withdrawals');
|
||||
});
|
||||
|
||||
When('I clear ethereum address', () => {
|
||||
|
@ -50,7 +50,7 @@ export const GridTabs = ({ children, group }: GridTabsProps) => {
|
||||
'text-black dark:text-vega-yellow': isActive,
|
||||
'bg-white dark:bg-black': isActive,
|
||||
'text-black dark:text-white': !isActive,
|
||||
'bg-black-10 dark:bg-white-10': !isActive,
|
||||
'bg-black-10 dark:bg-white-25': !isActive,
|
||||
});
|
||||
return (
|
||||
<Tabs.Trigger
|
||||
@ -62,7 +62,7 @@ export const GridTabs = ({ children, group }: GridTabsProps) => {
|
||||
</Tabs.Trigger>
|
||||
);
|
||||
})}
|
||||
<div className="bg-black-10 dark:bg-white-10 grow"></div>
|
||||
<div className="bg-black-10 dark:bg-white-25 grow"></div>
|
||||
</Tabs.List>
|
||||
<div className="h-full overflow-auto">
|
||||
{Children.map(children, (child) => {
|
1
apps/trading/components/grid-tabs/index.ts
Normal file
1
apps/trading/components/grid-tabs/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './grid-tabs';
|
@ -2,7 +2,6 @@ import classNames from 'classnames';
|
||||
import AutoSizer from 'react-virtualized-auto-sizer';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { GridTab, GridTabs } from './grid-tabs';
|
||||
import { DealTicketContainer } from '@vegaprotocol/deal-ticket';
|
||||
import { OrderListContainer } from '@vegaprotocol/order-list';
|
||||
import { TradesContainer } from '@vegaprotocol/trades';
|
||||
@ -13,6 +12,7 @@ import { t } from '@vegaprotocol/react-helpers';
|
||||
import { AccountsContainer } from '@vegaprotocol/accounts';
|
||||
import { DepthChartContainer } from '@vegaprotocol/market-depth';
|
||||
import { CandlesChartContainer } from '@vegaprotocol/candles-chart';
|
||||
import { GridTab, GridTabs } from '../../components/grid-tabs';
|
||||
import { SelectMarketDialog } from '@vegaprotocol/market-list';
|
||||
import { ArrowDown, PriceCellChange } from '@vegaprotocol/ui-toolkit';
|
||||
import type { CandleClose } from '@vegaprotocol/types';
|
||||
|
@ -1,39 +1,79 @@
|
||||
import { Web3Container } from '../../components/web3-container';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import { PositionsContainer } from '@vegaprotocol/positions';
|
||||
import { OrderListContainer } from '@vegaprotocol/order-list';
|
||||
import { AccountsContainer } from '@vegaprotocol/accounts';
|
||||
import { AnchorButton } from '@vegaprotocol/ui-toolkit';
|
||||
|
||||
import { WithdrawalsContainer } from './withdrawals/withdrawals-container';
|
||||
import { GridTab, GridTabs } from '../../components/grid-tabs';
|
||||
|
||||
const Portfolio = () => {
|
||||
const tabClassName = 'p-[16px] pl-[316px]';
|
||||
|
||||
return (
|
||||
<div className="p-24">
|
||||
<h1 className="text-h3 mb-12">{t('Portfolio')}</h1>
|
||||
<div className="flex gap-4 mb-12">
|
||||
<AnchorButton data-testid="deposit" href="/portfolio/deposit">
|
||||
{t('Deposit')}
|
||||
</AnchorButton>
|
||||
<AnchorButton
|
||||
data-testid="deposit-tEuro"
|
||||
href="/portfolio/deposit?assetId=8b52d4a3a4b0ffe733cddbc2b67be273816cfeb6ca4c8b339bac03ffba08e4e4"
|
||||
>
|
||||
{t('Deposit tEURO')}
|
||||
</AnchorButton>
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<AnchorButton
|
||||
data-testid="view-withdrawals"
|
||||
href="/portfolio/withdrawals"
|
||||
>
|
||||
{t('View Withdrawals')}
|
||||
</AnchorButton>
|
||||
<AnchorButton data-testid="withdraw" href="/portfolio/withdraw">
|
||||
{t('Withdraw')}
|
||||
</AnchorButton>
|
||||
<AnchorButton
|
||||
data-testid="withdraw-tEuro"
|
||||
href="/portfolio/withdraw?assetId=8b52d4a3a4b0ffe733cddbc2b67be273816cfeb6ca4c8b339bac03ffba08e4e4"
|
||||
>
|
||||
{t('Withdraw tEURO')}
|
||||
</AnchorButton>
|
||||
</div>
|
||||
</div>
|
||||
<Web3Container
|
||||
render={() => (
|
||||
<div className="h-full text-ui">
|
||||
<main className="relative h-[calc(100%-200px)]">
|
||||
<aside className="absolute px-[8px] py-[16px] w-[300px] mt-[28px] h-[calc(100%-28px)] w-[300px] overflow-auto">
|
||||
<h2 className="text-h4 text-black dark:text-white">
|
||||
{t('Filters')}
|
||||
</h2>
|
||||
</aside>
|
||||
<section>
|
||||
<GridTabs group="portfolio">
|
||||
<GridTab id="positions" name={t('Positions')}>
|
||||
<div className={tabClassName}>
|
||||
<h4 className="text-h4 text-black dark:text-white">
|
||||
{t('Positions')}
|
||||
</h4>
|
||||
<PositionsContainer />
|
||||
</div>
|
||||
</GridTab>
|
||||
<GridTab id="orders" name={t('Orders')}>
|
||||
<div className={tabClassName}>
|
||||
<h4 className="text-h4 text-black dark:text-white">
|
||||
{t('Orders')}
|
||||
</h4>
|
||||
<OrderListContainer />
|
||||
</div>
|
||||
</GridTab>
|
||||
<GridTab id="fills" name={t('Fills')}>
|
||||
<div className={tabClassName}>
|
||||
<h4 className="text-h4 text-black dark:text-white">
|
||||
{t('Fills')}
|
||||
</h4>
|
||||
</div>
|
||||
</GridTab>
|
||||
<GridTab id="history" name={t('History')}>
|
||||
<div className={tabClassName}>
|
||||
<h4 className="text-h4 text-black dark:text-white">
|
||||
{t('History')}
|
||||
</h4>
|
||||
</div>
|
||||
</GridTab>
|
||||
</GridTabs>
|
||||
</section>
|
||||
</main>
|
||||
<section className="fixed bottom-0 left-0 w-full h-[200px]">
|
||||
<GridTabs group="collaterals">
|
||||
<GridTab id="collateral" name={t('Collateral')}>
|
||||
<AccountsContainer />
|
||||
</GridTab>
|
||||
<GridTab id="deposits" name={t('Deposits')}>
|
||||
<AnchorButton data-testid="deposit" href="/portfolio/deposit">
|
||||
{t('Deposit')}
|
||||
</AnchorButton>
|
||||
</GridTab>
|
||||
<GridTab id="withdrawals" name={t('Withdrawals')}>
|
||||
<WithdrawalsContainer />
|
||||
</GridTab>
|
||||
</GridTabs>
|
||||
</section>
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { t } from '@vegaprotocol/react-helpers';
|
||||
import { AnchorButton } from '@vegaprotocol/ui-toolkit';
|
||||
import { VegaWalletContainer } from '../../../components/vega-wallet-container';
|
||||
import { Web3Container } from '../../../components/web3-container';
|
||||
import { WithdrawalsPageContainer } from './withdrawals-page-container';
|
||||
import { WithdrawalsContainer } from './withdrawals-container';
|
||||
|
||||
const Withdrawals = () => {
|
||||
return (
|
||||
@ -16,7 +16,7 @@ const Withdrawals = () => {
|
||||
{t('Start withdrawal')}
|
||||
</AnchorButton>
|
||||
</header>
|
||||
<WithdrawalsPageContainer />
|
||||
<WithdrawalsContainer />
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
|
@ -2,7 +2,7 @@ import orderBy from 'lodash/orderBy';
|
||||
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
||||
import { useWithdrawals, WithdrawalsTable } from '@vegaprotocol/withdraws';
|
||||
|
||||
export const WithdrawalsPageContainer = () => {
|
||||
export const WithdrawalsContainer = () => {
|
||||
const { data, loading, error } = useWithdrawals();
|
||||
|
||||
return (
|
Loading…
Reference in New Issue
Block a user