mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
add basic full success state
This commit is contained in:
parent
8a20552268
commit
bd561a2510
@ -4,11 +4,14 @@ import styles from './index.module.css'
|
||||
import { FormikContextType, useFormikContext } from 'formik'
|
||||
import { FormPublishData } from '../_types'
|
||||
import { wizardSteps } from '../_constants'
|
||||
import SuccessConfetti from '@shared/SuccessConfetti'
|
||||
|
||||
export default function Actions({
|
||||
scrollToRef
|
||||
scrollToRef,
|
||||
did
|
||||
}: {
|
||||
scrollToRef: RefObject<any>
|
||||
did: string
|
||||
}): ReactElement {
|
||||
const {
|
||||
values,
|
||||
@ -37,28 +40,43 @@ export default function Actions({
|
||||
|
||||
return (
|
||||
<footer className={styles.actions}>
|
||||
{values.user.stepCurrent > 1 && (
|
||||
<Button onClick={handlePrevious} disabled={isSubmitting}>
|
||||
Back
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{values.user.stepCurrent < wizardSteps.length ? (
|
||||
<Button
|
||||
style="primary"
|
||||
onClick={handleNext}
|
||||
disabled={isContinueDisabled}
|
||||
>
|
||||
Continue
|
||||
</Button>
|
||||
{did ? (
|
||||
<SuccessConfetti
|
||||
success="Successfully published!"
|
||||
action={
|
||||
<Button style="primary" to={`/asset/${did}`}>
|
||||
View Asset
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<Button
|
||||
type="submit"
|
||||
style="primary"
|
||||
disabled={values.user.accountId === '' || !isValid || isSubmitting}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
<>
|
||||
{values.user.stepCurrent > 1 && (
|
||||
<Button onClick={handlePrevious} disabled={isSubmitting}>
|
||||
Back
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{values.user.stepCurrent < wizardSteps.length ? (
|
||||
<Button
|
||||
style="primary"
|
||||
onClick={handleNext}
|
||||
disabled={isContinueDisabled}
|
||||
>
|
||||
Continue
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
type="submit"
|
||||
style="primary"
|
||||
disabled={
|
||||
values.user.accountId === '' || !isValid || isSubmitting
|
||||
}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</footer>
|
||||
)
|
||||
|
@ -46,6 +46,7 @@ export default function PublishPage({
|
||||
const [feedback, setFeedback] = useState<PublishFeedback>(
|
||||
initialPublishFeedback
|
||||
)
|
||||
const [did, setDid] = useState<string>()
|
||||
|
||||
async function handleSubmit(values: FormPublishData) {
|
||||
let _erc721Address: string,
|
||||
@ -214,6 +215,8 @@ export default function PublishPage({
|
||||
txHash
|
||||
}
|
||||
}))
|
||||
|
||||
setDid(_ddo.id)
|
||||
} catch (error) {
|
||||
LoggerInstance.error('[publish] error', error.message)
|
||||
setFeedback((prevState) => ({
|
||||
@ -294,7 +297,7 @@ export default function PublishPage({
|
||||
<Form className={styles.form} ref={scrollToRef}>
|
||||
<Navigation />
|
||||
<Steps feedback={feedback} />
|
||||
<Actions scrollToRef={scrollToRef} />
|
||||
<Actions scrollToRef={scrollToRef} did={did} />
|
||||
</Form>
|
||||
{debug && <Debug />}
|
||||
</>
|
||||
|
Loading…
Reference in New Issue
Block a user