mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-02-16 21:36:46 +00:00
add redirect to project page after submission
This commit is contained in:
parent
64de4a0cb6
commit
0c6ea227fa
@ -202,7 +202,7 @@ class PersistentDrawerLeft extends React.Component {
|
|||||||
<Route path="/funds-management" render={() => <FundsManagement open={open} />} />
|
<Route path="/funds-management" render={() => <FundsManagement open={open} />} />
|
||||||
<Route path="/insights" component={TransferGraph} />
|
<Route path="/insights" component={TransferGraph} />
|
||||||
<Route path="/project/:id" component={Project} />
|
<Route path="/project/:id" component={Project} />
|
||||||
<Route path="/create-project/" component={CreateProject} />
|
<Route path="/create-project/" render={(props) => <CreateProject {...props} />} />
|
||||||
<Route path="/back-project/:id" component={BackProject} />
|
<Route path="/back-project/:id" component={BackProject} />
|
||||||
</Switch>
|
</Switch>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
|
@ -109,11 +109,15 @@ const Title = ({ className }) => (
|
|||||||
)
|
)
|
||||||
|
|
||||||
let uploadInput = createRef()
|
let uploadInput = createRef()
|
||||||
|
const getProjectId = response => {
|
||||||
|
const { events: { ProjectAdded: { returnValues: { idProject } } } } = response
|
||||||
|
return idProject
|
||||||
|
}
|
||||||
const addProjectSucessMsg = response => {
|
const addProjectSucessMsg = response => {
|
||||||
const { events: { ProjectAdded: { returnValues: { idProject } } } } = response
|
const { events: { ProjectAdded: { returnValues: { idProject } } } } = response
|
||||||
return `Project created with ID of ${idProject}`
|
return `Project created with ID of ${idProject}, will redirect to your new project page in a few seconds`
|
||||||
}
|
}
|
||||||
const SubmissionSection = ({ classes }) => {
|
const SubmissionSection = ({ classes, history }) => {
|
||||||
const [uploads, setUploads] = useState({})
|
const [uploads, setUploads] = useState({})
|
||||||
const { account, openSnackBar } = useContext(FundingContext)
|
const { account, openSnackBar } = useContext(FundingContext)
|
||||||
return (
|
return (
|
||||||
@ -126,7 +130,7 @@ const SubmissionSection = ({ classes }) => {
|
|||||||
goal: '',
|
goal: '',
|
||||||
goalToken: '',
|
goalToken: '',
|
||||||
video: '',
|
video: '',
|
||||||
isPlaying: false,
|
isPlaying: true,
|
||||||
description: '',
|
description: '',
|
||||||
commitTime: 24
|
commitTime: 24
|
||||||
}}
|
}}
|
||||||
@ -150,7 +154,10 @@ const SubmissionSection = ({ classes }) => {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
console.log({res})
|
console.log({res})
|
||||||
openSnackBar('success', addProjectSucessMsg(res))
|
openSnackBar('success', addProjectSucessMsg(res))
|
||||||
resetForm()
|
setTimeout(() => {
|
||||||
|
history.push(`/project/${getProjectId(res)}`)
|
||||||
|
resetForm()
|
||||||
|
}, 5000)
|
||||||
})
|
})
|
||||||
.catch(e => openSnackBar('error', e))
|
.catch(e => openSnackBar('error', e))
|
||||||
})
|
})
|
||||||
@ -167,7 +174,8 @@ const SubmissionSection = ({ classes }) => {
|
|||||||
handleSubmit,
|
handleSubmit,
|
||||||
setFieldValue,
|
setFieldValue,
|
||||||
setStatus,
|
setStatus,
|
||||||
status
|
status,
|
||||||
|
isSubmitting
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit} className={classes.submissionRoot}>
|
<form onSubmit={handleSubmit} className={classes.submissionRoot}>
|
||||||
@ -377,7 +385,7 @@ const SubmissionSection = ({ classes }) => {
|
|||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
value={values.description || ''}
|
value={values.description || ''}
|
||||||
/>
|
/>
|
||||||
<Button type="submit" color="primary" variant="contained" className={classes.formButton}>Create Project</Button>
|
<Button type="submit" color="primary" variant="contained" className={classes.formButton}>{isSubmitting ? 'Submission In Progress' : 'Create Project'}</Button>
|
||||||
</form>
|
</form>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -386,11 +394,11 @@ const SubmissionSection = ({ classes }) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateProject({ classes }) {
|
function CreateProject({ classes, history }) {
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<Title className={classes.title} />
|
<Title className={classes.title} />
|
||||||
<SubmissionSection classes={classes} />
|
<SubmissionSection classes={classes} history={history} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user