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 { FormikContextType, useFormikContext } from 'formik'
|
||||||
import { FormPublishData } from '../_types'
|
import { FormPublishData } from '../_types'
|
||||||
import { wizardSteps } from '../_constants'
|
import { wizardSteps } from '../_constants'
|
||||||
|
import SuccessConfetti from '@shared/SuccessConfetti'
|
||||||
|
|
||||||
export default function Actions({
|
export default function Actions({
|
||||||
scrollToRef
|
scrollToRef,
|
||||||
|
did
|
||||||
}: {
|
}: {
|
||||||
scrollToRef: RefObject<any>
|
scrollToRef: RefObject<any>
|
||||||
|
did: string
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const {
|
const {
|
||||||
values,
|
values,
|
||||||
@ -37,28 +40,43 @@ export default function Actions({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<footer className={styles.actions}>
|
<footer className={styles.actions}>
|
||||||
{values.user.stepCurrent > 1 && (
|
{did ? (
|
||||||
<Button onClick={handlePrevious} disabled={isSubmitting}>
|
<SuccessConfetti
|
||||||
Back
|
success="Successfully published!"
|
||||||
</Button>
|
action={
|
||||||
)}
|
<Button style="primary" to={`/asset/${did}`}>
|
||||||
|
View Asset
|
||||||
{values.user.stepCurrent < wizardSteps.length ? (
|
</Button>
|
||||||
<Button
|
}
|
||||||
style="primary"
|
/>
|
||||||
onClick={handleNext}
|
|
||||||
disabled={isContinueDisabled}
|
|
||||||
>
|
|
||||||
Continue
|
|
||||||
</Button>
|
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<>
|
||||||
type="submit"
|
{values.user.stepCurrent > 1 && (
|
||||||
style="primary"
|
<Button onClick={handlePrevious} disabled={isSubmitting}>
|
||||||
disabled={values.user.accountId === '' || !isValid || isSubmitting}
|
Back
|
||||||
>
|
</Button>
|
||||||
Submit
|
)}
|
||||||
</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>
|
</footer>
|
||||||
)
|
)
|
||||||
|
@ -46,6 +46,7 @@ export default function PublishPage({
|
|||||||
const [feedback, setFeedback] = useState<PublishFeedback>(
|
const [feedback, setFeedback] = useState<PublishFeedback>(
|
||||||
initialPublishFeedback
|
initialPublishFeedback
|
||||||
)
|
)
|
||||||
|
const [did, setDid] = useState<string>()
|
||||||
|
|
||||||
async function handleSubmit(values: FormPublishData) {
|
async function handleSubmit(values: FormPublishData) {
|
||||||
let _erc721Address: string,
|
let _erc721Address: string,
|
||||||
@ -214,6 +215,8 @@ export default function PublishPage({
|
|||||||
txHash
|
txHash
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
setDid(_ddo.id)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LoggerInstance.error('[publish] error', error.message)
|
LoggerInstance.error('[publish] error', error.message)
|
||||||
setFeedback((prevState) => ({
|
setFeedback((prevState) => ({
|
||||||
@ -294,7 +297,7 @@ export default function PublishPage({
|
|||||||
<Form className={styles.form} ref={scrollToRef}>
|
<Form className={styles.form} ref={scrollToRef}>
|
||||||
<Navigation />
|
<Navigation />
|
||||||
<Steps feedback={feedback} />
|
<Steps feedback={feedback} />
|
||||||
<Actions scrollToRef={scrollToRef} />
|
<Actions scrollToRef={scrollToRef} did={did} />
|
||||||
</Form>
|
</Form>
|
||||||
{debug && <Debug />}
|
{debug && <Debug />}
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user