2023-02-28 18:56:29 +00:00
|
|
|
import { t } from '@vegaprotocol/i18n';
|
2023-05-02 21:01:33 +00:00
|
|
|
import {
|
|
|
|
Button,
|
|
|
|
Link,
|
|
|
|
VegaIcon,
|
|
|
|
VegaIconNames,
|
|
|
|
} from '@vegaprotocol/ui-toolkit';
|
2022-12-13 13:31:28 +00:00
|
|
|
import { RISK_ACCEPTED_KEY } from '../constants';
|
2023-04-26 15:17:23 +00:00
|
|
|
import { TelemetryApproval } from './telemetry-approval';
|
2023-05-19 21:27:45 +00:00
|
|
|
import type { Networks } from '@vegaprotocol/environment';
|
2023-05-09 15:43:36 +00:00
|
|
|
import {
|
|
|
|
useEnvironment,
|
2023-05-17 10:10:31 +00:00
|
|
|
DocsLinks,
|
|
|
|
ExternalLinks,
|
2023-05-09 15:43:36 +00:00
|
|
|
} from '@vegaprotocol/environment';
|
2023-05-02 21:01:33 +00:00
|
|
|
import { useLocalStorage } from '@vegaprotocol/react-helpers';
|
2022-09-02 14:53:38 +00:00
|
|
|
|
2022-12-13 13:31:28 +00:00
|
|
|
interface Props {
|
|
|
|
onClose: () => void;
|
2023-05-02 21:01:33 +00:00
|
|
|
network: Networks;
|
2022-12-13 13:31:28 +00:00
|
|
|
}
|
2023-05-02 21:01:33 +00:00
|
|
|
export const RiskNoticeDialog = ({ onClose, network }: Props) => {
|
|
|
|
const [, setValue] = useLocalStorage(RISK_ACCEPTED_KEY);
|
|
|
|
|
|
|
|
const handleAcceptRisk = () => {
|
2022-12-13 13:31:28 +00:00
|
|
|
onClose();
|
2023-05-02 21:01:33 +00:00
|
|
|
setValue('true');
|
|
|
|
};
|
2022-09-02 14:53:38 +00:00
|
|
|
|
2023-05-02 21:01:33 +00:00
|
|
|
return (
|
2023-05-19 21:27:45 +00:00
|
|
|
<TestnetContent network={network} handleAcceptRisk={handleAcceptRisk} />
|
2023-05-02 21:01:33 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-05-19 21:27:45 +00:00
|
|
|
const TestnetContent = ({
|
|
|
|
network,
|
|
|
|
handleAcceptRisk,
|
|
|
|
}: {
|
|
|
|
network: Networks;
|
|
|
|
handleAcceptRisk: () => void;
|
|
|
|
}) => {
|
2023-05-09 15:43:36 +00:00
|
|
|
const { GITHUB_FEEDBACK_URL } = useEnvironment();
|
2023-05-02 21:01:33 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<p className="mb-4">
|
|
|
|
{t(
|
|
|
|
'This application for trading on Vega is connected to %s, meaning you are free to try out trading with virtual assets and no risk.',
|
|
|
|
[network]
|
|
|
|
)}
|
|
|
|
</p>
|
|
|
|
<p className="mb-4">
|
|
|
|
{t(
|
|
|
|
'Your Vega wallet must also be connected to %s, and your Ethereum wallet must be connected to Sepolia.',
|
|
|
|
[network]
|
|
|
|
)}
|
|
|
|
</p>
|
2023-05-17 10:10:31 +00:00
|
|
|
{GITHUB_FEEDBACK_URL && DocsLinks && (
|
2023-05-02 21:01:33 +00:00
|
|
|
<ul className="list-disc pl-4">
|
|
|
|
<li className="mb-1">
|
2023-05-17 10:10:31 +00:00
|
|
|
<Link href={ExternalLinks.VEGA_WALLET_URL} target="_blank">
|
2023-05-09 15:43:36 +00:00
|
|
|
<span className="underline">{t('Get a Vega Wallet')}</span>{' '}
|
2023-05-02 21:01:33 +00:00
|
|
|
<VegaIcon name={VegaIconNames.OPEN_EXTERNAL} />
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
<li className="mb-1">
|
2023-05-17 10:10:31 +00:00
|
|
|
<Link href={DocsLinks.VEGA_WALLET_TOOLS_URL} target="_blank">
|
2023-05-09 15:43:36 +00:00
|
|
|
<span className="underline">{t('Learn about Vega Wallet')}</span>{' '}
|
2023-05-02 21:01:33 +00:00
|
|
|
<VegaIcon name={VegaIconNames.OPEN_EXTERNAL} />
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
<li className="mb-1">
|
|
|
|
<Link href={GITHUB_FEEDBACK_URL} target="_blank">
|
|
|
|
<span className="underline">{t('Provide feedback')}</span>{' '}
|
|
|
|
<VegaIcon name={VegaIconNames.OPEN_EXTERNAL} />
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
)}
|
2023-05-19 21:27:45 +00:00
|
|
|
<div className="my-4">
|
|
|
|
<TelemetryApproval
|
|
|
|
helpText={t(
|
|
|
|
'Help identify bugs and improve the service by sharing anonymous usage data. You can change this in your settings at any time.'
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<Button onClick={handleAcceptRisk}>{t('Continue')}</Button>
|
2022-12-13 13:31:28 +00:00
|
|
|
</>
|
2022-09-02 14:53:38 +00:00
|
|
|
);
|
|
|
|
};
|