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

View File

@ -12,6 +12,8 @@ export const createDocsLinks = (docsUrl: string) => ({
VEGA_WALLET_CONCEPTS_URL: `${docsUrl}/concepts/vega-wallet`,
PROPOSALS_GUIDE: `${docsUrl}/tutorials/proposals`,
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 = {