fix(trading): add loss socialisation docs links (#3109)

This commit is contained in:
m.ray 2023-03-08 04:42:25 -05:00 committed by GitHub
parent 31c8365812
commit e66e96f12d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -30,6 +30,7 @@ import {
formatNumber, formatNumber,
getDateTimeFormat, getDateTimeFormat,
addDecimalsFormatNumber, addDecimalsFormatNumber,
createDocsLinks,
} from '@vegaprotocol/utils'; } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n'; import { t } from '@vegaprotocol/i18n';
import { AgGridColumn } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react';
@ -422,6 +423,8 @@ export const PNLCell = ({
data, data,
}: VegaICellRendererParams<Position, 'realisedPNL'>) => { }: VegaICellRendererParams<Position, 'realisedPNL'>) => {
const { VEGA_DOCS_URL } = useEnvironment(); const { VEGA_DOCS_URL } = useEnvironment();
const LOSS_SOCIALIZATION_LINK =
VEGA_DOCS_URL && createDocsLinks(VEGA_DOCS_URL).LOSS_SOCIALIZATION;
if (!data) { if (!data) {
return <>-</>; return <>-</>;
@ -446,7 +449,7 @@ export const PNLCell = ({
{t('Lifetime loss socialisation deductions: %s', lossesFormatted)} {t('Lifetime loss socialisation deductions: %s', lossesFormatted)}
</p> </p>
{VEGA_DOCS_URL && ( {VEGA_DOCS_URL && (
<ExternalLink href={VEGA_DOCS_URL}> <ExternalLink href={LOSS_SOCIALIZATION_LINK}>
{t('Read more about loss socialisation')} {t('Read more about loss socialisation')}
</ExternalLink> </ExternalLink>
)} )}
@ -473,6 +476,9 @@ export const OpenVolumeCell = ({
return <>{valueFormatted}</>; return <>{valueFormatted}</>;
} }
const POSITION_RESOLUTION_LINK =
VEGA_DOCS_URL && createDocsLinks(VEGA_DOCS_URL).POSITION_RESOLUTION;
return ( return (
<WarningCell <WarningCell
tooltipContent={ tooltipContent={
@ -489,7 +495,7 @@ export const OpenVolumeCell = ({
)} )}
</p> </p>
{VEGA_DOCS_URL && ( {VEGA_DOCS_URL && (
<ExternalLink href={VEGA_DOCS_URL}> <ExternalLink href={POSITION_RESOLUTION_LINK}>
{t('Read more about position resolution')} {t('Read more about position resolution')}
</ExternalLink> </ExternalLink>
)} )}

View File

@ -12,6 +12,8 @@ export const createDocsLinks = (docsUrl: string) => ({
VEGA_WALLET_CONCEPTS_URL: `${docsUrl}/concepts/vega-wallet`, VEGA_WALLET_CONCEPTS_URL: `${docsUrl}/concepts/vega-wallet`,
PROPOSALS_GUIDE: `${docsUrl}/tutorials/proposals`, PROPOSALS_GUIDE: `${docsUrl}/tutorials/proposals`,
NODE_OPERATORS: `${docsUrl}/node-operators`, NODE_OPERATORS: `${docsUrl}/node-operators`,
LOSS_SOCIALIZATION: `${docsUrl}/concepts/trading-on-vega/market-protections#loss-socialisation`,
POSITION_RESOLUTION: `${docsUrl}/concepts/trading-on-vega/market-protections#position-resolution`,
}); });
export const ExternalLinks = { export const ExternalLinks = {