mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 01:34:57 +01:00
more fixes
This commit is contained in:
parent
83d791cf1b
commit
eb8221d104
@ -1,13 +1,13 @@
|
||||
import React, { ReactElement } from 'react'
|
||||
import stylesIndex from './index.module.css'
|
||||
import styles from './Coin.module.css'
|
||||
import stylesInput from '../../../atoms/Input/index.module.css'
|
||||
import InputElement from '../../../atoms/Input/InputElement'
|
||||
import { ReactComponent as Logo } from '../../../../images/logo.svg'
|
||||
import Conversion from '../../../atoms/Price/Conversion'
|
||||
import { DataTokenOptions } from '@oceanprotocol/react'
|
||||
import RefreshName from './RefreshName'
|
||||
import { useField } from 'formik'
|
||||
import Error from './Error'
|
||||
|
||||
export default function Coin({
|
||||
datatokenOptions,
|
||||
@ -51,9 +51,7 @@ export default function Coin({
|
||||
{datatokenOptions?.symbol === 'OCEAN' && (
|
||||
<Conversion price={field.value} className={stylesIndex.conversion} />
|
||||
)}
|
||||
{meta.error && meta.touched && (
|
||||
<div className={stylesInput.error}>{meta.error}</div>
|
||||
)}
|
||||
<Error meta={meta} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
13
src/components/molecules/FormFields/Price/Error.tsx
Normal file
13
src/components/molecules/FormFields/Price/Error.tsx
Normal file
@ -0,0 +1,13 @@
|
||||
import { FieldMetaProps } from 'formik'
|
||||
import React, { ReactElement } from 'react'
|
||||
import stylesInput from '../../../atoms/Input/index.module.css'
|
||||
|
||||
export default function Error({
|
||||
meta
|
||||
}: {
|
||||
meta: FieldMetaProps<any>
|
||||
}): ReactElement {
|
||||
return meta.error ? (
|
||||
<div className={stylesInput.error}>{meta.error}</div>
|
||||
) : null
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
import React, { ReactElement } from 'react'
|
||||
import Tooltip from '../../../atoms/Tooltip'
|
||||
import styles from './Fees.module.css'
|
||||
import stylesInput from '../../../atoms/Input/index.module.css'
|
||||
import { useSiteMetadata } from '../../../../hooks/useSiteMetadata'
|
||||
import { useField } from 'formik'
|
||||
import Input from '../../../atoms/Input'
|
||||
import Error from './Error'
|
||||
|
||||
export default function Fees({
|
||||
tooltips
|
||||
@ -31,12 +31,7 @@ export default function Fees({
|
||||
step="0.1"
|
||||
small
|
||||
{...field}
|
||||
additionalComponent={
|
||||
meta.error &&
|
||||
meta.touched && (
|
||||
<div className={stylesInput.error}>{meta.error}</div>
|
||||
)
|
||||
}
|
||||
additionalComponent={<Error meta={meta} />}
|
||||
/>
|
||||
|
||||
<Input
|
||||
|
@ -1,13 +1,13 @@
|
||||
import React, { ReactElement } from 'react'
|
||||
import stylesIndex from './index.module.css'
|
||||
import styles from './Fixed.module.css'
|
||||
import stylesInput from '../../../atoms/Input/index.module.css'
|
||||
import FormHelp from '../../../atoms/Input/Help'
|
||||
import Conversion from '../../../atoms/Price/Conversion'
|
||||
import { DataTokenOptions } from '@oceanprotocol/react'
|
||||
import RefreshName from './RefreshName'
|
||||
import { useField } from 'formik'
|
||||
import Input from '../../../atoms/Input'
|
||||
import Error from './Error'
|
||||
|
||||
export default function Fixed({
|
||||
datatokenOptions,
|
||||
@ -40,9 +40,7 @@ export default function Fixed({
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{meta.error && meta.touched && (
|
||||
<div className={stylesInput.error}>{meta.error}</div>
|
||||
)}
|
||||
<Error meta={meta} />
|
||||
</div>
|
||||
|
||||
{datatokenOptions && (
|
||||
|
@ -7,7 +7,7 @@ import Fixed from './Fixed'
|
||||
import Dynamic from './Dynamic'
|
||||
import { useField } from 'formik'
|
||||
import { useUserPreferences } from '../../../../providers/UserPreferences'
|
||||
import { DataTokenOptions, PriceOptions, useOcean } from '@oceanprotocol/react'
|
||||
import { DataTokenOptions, useOcean } from '@oceanprotocol/react'
|
||||
import { PriceOptionsMarket } from '../../../../@types/MetaData'
|
||||
|
||||
const query = graphql`
|
||||
|
@ -9,7 +9,9 @@ export const validationSchema = Yup.object().shape<MetadataPublishForm>({
|
||||
price: Yup.object()
|
||||
.shape({
|
||||
price: Yup.number().min(1, 'Must be greater than 0').required('Required'),
|
||||
tokensToMint: Yup.number().positive().required('Required'),
|
||||
tokensToMint: Yup.number()
|
||||
.min(1, 'Must be greater than 0')
|
||||
.required('Required'),
|
||||
type: Yup.string()
|
||||
.matches(/fixed|dynamic/g)
|
||||
.required('Required'),
|
||||
|
Loading…
Reference in New Issue
Block a user