import classNames from 'classnames'; import { ExternalLink, Intent, TradingAnchorButton, TradingButton, VegaIcon, VegaIconNames, } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; import { Networks, useEnvironment } from '@vegaprotocol/environment'; import { OnboardingStep, useGetOnboardingStep, useOnboardingStore, } from './use-get-onboarding-step'; import { Links, Routes } from '../../lib/links'; import { useGlobalStore } from '../../stores'; import { useSidebar, ViewType } from '../sidebar'; import { useT } from '../../lib/use-t'; import { Trans } from 'react-i18next'; interface Props { lead?: string; } const GetStartedButton = ({ step }: { step: OnboardingStep }) => { const t = useT(); const dismiss = useOnboardingStore((store) => store.dismiss); const setDialogOpen = useOnboardingStore((store) => store.setDialogOpen); const marketId = useGlobalStore((store) => store.marketId); const setWalletDialogOpen = useOnboardingStore( (store) => store.setWalletDialogOpen ); const setViews = useSidebar((store) => store.setViews); const buttonProps = { size: 'small' as const, 'data-testid': 'get-started-button', intent: Intent.Info, }; if (step <= OnboardingStep.ONBOARDING_CONNECT_STEP) { return ( setWalletDialogOpen(true)}> {t('Connect')} ); } else if (step === OnboardingStep.ONBOARDING_DEPOSIT_STEP) { return ( setDialogOpen(false)} > {t('Deposit')} ); } else if (step >= OnboardingStep.ONBOARDING_ORDER_STEP) { const link = marketId ? Links.MARKET(marketId) : Links.HOME(); return ( { setViews({ type: ViewType.Order }, Routes.MARKET); dismiss(); }} > {t('Ready to trade')} ); } return ( setWalletDialogOpen(true)}> {t('Get started')} ); }; export const GetStartedCheckList = () => { const t = useT(); const { pubKey } = useVegaWallet(); const currentStep = useGetOnboardingStep(); return ( ); }; export const GetStarted = ({ lead }: Props) => { const t = useT(); const { pubKey } = useVegaWallet(); const { VEGA_ENV, VEGA_NETWORKS } = useEnvironment(); const openVegaWalletDialog = useVegaWalletDialogStore( (store) => store.openVegaWalletDialog ); const currentStep = useGetOnboardingStep(); const dismissed = useOnboardingStore((store) => store.dismissed); const wrapperClasses = classNames( 'flex flex-col py-4 px-6 gap-4 rounded', 'bg-vega-blue-300 dark:bg-vega-blue-700', 'border border-vega-blue-350 dark:border-vega-blue-650', { 'mt-8': !lead } ); if (!dismissed) { return (
{lead &&

{lead}

}

{t('Get started')}

{VEGA_ENV === Networks.MAINNET && (

Fairground Testnet , ]} />

)} {VEGA_ENV === Networks.TESTNET && (

Switch to Mainnet , ]} />

)}
); } if (!pubKey) { return (

Vega wallet , ]} />

{t('Connect wallet')}
); } return null; }; const Step = ({ step, text, complete, }: { step: number; text: string; complete: boolean; }) => { return (
  • {complete ? : {step}.}
    {text}
  • ); }; const Tick = () => { return ( ); };