fix(trading): welcome dialog links (#3656)

Co-authored-by: Madalina Raicu <madalina@raygroup.uk>
This commit is contained in:
Art 2023-05-09 17:43:36 +02:00 committed by GitHub
parent 2cb3b55a3b
commit 02399c40fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 8 deletions

View File

@ -7,7 +7,13 @@ import {
} from '@vegaprotocol/ui-toolkit'; } from '@vegaprotocol/ui-toolkit';
import { RISK_ACCEPTED_KEY } from '../constants'; import { RISK_ACCEPTED_KEY } from '../constants';
import { TelemetryApproval } from './telemetry-approval'; import { TelemetryApproval } from './telemetry-approval';
import { Networks, useEnvironment } from '@vegaprotocol/environment'; import {
DOCS_VEGA_WALLET,
GET_VEGA_WALLET_URL,
Networks,
useDocsLink,
useEnvironment,
} from '@vegaprotocol/environment';
import { useLocalStorage } from '@vegaprotocol/react-helpers'; import { useLocalStorage } from '@vegaprotocol/react-helpers';
interface Props { interface Props {
@ -46,8 +52,9 @@ export const RiskNoticeDialog = ({ onClose, network }: Props) => {
}; };
const TestnetContent = ({ network }: { network: Networks }) => { const TestnetContent = ({ network }: { network: Networks }) => {
const { VEGA_DOCS_URL, GITHUB_FEEDBACK_URL, VEGA_WALLET_URL } = const { GITHUB_FEEDBACK_URL } = useEnvironment();
useEnvironment(); const docsLink = useDocsLink();
return ( return (
<> <>
<p className="mb-4"> <p className="mb-4">
@ -62,17 +69,17 @@ const TestnetContent = ({ network }: { network: Networks }) => {
[network] [network]
)} )}
</p> </p>
{VEGA_DOCS_URL && GITHUB_FEEDBACK_URL && VEGA_WALLET_URL && ( {GITHUB_FEEDBACK_URL && GET_VEGA_WALLET_URL && docsLink && (
<ul className="list-disc pl-4"> <ul className="list-disc pl-4">
<li className="mb-1"> <li className="mb-1">
<Link href={VEGA_WALLET_URL} target="_blank"> <Link href={GET_VEGA_WALLET_URL} target="_blank">
<span className="underline">{t('Learn about Vega wallet')}</span>{' '} <span className="underline">{t('Get a Vega Wallet')}</span>{' '}
<VegaIcon name={VegaIconNames.OPEN_EXTERNAL} /> <VegaIcon name={VegaIconNames.OPEN_EXTERNAL} />
</Link> </Link>
</li> </li>
<li className="mb-1"> <li className="mb-1">
<Link href={VEGA_DOCS_URL} target="_blank"> <Link href={docsLink(DOCS_VEGA_WALLET)} target="_blank">
<span className="underline">{t('View documentation')}</span>{' '} <span className="underline">{t('Learn about Vega Wallet')}</span>{' '}
<VegaIcon name={VegaIconNames.OPEN_EXTERNAL} /> <VegaIcon name={VegaIconNames.OPEN_EXTERNAL} />
</Link> </Link>
</li> </li>

View File

@ -84,6 +84,16 @@ export const useEtherscanLink = () => {
return link; return link;
}; };
export const useDocsLink = () => {
const { VEGA_DOCS_URL } = useEnvironment();
const baseUrl = trim(VEGA_DOCS_URL, '/');
const link = useCallback(
(url?: string) => `${baseUrl}/${trim(url, '/') || ''}`,
[baseUrl]
);
return link;
};
// Vega blog // Vega blog
export const BLOG = 'https://blog.vega.xyz/'; export const BLOG = 'https://blog.vega.xyz/';
@ -125,3 +135,9 @@ export const CONSOLE_MARKET = '/markets/:marketId';
export const CONSOLE_MARKETS = '/markets/all'; export const CONSOLE_MARKETS = '/markets/all';
export const CONSOLE_PORTFOLIO = '/portfolio'; export const CONSOLE_PORTFOLIO = '/portfolio';
export const CONSOLE_LIQUIDITY = 'liquidity/:marketId'; export const CONSOLE_LIQUIDITY = 'liquidity/:marketId';
// Vega XYZ
export const GET_VEGA_WALLET_URL = 'https://vega.xyz/wallet/';
// Docs
export const DOCS_VEGA_WALLET = '/tools/vega-wallet';