Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3977b491b7 |
@@ -137,8 +137,6 @@ const ClosedMarketsDataGrid = ({
|
||||
headerName: t('Market'),
|
||||
field: 'code',
|
||||
cellRenderer: 'MarketCodeCell',
|
||||
width: 150,
|
||||
resizable: true,
|
||||
},
|
||||
{
|
||||
headerName: t('Status'),
|
||||
@@ -282,7 +280,6 @@ const ClosedMarketsDataGrid = ({
|
||||
return (
|
||||
<AgGrid
|
||||
rowData={rowData}
|
||||
defaultColDef={COL_DEFS.default}
|
||||
columnDefs={colDefs}
|
||||
getRowId={({ data }) => data.id}
|
||||
overlayNoRowsTemplate={error ? error.message : t('No markets')}
|
||||
|
||||
@@ -17,7 +17,6 @@ const defaultColDef = {
|
||||
filter: true,
|
||||
resizable: true,
|
||||
filterParams: { buttons: ['reset'] },
|
||||
minWidth: 120,
|
||||
};
|
||||
|
||||
const components = {
|
||||
|
||||
@@ -53,7 +53,6 @@ export const MarketsPage = () => {
|
||||
size="extra-small"
|
||||
data-testid="propose-new-market"
|
||||
href={externalLink}
|
||||
target="_blank"
|
||||
>
|
||||
{t('Propose a new market')}
|
||||
</TradingAnchorButton>
|
||||
|
||||
@@ -29,7 +29,6 @@ export const useColumnDefs = () => {
|
||||
{
|
||||
headerName: t('Market'),
|
||||
field: 'tradableInstrument.instrument.code',
|
||||
pinned: true,
|
||||
cellRenderer: ({
|
||||
value,
|
||||
data,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useT } from '../../lib/use-t';
|
||||
import { RewardsContainer } from '../../components/rewards-container';
|
||||
import { usePageTitleStore } from '../../stores';
|
||||
import { ErrorBoundary } from '../../components/error-boundary';
|
||||
import { TinyScroll } from '@vegaprotocol/ui-toolkit';
|
||||
|
||||
export const Rewards = () => {
|
||||
const t = useT();
|
||||
@@ -17,10 +16,10 @@ export const Rewards = () => {
|
||||
}, [updateTitle, title]);
|
||||
return (
|
||||
<ErrorBoundary feature="rewards">
|
||||
<TinyScroll className="p-4 max-h-full overflow-auto">
|
||||
<div className="container mx-auto p-4">
|
||||
<h1 className="px-4 pb-4 text-2xl">{title}</h1>
|
||||
<RewardsContainer />
|
||||
</TinyScroll>
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -97,9 +97,9 @@ const MarketData = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="w-2/6" role="gridcell">
|
||||
<div className="w-2/5" role="gridcell">
|
||||
<h3 className="flex items-baseline">
|
||||
<span className="overflow-hidden text-xs md:text-sm lg:text-base text-ellipsis whitespace-nowrap">
|
||||
<span className="overflow-hidden text-sm lg:text-base text-ellipsis whitespace-nowrap">
|
||||
{market.tradableInstrument.instrument.code}
|
||||
</span>
|
||||
{allProducts && productType && (
|
||||
@@ -113,7 +113,7 @@ const MarketData = ({
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className="w-2/6 overflow-hidden text-xs lg:text-sm whitespace-nowrap text-ellipsis text-right"
|
||||
className="w-1/5 overflow-hidden text-xs lg:text-sm whitespace-nowrap text-ellipsis"
|
||||
title={symbol}
|
||||
data-testid="market-selector-price"
|
||||
role="gridcell"
|
||||
@@ -121,14 +121,14 @@ const MarketData = ({
|
||||
{price} {symbol}
|
||||
</div>
|
||||
<div
|
||||
className="w-2/6 sm:w-1/6 overflow-hidden text-xs lg:text-sm whitespace-nowrap text-ellipsis text-right"
|
||||
className="w-1/5 overflow-hidden text-xs text-right lg:text-sm whitespace-nowrap text-ellipsis"
|
||||
title={t('24h vol')}
|
||||
data-testid="market-selector-volume"
|
||||
role="gridcell"
|
||||
>
|
||||
{volume}
|
||||
</div>
|
||||
<div className="hidden sm:w-1/6 sm:flex justify-end" role="gridcell">
|
||||
<div className="flex justify-end w-1/5" role="gridcell">
|
||||
{oneDayCandles && (
|
||||
<Sparkline
|
||||
width={64}
|
||||
|
||||
@@ -64,7 +64,7 @@ export const MarketSelector = ({
|
||||
setFilter((curr) => ({ ...curr, product }));
|
||||
}}
|
||||
/>
|
||||
<div className="text-sm flex sm:grid grid-cols-[2fr_1fr_1fr] gap-1 ">
|
||||
<div className="text-sm grid grid-cols-[2fr_1fr_1fr] gap-1 ">
|
||||
<div className="flex-1">
|
||||
<TradingInput
|
||||
onChange={(e) =>
|
||||
@@ -182,16 +182,16 @@ const MarketList = ({
|
||||
'p-2 mx-2 border-b border-default text-xs text-secondary'
|
||||
)}
|
||||
>
|
||||
<div className="w-2/6" role="columnheader">
|
||||
<div className="w-2/5" role="columnheader">
|
||||
{t('Name')}
|
||||
</div>
|
||||
<div className="w-2/6 text-right pr-4" role="columnheader">
|
||||
<div className="w-1/5" role="columnheader">
|
||||
{t('Price')}
|
||||
</div>
|
||||
<div className="w-2/6 sm:w-1/6 text-right" role="columnheader">
|
||||
<div className="w-1/5 text-right" role="columnheader">
|
||||
{t('24h volume')}
|
||||
</div>
|
||||
<div className="hidden sm:w-1/6" role="columnheader" />
|
||||
<div className="w-1/5" role="columnheader" />
|
||||
</div>
|
||||
<div ref={listRef}>
|
||||
<List
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useParams } from 'react-router-dom';
|
||||
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
||||
import { useState } from 'react';
|
||||
import { useT } from '../../lib/use-t';
|
||||
import classNames from 'classnames';
|
||||
|
||||
/**
|
||||
* This is only rendered for the mobile navigation
|
||||
@@ -31,16 +30,7 @@ export const NavHeader = () => {
|
||||
trigger={
|
||||
<h1 className="flex gap-1 sm:gap-2 md:gap-4 items-center text-default text-lg whitespace-nowrap xl:pr-4 xl:border-r border-default">
|
||||
{data ? data.tradableInstrument.instrument.code : t('Select market')}
|
||||
<span
|
||||
className={classNames(
|
||||
'transition-transform ease-in-out duration-300',
|
||||
{
|
||||
'rotate-180': open,
|
||||
}
|
||||
)}
|
||||
>
|
||||
<VegaIcon name={VegaIconNames.CHEVRON_DOWN} size={20} />
|
||||
</span>
|
||||
<VegaIcon name={VegaIconNames.CHEVRON_DOWN} size={20} />
|
||||
</h1>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
VegaIconNames,
|
||||
type VegaIconSize,
|
||||
TradingInput,
|
||||
TinyScroll,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { IconNames } from '@blueprintjs/icons';
|
||||
import {
|
||||
@@ -150,45 +149,47 @@ export const ActiveRewards = ({ currentEpoch }: { currentEpoch: number }) => {
|
||||
|
||||
return (
|
||||
<Card title={t('Active rewards')} className="lg:col-span-full">
|
||||
{transfers.length > 1 && (
|
||||
<TradingInput
|
||||
onChange={(e) =>
|
||||
setFilter((curr) => ({ ...curr, searchTerm: e.target.value }))
|
||||
}
|
||||
value={filter.searchTerm}
|
||||
type="text"
|
||||
placeholder={t(
|
||||
'Search by reward dispatch metric, entity scope or asset name'
|
||||
)}
|
||||
data-testid="search-term"
|
||||
className="mb-4 w-20 mr-2"
|
||||
prependElement={<VegaIcon name={VegaIconNames.SEARCH} />}
|
||||
/>
|
||||
)}
|
||||
<TinyScroll className="grid gap-x-8 gap-y-10 h-fit grid-cols-[repeat(auto-fill,_minmax(230px,_1fr))] md:grid-cols-[repeat(auto-fill,_minmax(230px,_1fr))] lg:grid-cols-[repeat(auto-fill,_minmax(320px,_1fr))] xl:grid-cols-[repeat(auto-fill,_minmax(335px,_1fr))] max-h-[40rem] overflow-auto pr-2">
|
||||
{transfers
|
||||
.filter((n) => applyFilter(n, filter))
|
||||
.map((node, i) => {
|
||||
const { transfer } = node;
|
||||
if (
|
||||
transfer.kind.__typename !== 'RecurringTransfer' ||
|
||||
!transfer.kind.dispatchStrategy?.dispatchMetric
|
||||
) {
|
||||
return null;
|
||||
<div className="">
|
||||
{transfers.length > 1 && (
|
||||
<TradingInput
|
||||
onChange={(e) =>
|
||||
setFilter((curr) => ({ ...curr, searchTerm: e.target.value }))
|
||||
}
|
||||
value={filter.searchTerm}
|
||||
type="text"
|
||||
placeholder={t(
|
||||
'Search by reward dispatch metric, entity scope or asset name'
|
||||
)}
|
||||
data-testid="search-term"
|
||||
className="mb-4 w-20"
|
||||
prependElement={<VegaIcon name={VegaIconNames.SEARCH} />}
|
||||
/>
|
||||
)}
|
||||
<div className="grid gap-x-8 gap-y-10 h-fit grid-cols-[repeat(auto-fill,_minmax(230px,_1fr))] md:grid-cols-[repeat(auto-fill,_minmax(230px,_1fr))] lg:grid-cols-[repeat(auto-fill,_minmax(320px,_1fr))] xl:grid-cols-[repeat(auto-fill,_minmax(343px,_1fr))] max-h-[40rem] overflow-auto">
|
||||
{transfers
|
||||
.filter((n) => applyFilter(n, filter))
|
||||
.map((node, i) => {
|
||||
const { transfer } = node;
|
||||
if (
|
||||
transfer.kind.__typename !== 'RecurringTransfer' ||
|
||||
!transfer.kind.dispatchStrategy?.dispatchMetric
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
node && (
|
||||
<ActiveRewardCard
|
||||
key={i}
|
||||
transferNode={node}
|
||||
kind={transfer.kind}
|
||||
currentEpoch={currentEpoch}
|
||||
/>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</TinyScroll>
|
||||
return (
|
||||
node && (
|
||||
<ActiveRewardCard
|
||||
key={i}
|
||||
transferNode={node}
|
||||
kind={transfer.kind}
|
||||
currentEpoch={currentEpoch}
|
||||
/>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import docker
|
||||
import http.server
|
||||
import sys
|
||||
from dotenv import load_dotenv
|
||||
from playwright.sync_api import Error as PlaywrightError
|
||||
|
||||
from docker.models.containers import Container
|
||||
from docker.errors import APIError
|
||||
from contextlib import contextmanager
|
||||
@@ -274,18 +274,3 @@ def perps_market(vega, request):
|
||||
if hasattr(request, "param"):
|
||||
kwargs.update(request.param)
|
||||
return setup_perps_market(vega, **kwargs)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def retry_on_http_error(request):
|
||||
retry_count = 3
|
||||
for i in range(retry_count):
|
||||
try:
|
||||
yield
|
||||
return
|
||||
except requests.exceptions.HTTPError:
|
||||
if i < retry_count - 1:
|
||||
print(f"Retrying due to HTTPError (attempt {i+1}/{retry_count})")
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ def setup_market_monitoring_auction(vega: VegaServiceNull, simple_market):
|
||||
submit_order(vega, MM_WALLET.name, simple_market, "SIDE_SELL", 1, 1 + 0.1 / 2)
|
||||
submit_order(vega, MM_WALLET2.name, simple_market, "SIDE_SELL", 1, 1)
|
||||
|
||||
vega.forward("10s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@@ -74,6 +75,7 @@ def setup_market_monitoring_auction(vega: VegaServiceNull, simple_market):
|
||||
submit_order(vega, MM_WALLET2.name, simple_market, "SIDE_BUY", 100, 95)
|
||||
submit_order(vega, MM_WALLET2.name, simple_market, "SIDE_BUY", 1, 105)
|
||||
|
||||
vega.forward("10s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
|
||||
@@ -107,6 +109,7 @@ def test_market_monitoring_auction_price_volatility_limit_order(
|
||||
page.get_by_test_id("place-order").click()
|
||||
|
||||
wait_for_toast_confirmation(page)
|
||||
vega.forward("10s")
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
page.get_by_test_id("All").click()
|
||||
|
||||
@@ -67,7 +67,6 @@ const defaultColDef = {
|
||||
sortable: true,
|
||||
tooltipComponent: TooltipCellComponent,
|
||||
comparator: accountValuesComparator,
|
||||
minWidth: 150,
|
||||
};
|
||||
export interface GetRowsParams extends Omit<IGetRowsParams, 'successCallback'> {
|
||||
successCallback(rowsThisBlock: AccountFields[], lastRow?: number): void;
|
||||
@@ -140,8 +139,6 @@ export const AccountTable = ({
|
||||
{
|
||||
headerName: t('Asset'),
|
||||
field: 'asset.symbol',
|
||||
pinned: true,
|
||||
minWidth: 75,
|
||||
headerTooltip: t(
|
||||
'Asset is the collateral that is deposited into the Vega protocol.'
|
||||
),
|
||||
@@ -256,8 +253,8 @@ export const AccountTable = ({
|
||||
colId: 'accounts-actions',
|
||||
field: 'asset.id',
|
||||
...COL_DEFS.actions,
|
||||
minWidth: showDepositButton ? 110 : COL_DEFS.actions.minWidth,
|
||||
maxWidth: showDepositButton ? 110 : COL_DEFS.actions.maxWidth,
|
||||
minWidth: showDepositButton ? 105 : COL_DEFS.actions.minWidth,
|
||||
maxWidth: showDepositButton ? 105 : COL_DEFS.actions.maxWidth,
|
||||
cellRenderer: ({
|
||||
value: assetId,
|
||||
node,
|
||||
|
||||
@@ -23,9 +23,7 @@ import { AccountType } from '@vegaprotocol/types';
|
||||
const defaultColDef = {
|
||||
resizable: true,
|
||||
sortable: true,
|
||||
minWidth: 100,
|
||||
};
|
||||
|
||||
interface BreakdownTableProps extends AgGridReactProps {
|
||||
data: AccountFields[] | null;
|
||||
onMarketClick?: (marketId: string, metaKey?: boolean) => void;
|
||||
@@ -34,13 +32,12 @@ interface BreakdownTableProps extends AgGridReactProps {
|
||||
const BreakdownTable = forwardRef<AgGridReact, BreakdownTableProps>(
|
||||
({ data }, ref) => {
|
||||
const t = useT();
|
||||
const colDefs = useMemo(() => {
|
||||
const coldefs = useMemo(() => {
|
||||
const defs: ColDef[] = [
|
||||
{
|
||||
headerName: t('Market'),
|
||||
field: 'market.tradableInstrument.instrument.code',
|
||||
width: 90,
|
||||
pinned: true,
|
||||
minWidth: 200,
|
||||
sort: 'desc',
|
||||
cellRenderer: ({
|
||||
value,
|
||||
@@ -144,7 +141,7 @@ const BreakdownTable = forwardRef<AgGridReact, BreakdownTableProps>(
|
||||
components={{ PriceCell, ProgressBarCell }}
|
||||
tooltipShowDelay={500}
|
||||
defaultColDef={defaultColDef}
|
||||
columnDefs={colDefs}
|
||||
columnDefs={coldefs}
|
||||
domLayout="autoHeight"
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -9,7 +9,4 @@ export const COL_DEFS = {
|
||||
type: 'rightAligned',
|
||||
pinned: 'right' as const,
|
||||
},
|
||||
default: {
|
||||
minWidth: 100,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
isNumeric,
|
||||
} from '@vegaprotocol/utils';
|
||||
import { type ColDef } from 'ag-grid-community';
|
||||
import { AgGrid, COL_DEFS } from '@vegaprotocol/datagrid';
|
||||
import { AgGrid } from '@vegaprotocol/datagrid';
|
||||
import {
|
||||
type VegaICellRendererParams,
|
||||
type VegaValueFormatterParams,
|
||||
@@ -21,7 +21,7 @@ export const DepositsTable = (
|
||||
) => {
|
||||
const columnDefs = useMemo<ColDef[]>(
|
||||
() => [
|
||||
{ headerName: 'Asset', field: 'asset.symbol', pinned: true },
|
||||
{ headerName: 'Asset', field: 'asset.symbol' },
|
||||
{
|
||||
headerName: 'Amount',
|
||||
field: 'amount',
|
||||
@@ -74,11 +74,5 @@ export const DepositsTable = (
|
||||
],
|
||||
[]
|
||||
);
|
||||
return (
|
||||
<AgGrid
|
||||
columnDefs={columnDefs}
|
||||
defaultColDef={COL_DEFS.default}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
return <AgGrid columnDefs={columnDefs} {...props} />;
|
||||
};
|
||||
|
||||
@@ -48,7 +48,6 @@ export const FillsTable = forwardRef<AgGridReact, Props>(
|
||||
field: 'market.tradableInstrument.instrument.code',
|
||||
cellRenderer: 'MarketNameCell',
|
||||
cellRendererParams: { idPath: 'market.id', onMarketClick },
|
||||
pinned: true,
|
||||
},
|
||||
{
|
||||
headerName: t('Size'),
|
||||
@@ -144,7 +143,6 @@ export const FillsTable = forwardRef<AgGridReact, Props>(
|
||||
<AgGrid
|
||||
ref={ref}
|
||||
columnDefs={columnDefs}
|
||||
defaultColDef={COL_DEFS.default}
|
||||
overlayNoRowsTemplate={t('No fills')}
|
||||
getRowId={({ data }) => data?.id}
|
||||
tooltipShowDelay={0}
|
||||
|
||||
@@ -39,7 +39,6 @@ const defaultColDef = {
|
||||
resizable: true,
|
||||
sortable: true,
|
||||
filterParams: { buttons: ['reset'] },
|
||||
minWidth: 100,
|
||||
};
|
||||
|
||||
export type OrderListTableProps = TypedDataAgGrid<Order> & {
|
||||
@@ -83,9 +82,6 @@ export const OrderListTable = memo<
|
||||
field: 'market.tradableInstrument.instrument.code',
|
||||
cellRenderer: 'MarketNameCell',
|
||||
cellRendererParams: { idPath: 'market.id', onMarketClick },
|
||||
pinned: true,
|
||||
width: 130,
|
||||
resizable: true,
|
||||
},
|
||||
{
|
||||
headerName: t('Filled'),
|
||||
|
||||
@@ -40,7 +40,6 @@ const defaultColDef = {
|
||||
resizable: true,
|
||||
sortable: true,
|
||||
filterParams: { buttons: ['reset'] },
|
||||
minWidth: 100,
|
||||
};
|
||||
|
||||
export type StopOrdersTableProps = TypedDataAgGrid<StopOrder> & {
|
||||
@@ -62,7 +61,6 @@ export const StopOrdersTable = memo(
|
||||
field: 'market.tradableInstrument.instrument.code',
|
||||
cellRenderer: 'MarketNameCell',
|
||||
cellRendererParams: { idPath: 'market.id', onMarketClick },
|
||||
pinned: true,
|
||||
},
|
||||
{
|
||||
headerName: t('Trigger'),
|
||||
|
||||
@@ -71,7 +71,6 @@ const defaultColDef = {
|
||||
filterParams: { buttons: ['reset'] },
|
||||
tooltipComponent: TooltipCellComponent,
|
||||
resizable: true,
|
||||
minWidth: 110,
|
||||
};
|
||||
|
||||
export const PositionsTable = ({
|
||||
@@ -84,330 +83,6 @@ export const PositionsTable = ({
|
||||
...props
|
||||
}: Props) => {
|
||||
const t = useT();
|
||||
|
||||
const colDefs = useMemo<ColDef[]>(() => {
|
||||
const columnDefs: (ColDef | null)[] = [
|
||||
multipleKeys
|
||||
? {
|
||||
headerName: t('Vega key'),
|
||||
field: 'partyId',
|
||||
valueGetter: ({ data }: VegaValueGetterParams<Position>) =>
|
||||
(data?.partyId &&
|
||||
pubKeys &&
|
||||
pubKeys.find((key) => key.publicKey === data.partyId)?.name) ||
|
||||
data?.partyId,
|
||||
}
|
||||
: null,
|
||||
{
|
||||
headerName: t('Market'),
|
||||
field: 'marketCode',
|
||||
resizable: true,
|
||||
onCellClicked: ({ data }) => {
|
||||
if (!onMarketClick) return;
|
||||
onMarketClick(data.marketId);
|
||||
},
|
||||
pinned: true,
|
||||
cellRenderer: ({
|
||||
value,
|
||||
data,
|
||||
}: VegaICellRendererParams<Position, 'marketCode'>) => {
|
||||
if (!data || !value) return '-';
|
||||
return (
|
||||
<StackedCell
|
||||
primary={value}
|
||||
secondary={
|
||||
<>
|
||||
{data?.assetSymbol}
|
||||
<MarketProductPill productType={data.productType} />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
headerName: t('Size / Notional'),
|
||||
field: 'openVolume',
|
||||
type: 'rightAligned',
|
||||
cellClass: 'font-mono text-right',
|
||||
cellClassRules: signedNumberCssClassRules,
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: ({ data }: { data: Position }) => {
|
||||
return data?.openVolume === undefined
|
||||
? undefined
|
||||
: toBigNum(data?.openVolume, data.positionDecimalPlaces).toNumber();
|
||||
},
|
||||
valueFormatter: ({
|
||||
data,
|
||||
}: VegaValueFormatterParams<Position, 'openVolume'>): string => {
|
||||
if (!data?.openVolume) return '-';
|
||||
|
||||
const vol = volumePrefix(
|
||||
addDecimalsFormatNumber(data.openVolume, data.positionDecimalPlaces)
|
||||
);
|
||||
|
||||
return vol;
|
||||
},
|
||||
cellRenderer: OpenVolumeCell,
|
||||
},
|
||||
{
|
||||
headerName: t('Entry / Mark'),
|
||||
field: 'markPrice',
|
||||
type: 'rightAligned',
|
||||
cellClass: 'font-mono text-right',
|
||||
cellRenderer: ({
|
||||
data,
|
||||
}: VegaICellRendererParams<Position, 'markPrice'>) => {
|
||||
if (
|
||||
!data?.averageEntryPrice ||
|
||||
!data?.markPrice ||
|
||||
!data?.marketDecimalPlaces
|
||||
) {
|
||||
return <>-</>;
|
||||
}
|
||||
|
||||
if (
|
||||
data.marketTradingMode ===
|
||||
MarketTradingMode.TRADING_MODE_OPENING_AUCTION
|
||||
) {
|
||||
return <>-</>;
|
||||
}
|
||||
|
||||
const entry = addDecimalsFormatNumber(
|
||||
data.averageEntryPrice,
|
||||
data.marketDecimalPlaces
|
||||
);
|
||||
const mark = addDecimalsFormatNumber(
|
||||
data.markPrice,
|
||||
data.marketDecimalPlaces
|
||||
);
|
||||
return (
|
||||
<StackedCell
|
||||
primary={entry}
|
||||
secondary={
|
||||
<PriceFlashCell
|
||||
value={Number(data.markPrice)}
|
||||
valueFormatted={mark}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: ({ data }: VegaValueGetterParams<Position>) => {
|
||||
return !data ||
|
||||
!data.markPrice ||
|
||||
data.marketTradingMode ===
|
||||
MarketTradingMode.TRADING_MODE_OPENING_AUCTION
|
||||
? undefined
|
||||
: toBigNum(data.markPrice, data.marketDecimalPlaces).toNumber();
|
||||
},
|
||||
},
|
||||
{
|
||||
headerName: t('Margin / Leverage'),
|
||||
colId: 'margin',
|
||||
type: 'rightAligned',
|
||||
cellClass: 'font-mono text-right',
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: ({ data }: VegaValueGetterParams<Position>) => {
|
||||
return !data
|
||||
? undefined
|
||||
: toBigNum(
|
||||
data.marginAccountBalance,
|
||||
data.assetDecimals
|
||||
).toNumber();
|
||||
},
|
||||
cellRenderer: ({ data }: VegaICellRendererParams<Position>) => {
|
||||
if (
|
||||
!data ||
|
||||
!data.marginAccountBalance ||
|
||||
!data.marketDecimalPlaces
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
const margin = addDecimalsFormatNumberQuantum(
|
||||
data.marginAccountBalance,
|
||||
data.assetDecimals,
|
||||
data.quantum
|
||||
);
|
||||
|
||||
const lev = data?.currentLeverage ? data.currentLeverage : 1;
|
||||
const leverage = formatNumber(Math.max(1, lev), 1);
|
||||
return <StackedCell primary={margin} secondary={leverage + 'x'} />;
|
||||
},
|
||||
},
|
||||
{
|
||||
colId: 'liquidationPrice',
|
||||
headerName: 'Liquidation',
|
||||
headerTooltip: t('Worst case liquidation price'),
|
||||
cellClass: 'font-mono text-right',
|
||||
type: 'rightAligned',
|
||||
// Cannot be sortable as data is fetched within the cell
|
||||
sortable: false,
|
||||
filter: false,
|
||||
cellRenderer: ({ data }: VegaICellRendererParams<Position>) => {
|
||||
if (!data) {
|
||||
return '-';
|
||||
}
|
||||
return (
|
||||
<div className="flex h-[45px] items-center">
|
||||
<LiquidationPrice
|
||||
className="block text-right grow"
|
||||
marketId={data.marketId}
|
||||
openVolume={data.openVolume}
|
||||
collateralAvailable={data.totalBalance}
|
||||
decimalPlaces={data.marketDecimalPlaces}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
headerName: t('Realised PNL'),
|
||||
field: 'realisedPNL',
|
||||
type: 'rightAligned',
|
||||
cellClassRules: signedNumberCssClassRules,
|
||||
cellClass: 'font-mono text-right',
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: realisedPNLValueGetter,
|
||||
cellRenderer: (
|
||||
args: VegaICellRendererParams<Position, 'realisedPNL'>
|
||||
) => {
|
||||
const LOSS_SOCIALIZATION_LINK = DocsLinks?.LOSS_SOCIALIZATION ?? '';
|
||||
|
||||
if (!args.data || args.value === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const losses = parseInt(args.data?.lossSocializationAmount ?? '0');
|
||||
|
||||
if (losses <= 0) {
|
||||
// eslint-disable-next-line react/jsx-no-useless-fragment
|
||||
return (
|
||||
<Tooltip description={args.valueFormatted} align="end">
|
||||
<div>
|
||||
<PNLCell {...args} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
const lossesFormatted = addDecimalsFormatNumber(
|
||||
args.data.lossSocializationAmount,
|
||||
args.data.assetDecimals
|
||||
);
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
align="end"
|
||||
description={
|
||||
<>
|
||||
<p className="mb-2">
|
||||
{t('Realised PNL: {{value}}', {
|
||||
nsSeparator: '*',
|
||||
replace: { value: args.value },
|
||||
})}
|
||||
</p>
|
||||
<p className="mb-2">
|
||||
{t('Lifetime loss socialisation deductions: {{losses}}', {
|
||||
nsSeparator: '*',
|
||||
replace: {
|
||||
losses: lossesFormatted,
|
||||
},
|
||||
})}
|
||||
</p>
|
||||
<p className="mb-2">
|
||||
{t(
|
||||
`You received less {{assetSymbol}} in gains that you should have when the market moved in your favour. This occurred because one or more other trader(s) were closed out and did not have enough funds to cover their losses, and the market's insurance pool was empty.`,
|
||||
{ assetSymbol: args.data.assetSymbol }
|
||||
)}
|
||||
</p>
|
||||
{LOSS_SOCIALIZATION_LINK && (
|
||||
<ExternalLink href={LOSS_SOCIALIZATION_LINK}>
|
||||
{t('Read more about loss socialisation')}
|
||||
</ExternalLink>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div>
|
||||
<PNLCell {...args} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
valueFormatter: ({
|
||||
data,
|
||||
}: VegaValueFormatterParams<Position, 'realisedPNL'>) => {
|
||||
return !data
|
||||
? ''
|
||||
: addDecimalsFormatNumberQuantum(
|
||||
data.realisedPNL,
|
||||
data.assetDecimals,
|
||||
data.quantum
|
||||
);
|
||||
},
|
||||
headerTooltip: t(
|
||||
'Profit or loss is realised whenever your position is reduced to zero and the margin is released back to your collateral balance. P&L excludes any fees paid.'
|
||||
),
|
||||
},
|
||||
{
|
||||
headerName: t('Unrealised PNL'),
|
||||
field: 'unrealisedPNL',
|
||||
type: 'rightAligned',
|
||||
cellClassRules: signedNumberCssClassRules,
|
||||
cellClass: 'font-mono text-right',
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: unrealisedPNLValueGetter,
|
||||
// @ts-ignore no type overlap but function can be identical
|
||||
tooltipValueGetter: unrealisedPNLValueGetter,
|
||||
valueFormatter: ({
|
||||
data,
|
||||
}: VegaValueFormatterParams<Position, 'unrealisedPNL'>) =>
|
||||
!data
|
||||
? ''
|
||||
: addDecimalsFormatNumberQuantum(
|
||||
data.unrealisedPNL,
|
||||
data.assetDecimals,
|
||||
data.quantum
|
||||
),
|
||||
headerTooltip: t(
|
||||
'Unrealised profit is the current profit on your open position. Margin is still allocated to your position.'
|
||||
),
|
||||
},
|
||||
onClose && !isReadOnly
|
||||
? {
|
||||
...COL_DEFS.actions,
|
||||
cellRenderer: ({ data }: VegaICellRendererParams<Position>) => {
|
||||
return (
|
||||
<div className="flex items-center justify-end gap-2">
|
||||
{data?.openVolume &&
|
||||
data?.openVolume !== '0' &&
|
||||
data.partyId === pubKey ? (
|
||||
<ButtonLink
|
||||
data-testid="close-position"
|
||||
onClick={() => data && onClose(data)}
|
||||
title={t('Close position')}
|
||||
>
|
||||
<VegaIcon name={VegaIconNames.CROSS} size={16} />
|
||||
</ButtonLink>
|
||||
) : null}
|
||||
{data?.assetId && (
|
||||
<PositionActionsDropdown assetId={data?.assetId} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
minWidth: 55,
|
||||
maxWidth: 55,
|
||||
}
|
||||
: null,
|
||||
];
|
||||
return columnDefs.filter<ColDef>(
|
||||
(colDef: ColDef | null): colDef is ColDef => colDef !== null
|
||||
);
|
||||
}, [isReadOnly, multipleKeys, onClose, onMarketClick, pubKey, pubKeys, t]);
|
||||
|
||||
return (
|
||||
<AgGrid
|
||||
overlayNoRowsTemplate={t('No positions')}
|
||||
@@ -420,7 +95,349 @@ export const PositionsTable = ({
|
||||
MarketNameCell,
|
||||
}}
|
||||
rowHeight={45}
|
||||
columnDefs={colDefs}
|
||||
columnDefs={useMemo<ColDef[]>(() => {
|
||||
const columnDefs: (ColDef | null)[] = [
|
||||
multipleKeys
|
||||
? {
|
||||
headerName: t('Vega key'),
|
||||
field: 'partyId',
|
||||
valueGetter: ({ data }: VegaValueGetterParams<Position>) =>
|
||||
(data?.partyId &&
|
||||
pubKeys &&
|
||||
pubKeys.find((key) => key.publicKey === data.partyId)
|
||||
?.name) ||
|
||||
data?.partyId,
|
||||
}
|
||||
: null,
|
||||
{
|
||||
headerName: t('Market'),
|
||||
field: 'marketCode',
|
||||
onCellClicked: ({ data }) => {
|
||||
if (!onMarketClick) return;
|
||||
onMarketClick(data.marketId);
|
||||
},
|
||||
cellRenderer: ({
|
||||
value,
|
||||
data,
|
||||
}: VegaICellRendererParams<Position, 'marketCode'>) => {
|
||||
if (!data || !value) return '-';
|
||||
return (
|
||||
<StackedCell
|
||||
primary={value}
|
||||
secondary={
|
||||
<>
|
||||
{data?.assetSymbol}
|
||||
<MarketProductPill productType={data.productType} />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
headerName: t('Size / Notional'),
|
||||
field: 'openVolume',
|
||||
type: 'rightAligned',
|
||||
cellClass: 'font-mono text-right',
|
||||
cellClassRules: signedNumberCssClassRules,
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: ({ data }: { data: Position }) => {
|
||||
return data?.openVolume === undefined
|
||||
? undefined
|
||||
: toBigNum(
|
||||
data?.openVolume,
|
||||
data.positionDecimalPlaces
|
||||
).toNumber();
|
||||
},
|
||||
valueFormatter: ({
|
||||
data,
|
||||
}: VegaValueFormatterParams<Position, 'openVolume'>): string => {
|
||||
if (!data?.openVolume) return '-';
|
||||
|
||||
const vol = volumePrefix(
|
||||
addDecimalsFormatNumber(
|
||||
data.openVolume,
|
||||
data.positionDecimalPlaces
|
||||
)
|
||||
);
|
||||
|
||||
return vol;
|
||||
},
|
||||
cellRenderer: OpenVolumeCell,
|
||||
},
|
||||
{
|
||||
headerName: t('Entry / Mark'),
|
||||
field: 'markPrice',
|
||||
type: 'rightAligned',
|
||||
cellClass: 'font-mono text-right',
|
||||
cellRenderer: ({
|
||||
data,
|
||||
}: VegaICellRendererParams<Position, 'markPrice'>) => {
|
||||
if (
|
||||
!data?.averageEntryPrice ||
|
||||
!data?.markPrice ||
|
||||
!data?.marketDecimalPlaces
|
||||
) {
|
||||
return <>-</>;
|
||||
}
|
||||
|
||||
if (
|
||||
data.marketTradingMode ===
|
||||
MarketTradingMode.TRADING_MODE_OPENING_AUCTION
|
||||
) {
|
||||
return <>-</>;
|
||||
}
|
||||
|
||||
const entry = addDecimalsFormatNumber(
|
||||
data.averageEntryPrice,
|
||||
data.marketDecimalPlaces
|
||||
);
|
||||
const mark = addDecimalsFormatNumber(
|
||||
data.markPrice,
|
||||
data.marketDecimalPlaces
|
||||
);
|
||||
return (
|
||||
<StackedCell
|
||||
primary={entry}
|
||||
secondary={
|
||||
<PriceFlashCell
|
||||
value={Number(data.markPrice)}
|
||||
valueFormatted={mark}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: ({ data }: VegaValueGetterParams<Position>) => {
|
||||
return !data ||
|
||||
!data.markPrice ||
|
||||
data.marketTradingMode ===
|
||||
MarketTradingMode.TRADING_MODE_OPENING_AUCTION
|
||||
? undefined
|
||||
: toBigNum(data.markPrice, data.marketDecimalPlaces).toNumber();
|
||||
},
|
||||
},
|
||||
{
|
||||
headerName: t('Margin / Leverage'),
|
||||
colId: 'margin',
|
||||
type: 'rightAligned',
|
||||
cellClass: 'font-mono text-right',
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: ({ data }: VegaValueGetterParams<Position>) => {
|
||||
return !data
|
||||
? undefined
|
||||
: toBigNum(
|
||||
data.marginAccountBalance,
|
||||
data.assetDecimals
|
||||
).toNumber();
|
||||
},
|
||||
cellRenderer: ({ data }: VegaICellRendererParams<Position>) => {
|
||||
if (
|
||||
!data ||
|
||||
!data.marginAccountBalance ||
|
||||
!data.marketDecimalPlaces
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
const margin = addDecimalsFormatNumberQuantum(
|
||||
data.marginAccountBalance,
|
||||
data.assetDecimals,
|
||||
data.quantum
|
||||
);
|
||||
|
||||
const lev = data?.currentLeverage ? data.currentLeverage : 1;
|
||||
const leverage = formatNumber(Math.max(1, lev), 1);
|
||||
return (
|
||||
<StackedCell primary={margin} secondary={leverage + 'x'} />
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
colId: 'liquidationPrice',
|
||||
headerName: 'Liquidation',
|
||||
headerTooltip: t('Worst case liquidation price'),
|
||||
cellClass: 'font-mono text-right',
|
||||
type: 'rightAligned',
|
||||
// Cannot be sortable as data is fetched within the cell
|
||||
sortable: false,
|
||||
filter: false,
|
||||
cellRenderer: ({ data }: VegaICellRendererParams<Position>) => {
|
||||
if (!data) {
|
||||
return '-';
|
||||
}
|
||||
return (
|
||||
<div className="flex h-[45px] items-center">
|
||||
<LiquidationPrice
|
||||
className="block text-right grow"
|
||||
marketId={data.marketId}
|
||||
openVolume={data.openVolume}
|
||||
collateralAvailable={data.totalBalance}
|
||||
decimalPlaces={data.marketDecimalPlaces}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
headerName: t('Realised PNL'),
|
||||
field: 'realisedPNL',
|
||||
type: 'rightAligned',
|
||||
cellClassRules: signedNumberCssClassRules,
|
||||
cellClass: 'font-mono text-right',
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: realisedPNLValueGetter,
|
||||
cellRenderer: (
|
||||
args: VegaICellRendererParams<Position, 'realisedPNL'>
|
||||
) => {
|
||||
const LOSS_SOCIALIZATION_LINK =
|
||||
DocsLinks?.LOSS_SOCIALIZATION ?? '';
|
||||
|
||||
if (!args.data || args.value === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const losses = parseInt(
|
||||
args.data?.lossSocializationAmount ?? '0'
|
||||
);
|
||||
|
||||
if (losses <= 0) {
|
||||
// eslint-disable-next-line react/jsx-no-useless-fragment
|
||||
return (
|
||||
<Tooltip description={args.valueFormatted} align="end">
|
||||
<div>
|
||||
<PNLCell {...args} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
const lossesFormatted = addDecimalsFormatNumber(
|
||||
args.data.lossSocializationAmount,
|
||||
args.data.assetDecimals
|
||||
);
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
align="end"
|
||||
description={
|
||||
<>
|
||||
<p className="mb-2">
|
||||
{t('Realised PNL: {{value}}', {
|
||||
nsSeparator: '*',
|
||||
replace: { value: args.value },
|
||||
})}
|
||||
</p>
|
||||
<p className="mb-2">
|
||||
{t(
|
||||
'Lifetime loss socialisation deductions: {{losses}}',
|
||||
{
|
||||
nsSeparator: '*',
|
||||
replace: {
|
||||
losses: lossesFormatted,
|
||||
},
|
||||
}
|
||||
)}
|
||||
</p>
|
||||
<p className="mb-2">
|
||||
{t(
|
||||
`You received less {{assetSymbol}} in gains that you should have when the market moved in your favour. This occurred because one or more other trader(s) were closed out and did not have enough funds to cover their losses, and the market's insurance pool was empty.`,
|
||||
{ assetSymbol: args.data.assetSymbol }
|
||||
)}
|
||||
</p>
|
||||
{LOSS_SOCIALIZATION_LINK && (
|
||||
<ExternalLink href={LOSS_SOCIALIZATION_LINK}>
|
||||
{t('Read more about loss socialisation')}
|
||||
</ExternalLink>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div>
|
||||
<PNLCell {...args} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
valueFormatter: ({
|
||||
data,
|
||||
}: VegaValueFormatterParams<Position, 'realisedPNL'>) => {
|
||||
return !data
|
||||
? ''
|
||||
: addDecimalsFormatNumberQuantum(
|
||||
data.realisedPNL,
|
||||
data.assetDecimals,
|
||||
data.quantum
|
||||
);
|
||||
},
|
||||
headerTooltip: t(
|
||||
'Profit or loss is realised whenever your position is reduced to zero and the margin is released back to your collateral balance. P&L excludes any fees paid.'
|
||||
),
|
||||
},
|
||||
{
|
||||
headerName: t('Unrealised PNL'),
|
||||
field: 'unrealisedPNL',
|
||||
type: 'rightAligned',
|
||||
cellClassRules: signedNumberCssClassRules,
|
||||
cellClass: 'font-mono text-right',
|
||||
filter: 'agNumberColumnFilter',
|
||||
valueGetter: unrealisedPNLValueGetter,
|
||||
// @ts-ignore no type overlap but function can be identical
|
||||
tooltipValueGetter: unrealisedPNLValueGetter,
|
||||
valueFormatter: ({
|
||||
data,
|
||||
}: VegaValueFormatterParams<Position, 'unrealisedPNL'>) =>
|
||||
!data
|
||||
? ''
|
||||
: addDecimalsFormatNumberQuantum(
|
||||
data.unrealisedPNL,
|
||||
data.assetDecimals,
|
||||
data.quantum
|
||||
),
|
||||
headerTooltip: t(
|
||||
'Unrealised profit is the current profit on your open position. Margin is still allocated to your position.'
|
||||
),
|
||||
},
|
||||
onClose && !isReadOnly
|
||||
? {
|
||||
...COL_DEFS.actions,
|
||||
cellRenderer: ({ data }: VegaICellRendererParams<Position>) => {
|
||||
return (
|
||||
<div className="flex items-center justify-end gap-2">
|
||||
{data?.openVolume &&
|
||||
data?.openVolume !== '0' &&
|
||||
data.partyId === pubKey ? (
|
||||
<ButtonLink
|
||||
data-testid="close-position"
|
||||
onClick={() => data && onClose(data)}
|
||||
title={t('Close position')}
|
||||
>
|
||||
<VegaIcon name={VegaIconNames.CROSS} size={16} />
|
||||
</ButtonLink>
|
||||
) : null}
|
||||
{data?.assetId && (
|
||||
<PositionActionsDropdown assetId={data?.assetId} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
minWidth: 55,
|
||||
maxWidth: 55,
|
||||
}
|
||||
: null,
|
||||
];
|
||||
return columnDefs.filter<ColDef>(
|
||||
(colDef: ColDef | null): colDef is ColDef => colDef !== null
|
||||
);
|
||||
}, [
|
||||
isReadOnly,
|
||||
multipleKeys,
|
||||
onClose,
|
||||
onMarketClick,
|
||||
pubKey,
|
||||
pubKeys,
|
||||
t,
|
||||
])}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -29,7 +29,6 @@ export const useColumnDefs = () => {
|
||||
colId: 'market',
|
||||
headerName: t('Market'),
|
||||
field: 'terms.change.instrument.code',
|
||||
pinned: true,
|
||||
cellStyle: { lineHeight: '14px' },
|
||||
cellRenderer: ({
|
||||
value,
|
||||
|
||||
@@ -85,21 +85,19 @@ export function Dialog({
|
||||
<VegaIcon name={VegaIconNames.CROSS} size={24} />
|
||||
</DialogPrimitives.Close>
|
||||
)}
|
||||
<div data-testid="dialog-content" className="flex-1 max-w-full">
|
||||
{title && (
|
||||
<span
|
||||
className="text-xl uppercase flex gap-4"
|
||||
data-testid="dialog-title"
|
||||
>
|
||||
{icon && (
|
||||
<span className="fill-current flex items-center">
|
||||
{icon}
|
||||
</span>
|
||||
)}
|
||||
{title}
|
||||
</span>
|
||||
)}
|
||||
<div>{children}</div>
|
||||
<div className="flex gap-4 max-w-full">
|
||||
{icon && <div className="fill-current">{icon}</div>}
|
||||
<div data-testid="dialog-content" className="flex-1 max-w-full">
|
||||
{title && (
|
||||
<h1
|
||||
className="text-xl uppercase mb-4 pr-2"
|
||||
data-testid="dialog-title"
|
||||
>
|
||||
{title}
|
||||
</h1>
|
||||
)}
|
||||
<div>{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,16 +5,15 @@ import { ToastPosition, useToastsConfiguration, useToasts } from './use-toasts';
|
||||
import { useCallback } from 'react';
|
||||
import { Intent } from '../../utils/intent';
|
||||
import { useT } from '../../use-t';
|
||||
import { useScreenDimensions } from '@vegaprotocol/react-helpers';
|
||||
|
||||
export const ToastPositionSetter = () => {
|
||||
const t = useT();
|
||||
const setPosition = useToastsConfiguration((store) => store.setPosition);
|
||||
const setPostion = useToastsConfiguration((store) => store.setPosition);
|
||||
const position = useToastsConfiguration((store) => store.position);
|
||||
const setToast = useToasts((store) => store.setToast);
|
||||
const handleChange = useCallback(
|
||||
(position: ToastPosition) => {
|
||||
setPosition(position);
|
||||
setPostion(position);
|
||||
setToast({
|
||||
id: 'test-toast',
|
||||
intent: Intent.Primary,
|
||||
@@ -22,49 +21,11 @@ export const ToastPositionSetter = () => {
|
||||
onClose: () => useToasts.getState().remove('test-toast'),
|
||||
});
|
||||
},
|
||||
[setToast, setPosition, t]
|
||||
[setToast, setPostion, t]
|
||||
);
|
||||
const buttonCssClasses =
|
||||
'flex items-center px-1 py-1 relative rounded bg-vega-clight-400 dark:bg-vega-cdark-400';
|
||||
const activeIcon = 'fill-vega-clight-900 dark:fill-vega-cdark-900';
|
||||
|
||||
const { screenSize } = useScreenDimensions();
|
||||
|
||||
const isMobileScreen = screenSize === 'xs';
|
||||
|
||||
if (isMobileScreen) {
|
||||
return (
|
||||
<div className="flex justify-between">
|
||||
<div className={classNames('grid grid-cols-1 grid-rows-2 gap-1')}>
|
||||
<button
|
||||
className={buttonCssClasses}
|
||||
onClick={() => handleChange(ToastPosition.TopCenter)}
|
||||
>
|
||||
<Icon
|
||||
className={classNames(
|
||||
position === ToastPosition.TopCenter && activeIcon
|
||||
)}
|
||||
size={3}
|
||||
name={IconNames.ARROW_UP}
|
||||
/>
|
||||
</button>
|
||||
<button
|
||||
className={buttonCssClasses}
|
||||
onClick={() => handleChange(ToastPosition.BottomCenter)}
|
||||
>
|
||||
<Icon
|
||||
className={classNames(
|
||||
position === ToastPosition.BottomCenter && activeIcon
|
||||
)}
|
||||
size={3}
|
||||
name={IconNames.ARROW_DOWN}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex justify-between">
|
||||
<div className={classNames('grid grid-cols-3 grid-rows-2 gap-1')}>
|
||||
|
||||
@@ -92,7 +92,7 @@ export const ToastsContainer = ({
|
||||
className={classNames(
|
||||
'absolute right-0 top-[-38px] z-20 w-full',
|
||||
'transition-opacity',
|
||||
'sm:opacity-0 sm:hover:!opacity-100 sm:group-hover:opacity-50',
|
||||
'opacity-0 hover:!opacity-100 group-hover:opacity-50',
|
||||
{
|
||||
hidden: validToasts.length === 0,
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export class ViewConnector implements VegaConnector {
|
||||
});
|
||||
return Promise.resolve([
|
||||
{
|
||||
name: 'View only',
|
||||
name: 'View only pubkey',
|
||||
publicKey: this.pubkey,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
VegaIconNames,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import {
|
||||
COL_DEFS,
|
||||
type TypedDataAgGrid,
|
||||
type VegaICellRendererParams,
|
||||
type VegaValueFormatterParams,
|
||||
@@ -47,7 +46,7 @@ export const WithdrawalsTable = ({
|
||||
|
||||
const columnDefs = useMemo<ColDef[]>(
|
||||
() => [
|
||||
{ headerName: t('Asset'), field: 'asset.symbol', pinned: true },
|
||||
{ headerName: t('Asset'), field: 'asset.symbol' },
|
||||
{
|
||||
headerName: t('Amount'),
|
||||
field: 'amount',
|
||||
@@ -136,7 +135,6 @@ export const WithdrawalsTable = ({
|
||||
<AgGrid
|
||||
overlayNoRowsTemplate={t('No withdrawals')}
|
||||
columnDefs={columnDefs}
|
||||
defaultColDef={COL_DEFS.default}
|
||||
components={{
|
||||
RecipientCell,
|
||||
StatusCell,
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
"@radix-ui/react-slider": "^1.1.0",
|
||||
"@radix-ui/react-switch": "^1.0.2",
|
||||
"@radix-ui/react-tabs": "^1.0.2",
|
||||
"@radix-ui/react-tooltip": "^1.0.7",
|
||||
"@radix-ui/react-tooltip": "^1.0.3",
|
||||
"@sentry/nextjs": "^6.19.3",
|
||||
"@sentry/react": "^6.19.2",
|
||||
"@sentry/tracing": "^6.19.2",
|
||||
|
||||
@@ -4864,7 +4864,7 @@
|
||||
"@radix-ui/react-separator" "1.0.3"
|
||||
"@radix-ui/react-toggle-group" "1.0.4"
|
||||
|
||||
"@radix-ui/react-tooltip@^1.0.7":
|
||||
"@radix-ui/react-tooltip@^1.0.3":
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@radix-ui/react-tooltip/-/react-tooltip-1.0.7.tgz#8f55070f852e7e7450cc1d9210b793d2e5a7686e"
|
||||
integrity sha512-lPh5iKNFVQ/jav/j6ZrWq3blfDJ0OH9R6FlNUHPMqdLuQ9vwDgFsRxvl8b7Asuy5c8xmoojHUxKHQSOAvMHxyw==
|
||||
|
||||
Reference in New Issue
Block a user