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