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

View File

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

View File

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