Removing state in Open container to make it fully async

This commit is contained in:
apanizo 2018-09-25 13:34:36 +02:00
parent 61dd4ccf1b
commit fe745e2c03
1 changed files with 2 additions and 13 deletions

View File

@ -1,7 +1,6 @@
// @flow // @flow
import * as React from 'react' import * as React from 'react'
import Stepper from '~/components/Stepper' import Stepper from '~/components/Stepper'
import Confirmation from '~/routes/open/components/FormConfirmation'
import Block from '~/components/layout/Block' import Block from '~/components/layout/Block'
import Heading from '~/components/layout/Heading' import Heading from '~/components/layout/Heading'
import Row from '~/components/layout/Row' import Row from '~/components/layout/Row'
@ -10,13 +9,11 @@ import Review from '~/routes/open/components/ReviewInformation'
import ChevronLeft from '@material-ui/icons/ChevronLeft' import ChevronLeft from '@material-ui/icons/ChevronLeft'
import SafeFields, { safeFieldsValidation } from '~/routes/open/components/SafeForm' import SafeFields, { safeFieldsValidation } from '~/routes/open/components/SafeForm'
import SafeNameField from '~/routes/open/components/SafeNameForm' import SafeNameField from '~/routes/open/components/SafeNameForm'
import { SAFELIST_ADDRESS } from '~/routes/routes'
import Link from '~/components/layout/Link'
import { history } from '~/store' import { history } from '~/store'
import { secondary } from '~/theme/variables' import { secondary } from '~/theme/variables'
const getSteps = () => [ const getSteps = () => [
'Start', 'Details', 'Review', 'Submit', 'Start', 'Details', 'Review',
] ]
const initialValuesFrom = (userAccount: string) => ({ const initialValuesFrom = (userAccount: string) => ({
@ -26,8 +23,6 @@ const initialValuesFrom = (userAccount: string) => ({
type Props = { type Props = {
provider: string, provider: string,
userAccount: string, userAccount: string,
safeAddress: string,
safeTx: string,
onCallSafeContractSubmit: (values: Object) => Promise<void>, onCallSafeContractSubmit: (values: Object) => Promise<void>,
} }
@ -42,11 +37,10 @@ const back = () => {
} }
const Layout = ({ const Layout = ({
provider, userAccount, safeAddress, safeTx, onCallSafeContractSubmit, provider, userAccount, onCallSafeContractSubmit,
}: Props) => { }: Props) => {
const steps = getSteps() const steps = getSteps()
const initialValues = initialValuesFrom(userAccount) const initialValues = initialValuesFrom(userAccount)
const finishedButton = <Stepper.FinishButton title="VISIT SAFES" component={Link} to={SAFELIST_ADDRESS} />
return ( return (
<React.Fragment> <React.Fragment>
@ -60,8 +54,6 @@ const Layout = ({
<Heading tag="h2">Create New Safe</Heading> <Heading tag="h2">Create New Safe</Heading>
</Row> </Row>
<Stepper <Stepper
finishedButton={finishedButton}
finishedTransaction={!!safeAddress}
onSubmit={onCallSafeContractSubmit} onSubmit={onCallSafeContractSubmit}
steps={steps} steps={steps}
initialValues={initialValues} initialValues={initialValues}
@ -75,9 +67,6 @@ const Layout = ({
<Stepper.Page> <Stepper.Page>
{ Review } { Review }
</Stepper.Page> </Stepper.Page>
<Stepper.Page address={safeAddress} tx={safeTx}>
{ Confirmation }
</Stepper.Page>
</Stepper> </Stepper>
</Block> </Block>
) )