import React from 'react' import PropTypes from 'prop-types' import LoadingBolt from 'components/LoadingBolt' import FormContainer from './FormContainer' import Alias from './Alias' import Autopilot from './Autopilot' import InitWallet from './InitWallet' import Login from './Login' import Signup from './Signup' import NewWalletSeed from './NewWalletSeed' import ReEnterSeed from './ReEnterSeed' import NewWalletPassword from './NewWalletPassword' import NewAezeedPassword from './NewAezeedPassword' import styles from './Onboarding.scss' const Onboarding = ({ onboarding: { step, alias, autopilot, startingLnd, createWalletPassword, seed, aezeedPassword, fetchingSeed }, changeStep, startLnd, submitNewWallet, aliasProps, initWalletProps, autopilotProps, newWalletSeedProps, newWalletPasswordProps, newAezeedPasswordProps, reEnterSeedProps }) => { const renderStep = () => { switch (step) { case 1: return ( changeStep(2)} > ) case 2: return ( changeStep(1)} next={() => startLnd(alias, autopilot)} > ) case 3: return ( ) case 4: return ( changeStep(5)} > ) case 5: return ( changeStep(4)} next={() => initWalletProps.signupProps.signupForm.create ? changeStep(6) : console.log('import')} > ) case 6: return ( changeStep(5)} next={() => changeStep(7)} > ) case 7: return ( changeStep(6)} next={() => { // don't allow them to move on if they havent re-entered the seed correctly if (!reEnterSeedProps.reEnterSeedChecker) { return } changeStep(8) }} > ) case 8: return ( changeStep(6)} next={() => submitNewWallet(createWalletPassword, seed, aezeedPassword)} > ) default: return } } if (startingLnd) { return } if (fetchingSeed) { console.log('got em!') return } return (
{renderStep()}
) } Onboarding.propTypes = { onboarding: PropTypes.object.isRequired, aliasProps: PropTypes.object.isRequired, autopilotProps: PropTypes.object.isRequired, changeStep: PropTypes.func.isRequired, startLnd: PropTypes.func.isRequired } export default Onboarding