add enableEthereum catch

This commit is contained in:
Barry Gitarts 2019-08-29 11:55:33 -04:00 committed by Barry G
parent dcb329557f
commit d8bc0cdeda
1 changed files with 5 additions and 5 deletions

View File

@ -80,13 +80,14 @@ const SubmissionSection = ({ classes, projectData, projectId, profileData, start
const createdDate = getDateCreated(projectAge) const createdDate = getDateCreated(projectAge)
const percentToGoal = manifest ? formatPercent(Number(totalPledged) / Number(manifest.goal)) : formatPercent(0) const percentToGoal = manifest ? formatPercent(Number(totalPledged) / Number(manifest.goal)) : formatPercent(0)
const isCreator = projectData.creator === account const isCreator = projectData.creator === account
const buttonText = account ? 'Fund' : 'Connect & Fund'
return ( return (
<Formik <Formik
initialValues={{ initialValues={{
amount: '', amount: '',
}} }}
onSubmit={async (values, { resetForm }) => { onSubmit={async (values, { resetForm }) => {
const activeStep = stepperProgress(values, projectData, submissionState)
if (!activeStep) return enableEthereum()
const { amount } = values const { amount } = values
const { goalToken } = manifest const { goalToken } = manifest
const { chainReadibleFn } = getTokenByAddress(goalToken) const { chainReadibleFn } = getTokenByAddress(goalToken)
@ -127,7 +128,6 @@ const SubmissionSection = ({ classes, projectData, projectId, profileData, start
handleChange, handleChange,
handleBlur, handleBlur,
handleSubmit, handleSubmit,
isSubmitting
}) => { }) => {
const { firstHalf, secondHalf, fullWidth } = classes const { firstHalf, secondHalf, fullWidth } = classes
const usdValue = manifest ? convertTokenAmountUsd(manifest.goalToken, values.amount, prices) : 0 const usdValue = manifest ? convertTokenAmountUsd(manifest.goalToken, values.amount, prices) : 0
@ -188,7 +188,7 @@ const SubmissionSection = ({ classes, projectData, projectId, profileData, start
<Typography className={classnames(classes.fullWidth, classes.usdText)}> <Typography className={classnames(classes.fullWidth, classes.usdText)}>
{`${totalPledged ? convertTokenAmountUsd(manifest.goalToken, totalPledged, prices) : '$0'} of ${convertTokenAmountUsd(manifest.goalToken, manifest.goal, prices)} USD`} {`${totalPledged ? convertTokenAmountUsd(manifest.goalToken, totalPledged, prices) : '$0'} of ${convertTokenAmountUsd(manifest.goalToken, manifest.goal, prices)} USD`}
</Typography> </Typography>
<div className={classnames(fullWidth, classes.amount)}> {!!activeStep && <div className={classnames(fullWidth, classes.amount)}>
<StatusTextField <StatusTextField
className={classes.amountLayout} className={classes.amountLayout}
inputClass={classes.amountInput} inputClass={classes.amountInput}
@ -202,8 +202,8 @@ const SubmissionSection = ({ classes, projectData, projectId, profileData, start
value={values.amount || ''} value={values.amount || ''}
/> />
<div className={classes.amountText}>{getTokenLabel(manifest.goalToken)}</div> <div className={classes.amountText}>{getTokenLabel(manifest.goalToken)}</div>
</div> </div>}
<Button type="submit" color="primary" variant="contained" className={classnames(classes.formButton)}>{isSubmitting ? 'Ethereum Submission In Progress' : buttonText}</Button> <Button type="submit" color="primary" variant="contained" className={classnames(classes.formButton)}>{STEPS[activeStep]}</Button>
<FundStepper steps={STEPS} activeStep={activeStep} /> <FundStepper steps={STEPS} activeStep={activeStep} />
</div>} </div>}
</form> </form>