feat: use Console for liquidity details for a market (#2225)
Replace our LP details page with a link to Console, which has up to date details for each market.
This commit is contained in:
parent
3e75d64e0d
commit
7ba90904d8
@ -1,5 +1,4 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
import { AgGridColumn } from 'ag-grid-react';
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
import type {
|
import type {
|
||||||
ValueFormatterParams,
|
ValueFormatterParams,
|
||||||
@ -26,6 +25,7 @@ import {
|
|||||||
displayChange,
|
displayChange,
|
||||||
} from '@vegaprotocol/liquidity';
|
} from '@vegaprotocol/liquidity';
|
||||||
import type { Schema } from '@vegaprotocol/types';
|
import type { Schema } from '@vegaprotocol/types';
|
||||||
|
import { DApp, useLinks } from '@vegaprotocol/environment';
|
||||||
|
|
||||||
import { HealthBar } from '../../health-bar';
|
import { HealthBar } from '../../health-bar';
|
||||||
import { Grid } from '../../grid';
|
import { Grid } from '../../grid';
|
||||||
@ -35,7 +35,7 @@ import { Status } from '../../status';
|
|||||||
export const MarketList = () => {
|
export const MarketList = () => {
|
||||||
const { data, error, loading } = useMarketsLiquidity();
|
const { data, error, loading } = useMarketsLiquidity();
|
||||||
const [isHealthDialogOpen, setIsHealthDialogOpen] = useState(false);
|
const [isHealthDialogOpen, setIsHealthDialogOpen] = useState(false);
|
||||||
const navigate = useNavigate();
|
const consoleLink = useLinks(DApp.Console);
|
||||||
|
|
||||||
const getRowId = useCallback(({ data }: GetRowIdParams) => data.id, []);
|
const getRowId = useCallback(({ data }: GetRowIdParams) => data.id, []);
|
||||||
|
|
||||||
@ -50,7 +50,11 @@ export const MarketList = () => {
|
|||||||
<Grid
|
<Grid
|
||||||
gridOptions={{
|
gridOptions={{
|
||||||
onRowClicked: ({ data }: RowClickedEvent) => {
|
onRowClicked: ({ data }: RowClickedEvent) => {
|
||||||
navigate(`/markets/${data.id}`);
|
window.open(
|
||||||
|
liquidityDetailsConsoleLink(data.id, consoleLink),
|
||||||
|
'_blank',
|
||||||
|
'noopener,noreferrer'
|
||||||
|
);
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
rowData={localData}
|
rowData={localData}
|
||||||
@ -223,3 +227,8 @@ export const MarketList = () => {
|
|||||||
</AsyncRenderer>
|
</AsyncRenderer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const liquidityDetailsConsoleLink = (
|
||||||
|
marketId: string,
|
||||||
|
consoleLink: (url: string | undefined) => string
|
||||||
|
) => consoleLink(`/#/liquidity/${marketId}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user