2023-09-14 19:10:33 +00:00
|
|
|
import { Dialog, Intent } from '@vegaprotocol/ui-toolkit';
|
2023-02-28 18:56:29 +00:00
|
|
|
import { t } from '@vegaprotocol/i18n';
|
2023-08-02 15:34:04 +00:00
|
|
|
import { useEnvironment } from '@vegaprotocol/environment';
|
|
|
|
import { WelcomeDialogContent } from './welcome-dialog-content';
|
2023-09-14 19:10:33 +00:00
|
|
|
import { useOnboardingStore } from './use-get-onboarding-step';
|
2023-09-22 09:04:02 +00:00
|
|
|
import { VegaConnectDialog } from '@vegaprotocol/wallet';
|
|
|
|
import { Connectors } from '../../lib/vega-connectors';
|
|
|
|
import { RiskMessage } from './risk-message';
|
2022-12-13 13:31:28 +00:00
|
|
|
|
|
|
|
export const WelcomeDialog = () => {
|
2023-05-02 21:01:33 +00:00
|
|
|
const { VEGA_ENV } = useEnvironment();
|
2023-09-01 09:00:20 +00:00
|
|
|
const dismissed = useOnboardingStore((store) => store.dismissed);
|
2023-09-14 19:10:33 +00:00
|
|
|
const dialogOpen = useOnboardingStore((store) => store.dialogOpen);
|
|
|
|
const dismiss = useOnboardingStore((store) => store.dismiss);
|
2023-09-22 09:04:02 +00:00
|
|
|
const walletDialogOpen = useOnboardingStore(
|
|
|
|
(store) => store.walletDialogOpen
|
|
|
|
);
|
|
|
|
const setWalletDialogOpen = useOnboardingStore(
|
|
|
|
(store) => store.setWalletDialogOpen
|
|
|
|
);
|
|
|
|
|
|
|
|
const content = walletDialogOpen ? (
|
|
|
|
<VegaConnectDialog
|
|
|
|
connectors={Connectors}
|
|
|
|
riskMessage={<RiskMessage />}
|
|
|
|
onClose={() => setWalletDialogOpen(false)}
|
|
|
|
contentOnly
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<WelcomeDialogContent />
|
|
|
|
);
|
|
|
|
|
|
|
|
const onClose = walletDialogOpen ? () => setWalletDialogOpen(false) : dismiss;
|
|
|
|
|
|
|
|
const title = walletDialogOpen ? null : (
|
|
|
|
<span className="font-alpha calt" data-testid="welcome-title">
|
|
|
|
{t('Console')}{' '}
|
|
|
|
<span className="text-vega-clight-100 dark:text-vega-cdark-100">
|
|
|
|
{VEGA_ENV}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
);
|
2023-01-02 16:01:06 +00:00
|
|
|
|
2023-09-14 19:10:33 +00:00
|
|
|
return (
|
2022-12-13 13:31:28 +00:00
|
|
|
<Dialog
|
2023-09-14 19:10:33 +00:00
|
|
|
open={dismissed ? false : dialogOpen}
|
2023-09-22 09:04:02 +00:00
|
|
|
title={title}
|
2023-08-02 15:34:04 +00:00
|
|
|
size="medium"
|
2023-09-22 09:04:02 +00:00
|
|
|
onChange={onClose}
|
2023-08-02 15:34:04 +00:00
|
|
|
intent={Intent.None}
|
|
|
|
dataTestId="welcome-dialog"
|
2022-12-13 13:31:28 +00:00
|
|
|
>
|
2023-09-22 09:04:02 +00:00
|
|
|
{content}
|
2022-12-13 13:31:28 +00:00
|
|
|
</Dialog>
|
2023-09-14 19:10:33 +00:00
|
|
|
);
|
2022-12-13 13:31:28 +00:00
|
|
|
};
|