import React, { useState } from 'react' import { CheckCircleIcon } from '@heroicons/react/outline' import Modal from './Modal' import Button from './Button' import useLocalStorageState from '../hooks/useLocalStorageState' import { useTranslation } from 'next-i18next' import Checkbox from './Checkbox' import { SHOW_TOUR_KEY } from './IntroTips' import { useViewport } from '../hooks/useViewport' import { breakpoints } from './TradePageGrid' import { useRouter } from 'next/router' import { LANGS } from './SettingsModal' import { RadioGroup } from '@headlessui/react' export const ALPHA_MODAL_KEY = 'mangoAlphaAccepted-3.06' const AlphaModal = ({ isOpen, onClose, }: { isOpen: boolean onClose?: (x) => void }) => { const { t } = useTranslation('common') const [acceptRisks, setAcceptRisks] = useState(false) const [, setAlphaAccepted] = useLocalStorageState(ALPHA_MODAL_KEY, false) const [, setShowTips] = useLocalStorageState(SHOW_TOUR_KEY, false) const [savedLanguage, setSavedLanguage] = useLocalStorageState('language', '') const [language, setLanguage] = useState('en') const router = useRouter() const { pathname, asPath, query } = router const { width } = useViewport() const hideTips = width ? width < breakpoints.md : false const handleLanguageSelect = () => { setSavedLanguage(language) router.push({ pathname, query }, asPath, { locale: language }) } const handleGetStarted = () => { setAlphaAccepted(true) } const handleTakeTour = () => { setAlphaAccepted(true) setShowTips(true) } return (
next

{t('v3-welcome')} V3

{savedLanguage ? ( <>
{t('intro-feature-1')}
{t('intro-feature-2')}
{t('intro-feature-3')}
{t('intro-feature-4')}
{t('v3-unaudited')}
setAcceptRisks(e.target.checked)} > {t('accept-terms')}
{!hideTips ? ( ) : null}
) : (
{LANGS.map((l) => ( {({ checked }) => (
{t(l.name.toLowerCase())}
)}
))}
)}
) } export default React.memo(AlphaModal)