fix(trading): add liquidity provision docs (#3403)

This commit is contained in:
m.ray 2023-04-07 13:00:57 -04:00 committed by GitHub
parent bafd3c384c
commit 363ca9c6e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import {
import { tooltipMapping } from '@vegaprotocol/market-info'; import { tooltipMapping } from '@vegaprotocol/market-info';
import { import {
addDecimalsFormatNumber, addDecimalsFormatNumber,
createDocsLinks,
formatNumberPercentage, formatNumberPercentage,
} from '@vegaprotocol/utils'; } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n'; import { t } from '@vegaprotocol/i18n';
@ -23,6 +24,7 @@ import {
Tabs, Tabs,
Link as UiToolkitLink, Link as UiToolkitLink,
Indicator, Indicator,
ExternalLink,
} from '@vegaprotocol/ui-toolkit'; } from '@vegaprotocol/ui-toolkit';
import { useVegaWallet } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet';
import { memo, useCallback, useEffect, useRef, useState } from 'react'; import { memo, useCallback, useEffect, useRef, useState } from 'react';
@ -37,6 +39,7 @@ import { Link, useParams } from 'react-router-dom';
import { Links, Routes } from '../../pages/client-router'; import { Links, Routes } from '../../pages/client-router';
import { useMarket, useStaticMarketData } from '@vegaprotocol/market-list'; import { useMarket, useStaticMarketData } from '@vegaprotocol/market-list';
import { useEnvironment } from '@vegaprotocol/environment';
const enum LiquidityTabs { const enum LiquidityTabs {
Active = 'active', Active = 'active',
@ -144,6 +147,7 @@ const LiquidityViewHeader = memo(({ marketId }: { marketId?: string }) => {
market?.tradableInstrument.instrument.product.settlementAsset.decimals || 0; market?.tradableInstrument.instrument.product.settlementAsset.decimals || 0;
const symbol = const symbol =
market?.tradableInstrument.instrument.product.settlementAsset.symbol; market?.tradableInstrument.instrument.product.settlementAsset.symbol;
const { VEGA_DOCS_URL } = useEnvironment();
const { params } = useNetworkParams([ const { params } = useNetworkParams([
NetworkParams.market_liquidity_stakeToCcyVolume, NetworkParams.market_liquidity_stakeToCcyVolume,
@ -211,6 +215,13 @@ const LiquidityViewHeader = memo(({ marketId }: { marketId?: string }) => {
<HeaderStat heading={t('Market ID')}> <HeaderStat heading={t('Market ID')}>
<div className="break-word">{marketId}</div> <div className="break-word">{marketId}</div>
</HeaderStat> </HeaderStat>
<HeaderStat heading={t('Learn more')}>
{VEGA_DOCS_URL && (
<ExternalLink href={createDocsLinks(VEGA_DOCS_URL).LIQUIDITY}>
{t('Providing liquidity')}
</ExternalLink>
)}
</HeaderStat>
</Header> </Header>
); );
}); });

View File

@ -8,6 +8,7 @@ import type { MarketData } from '@vegaprotocol/market-list';
import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list'; import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list';
import { HeaderStat } from '../header'; import { HeaderStat } from '../header';
import { import {
ExternalLink,
Indicator, Indicator,
KeyValueTable, KeyValueTable,
KeyValueTableRow, KeyValueTableRow,
@ -18,9 +19,11 @@ import { useCheckLiquidityStatus } from '@vegaprotocol/liquidity';
import { AuctionTrigger, MarketTradingMode } from '@vegaprotocol/types'; import { AuctionTrigger, MarketTradingMode } from '@vegaprotocol/types';
import { import {
addDecimalsFormatNumber, addDecimalsFormatNumber,
createDocsLinks,
formatNumberPercentage, formatNumberPercentage,
} from '@vegaprotocol/utils'; } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n'; import { t } from '@vegaprotocol/i18n';
import { useEnvironment } from '@vegaprotocol/environment';
interface Props { interface Props {
marketId?: string; marketId?: string;
@ -44,6 +47,8 @@ export const MarketLiquiditySupplied = ({
params.market_liquidity_targetstake_triggering_ratio params.market_liquidity_targetstake_triggering_ratio
); );
const { VEGA_DOCS_URL } = useEnvironment();
const variables = useMemo( const variables = useMemo(
() => ({ () => ({
marketId: marketId || '', marketId: marketId || '',
@ -126,6 +131,14 @@ export const MarketLiquiditySupplied = ({
<Link href={`/#/liquidity/${marketId}`} data-testid="view-liquidity-link"> <Link href={`/#/liquidity/${marketId}`} data-testid="view-liquidity-link">
{t('View liquidity provision table')} {t('View liquidity provision table')}
</Link> </Link>
{VEGA_DOCS_URL && (
<ExternalLink
href={createDocsLinks(VEGA_DOCS_URL).LIQUIDITY}
className="mt-2"
>
{t('Learn about providing liquidity')}
</ExternalLink>
)}
{showMessage && ( {showMessage && (
<p className="mt-4"> <p className="mt-4">
{t( {t(

View File

@ -15,6 +15,7 @@ export const createDocsLinks = (docsUrl: string) => ({
NODE_OPERATORS: `${docsUrl}/node-operators`, NODE_OPERATORS: `${docsUrl}/node-operators`,
LOSS_SOCIALIZATION: `${docsUrl}/concepts/trading-on-vega/market-protections#loss-socialisation`, LOSS_SOCIALIZATION: `${docsUrl}/concepts/trading-on-vega/market-protections#loss-socialisation`,
POSITION_RESOLUTION: `${docsUrl}/concepts/trading-on-vega/market-protections#position-resolution`, POSITION_RESOLUTION: `${docsUrl}/concepts/trading-on-vega/market-protections#position-resolution`,
LIQUIDITY: `${docsUrl}/concepts/liquidity/provision`,
}); });
export const ExternalLinks = { export const ExternalLinks = {