import { useQuery, gql } from '@apollo/client' import Dialog from '@mui/material/Dialog' import DialogContent from '@mui/material/DialogContent' import classnames from 'classnames' import React, { useState, useContext } from 'react' import { useLocation } from 'wouter' import { getWizardStep, STEPS } from './helper' import AppContext from '../../AppContext' import Footer from './components/Footer' const GET_DATA = gql` query getData { config accounts cryptoCurrencies { code display } } ` const Wizard = () => { const { data, loading } = useQuery(GET_DATA) const [, navigate] = useLocation() const { setWizardTested } = useContext(AppContext) const [step, setStep] = useState(0) const [open, setOpen] = useState(true) const [footerExp, setFooterExp] = useState(false) if (loading) { return <> } const wizardStep = getWizardStep(data?.config, data?.cryptoCurrencies) if (wizardStep === 0) { setWizardTested(true) return <> } const isWelcome = step === 0 const start = () => { setFooterExp(false) } const doContinue = () => { if (step >= STEPS.length - 1) { setOpen(false) setWizardTested(true) navigate('/') return } const nextStep = step === 0 && wizardStep ? wizardStep : step + 1 setFooterExp(true) setStep(nextStep) } const current = STEPS[step] const classNames = { 'flex flex-col justify-between py-4 px-0 bg-white': true, 'bg-[url(/wizard-background.svg)] bg-no-repeat bg-center bg-fixed bg-cover': isWelcome, 'blur-sm pointer-events-none': footerExp, } return ( {!isWelcome && ( ) } export default Wizard