1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

page title tweaks

This commit is contained in:
Matthias Kretschmann 2021-11-26 11:03:55 +00:00
parent 362e404110
commit 5dca006832
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 37 additions and 38 deletions

View File

@ -1,23 +1,17 @@
import React, { FormEvent, ReactElement, Ref, RefObject } from 'react' import React, { FormEvent, ReactElement, RefObject } from 'react'
import Button from '@shared/atoms/Button' import Button from '@shared/atoms/Button'
import styles from './index.module.css' 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 { useWeb3 } from '@context/Web3'
export default function Actions({ export default function Actions({
scrollToRef scrollToRef
}: { }: {
scrollToRef: RefObject<any> scrollToRef: RefObject<any>
}): ReactElement { }): ReactElement {
const { accountId } = useWeb3() const { values, isValid, setFieldValue }: FormikContextType<FormPublishData> =
const { useFormikContext()
status,
values,
isValid,
setFieldValue
}: FormikContextType<FormPublishData> = useFormikContext()
function handleNext(e: FormEvent) { function handleNext(e: FormEvent) {
e.preventDefault() e.preventDefault()
@ -42,7 +36,11 @@ export default function Actions({
Continue Continue
</Button> </Button>
) : ( ) : (
<Button type="submit" style="primary" disabled={!accountId || !isValid}> <Button
type="submit"
style="primary"
disabled={values.user.accountId === '' || !isValid}
>
Submit Submit
</Button> </Button>
)} )}

View File

@ -1,13 +1,14 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import NetworkName from '@shared/NetworkName' import NetworkName from '@shared/NetworkName'
import Tooltip from '@shared/atoms/Tooltip' import Tooltip from '@shared/atoms/Tooltip'
import { useWeb3 } from '@context/Web3'
import styles from './index.module.css' import styles from './index.module.css'
import content from '../../../../content/publish/index.json' import content from '../../../../content/publish/index.json'
export default function Title(): ReactElement { export default function Title({
const { networkId } = useWeb3() networkId
}: {
networkId: number
}): ReactElement {
return ( return (
<> <>
{content.title}{' '} {content.title}{' '}

View File

@ -1,5 +1,5 @@
import React, { ReactElement, useState, useRef } from 'react' import React, { ReactElement, useState, useRef } from 'react'
import { Form, Formik } from 'formik' import { Form, Formik, validateYupSchema } from 'formik'
import { initialValues } from './_constants' import { initialValues } from './_constants'
import { validationSchema } from './_validation' import { validationSchema } from './_validation'
import { useAccountPurgatory } from '@hooks/useAccountPurgatory' import { useAccountPurgatory } from '@hooks/useAccountPurgatory'
@ -80,11 +80,7 @@ export default function PublishPage({
} }
} }
return ( return isInPurgatory && purgatoryData ? null : (
<>
<PageHeader title={<Title />} description={content.description} />
{isInPurgatory && purgatoryData ? null : (
<Formik <Formik
initialValues={initialValues} initialValues={initialValues}
validationSchema={validationSchema} validationSchema={validationSchema}
@ -93,7 +89,12 @@ export default function PublishPage({
await handleSubmit(values) await handleSubmit(values)
}} }}
> >
{({ values }) => (
<> <>
<PageHeader
title={<Title networkId={values.user.chainId} />}
description={content.description}
/>
<Form className={styles.form} ref={scrollToRef}> <Form className={styles.form} ref={scrollToRef}>
<Navigation /> <Navigation />
<Steps /> <Steps />
@ -101,8 +102,7 @@ export default function PublishPage({
</Form> </Form>
{debug && <Debug />} {debug && <Debug />}
</> </>
</Formik>
)} )}
</> </Formik>
) )
} }