From 7ba90904d88fa32318f3177c42edcb64cdf49f4c Mon Sep 17 00:00:00 2001 From: Ciaran McGhie Date: Thu, 1 Dec 2022 15:59:24 +0000 Subject: [PATCH] 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. --- .../dashboard/market-list/market-list.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx index 099193ef7..9a3321856 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx @@ -1,5 +1,4 @@ import { useCallback, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; import { AgGridColumn } from 'ag-grid-react'; import type { ValueFormatterParams, @@ -26,6 +25,7 @@ import { displayChange, } from '@vegaprotocol/liquidity'; import type { Schema } from '@vegaprotocol/types'; +import { DApp, useLinks } from '@vegaprotocol/environment'; import { HealthBar } from '../../health-bar'; import { Grid } from '../../grid'; @@ -35,7 +35,7 @@ import { Status } from '../../status'; export const MarketList = () => { const { data, error, loading } = useMarketsLiquidity(); const [isHealthDialogOpen, setIsHealthDialogOpen] = useState(false); - const navigate = useNavigate(); + const consoleLink = useLinks(DApp.Console); const getRowId = useCallback(({ data }: GetRowIdParams) => data.id, []); @@ -50,7 +50,11 @@ export const MarketList = () => { { - navigate(`/markets/${data.id}`); + window.open( + liquidityDetailsConsoleLink(data.id, consoleLink), + '_blank', + 'noopener,noreferrer' + ); }, }} rowData={localData} @@ -223,3 +227,8 @@ export const MarketList = () => { ); }; + +const liquidityDetailsConsoleLink = ( + marketId: string, + consoleLink: (url: string | undefined) => string +) => consoleLink(`/#/liquidity/${marketId}`);