mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 01:34:57 +01:00
refactor
This commit is contained in:
parent
fd1b66883a
commit
20e66cac9c
22
src/components/organisms/AssetContent/Pricing/Feedback.tsx
Normal file
22
src/components/organisms/AssetContent/Pricing/Feedback.tsx
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import Loader from '../../../atoms/Loader'
|
||||||
|
import SuccessConfetti from '../../../atoms/SuccessConfetti'
|
||||||
|
import React, { ReactElement } from 'react'
|
||||||
|
import styles from './Feedback.module.css'
|
||||||
|
|
||||||
|
export default function Feedback({
|
||||||
|
success,
|
||||||
|
pricingStepText
|
||||||
|
}: {
|
||||||
|
success: string
|
||||||
|
pricingStepText: string
|
||||||
|
}): ReactElement {
|
||||||
|
return (
|
||||||
|
<div className={styles.feedback}>
|
||||||
|
{success ? (
|
||||||
|
<SuccessConfetti success={success} />
|
||||||
|
) : (
|
||||||
|
<Loader message={pricingStepText} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
@ -8,7 +8,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
composes: box from '../../../atoms/Box.module.css';
|
composes: box from '../../../../atoms/Box.module.css';
|
||||||
padding: calc(var(--spacer) / 1.5);
|
padding: calc(var(--spacer) / 1.5);
|
||||||
width: 6rem;
|
width: 6rem;
|
||||||
height: 6rem;
|
height: 6rem;
|
@ -1,9 +1,9 @@
|
|||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import stylesIndex from './index.module.css'
|
import stylesIndex from './index.module.css'
|
||||||
import styles from './Coin.module.css'
|
import styles from './Coin.module.css'
|
||||||
import InputElement from '../../../atoms/Input/InputElement'
|
import InputElement from '../../../../atoms/Input/InputElement'
|
||||||
import { ReactComponent as Logo } from '../../../../images/logo.svg'
|
import { ReactComponent as Logo } from '../../../../../images/logo.svg'
|
||||||
import Conversion from '../../../atoms/Price/Conversion'
|
import Conversion from '../../../../atoms/Price/Conversion'
|
||||||
import { DataTokenOptions } from '@oceanprotocol/react'
|
import { DataTokenOptions } from '@oceanprotocol/react'
|
||||||
import { useField } from 'formik'
|
import { useField } from 'formik'
|
||||||
import Error from './Error'
|
import Error from './Error'
|
@ -1,18 +1,18 @@
|
|||||||
import { DataTokenOptions, useOcean, usePricing } from '@oceanprotocol/react'
|
import { DataTokenOptions, useOcean, usePricing } from '@oceanprotocol/react'
|
||||||
import PriceUnit from '../../../atoms/Price/PriceUnit'
|
import PriceUnit from '../../../../atoms/Price/PriceUnit'
|
||||||
import React, { ReactElement, useEffect, useState } from 'react'
|
import React, { ReactElement, useEffect, useState } from 'react'
|
||||||
import { useSiteMetadata } from '../../../../hooks/useSiteMetadata'
|
import { useSiteMetadata } from '../../../../../hooks/useSiteMetadata'
|
||||||
import { isCorrectNetwork } from '../../../../utils/wallet'
|
import { isCorrectNetwork } from '../../../../../utils/wallet'
|
||||||
import Alert from '../../../atoms/Alert'
|
import Alert from '../../../../atoms/Alert'
|
||||||
import FormHelp from '../../../atoms/Input/Help'
|
import FormHelp from '../../../../atoms/Input/Help'
|
||||||
import Tooltip from '../../../atoms/Tooltip'
|
import Tooltip from '../../../../atoms/Tooltip'
|
||||||
import Wallet from '../../../molecules/Wallet'
|
import Wallet from '../../../../molecules/Wallet'
|
||||||
import Coin from './Coin'
|
import Coin from './Coin'
|
||||||
import styles from './Dynamic.module.css'
|
import styles from './Dynamic.module.css'
|
||||||
import Fees from './Fees'
|
import Fees from './Fees'
|
||||||
import stylesIndex from './index.module.css'
|
import stylesIndex from './index.module.css'
|
||||||
import { useFormikContext } from 'formik'
|
import { useFormikContext } from 'formik'
|
||||||
import { PriceOptionsMarket } from '../../../../@types/MetaData'
|
import { PriceOptionsMarket } from '../../../../../@types/MetaData'
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function Dynamic({
|
export default function Dynamic({
|
@ -1,6 +1,6 @@
|
|||||||
import { FieldMetaProps } from 'formik'
|
import { FieldMetaProps } from 'formik'
|
||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import stylesInput from '../../../atoms/Input/index.module.css'
|
import stylesInput from '../../../../atoms/Input/index.module.css'
|
||||||
|
|
||||||
export default function Error({
|
export default function Error({
|
||||||
meta
|
meta
|
@ -1,8 +1,8 @@
|
|||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import Tooltip from '../../../atoms/Tooltip'
|
import Tooltip from '../../../../atoms/Tooltip'
|
||||||
import styles from './Fees.module.css'
|
import styles from './Fees.module.css'
|
||||||
import { useField } from 'formik'
|
import { useField } from 'formik'
|
||||||
import Input from '../../../atoms/Input'
|
import Input from '../../../../atoms/Input'
|
||||||
import Error from './Error'
|
import Error from './Error'
|
||||||
|
|
||||||
export default function Fees({
|
export default function Fees({
|
@ -1,10 +1,10 @@
|
|||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import stylesIndex from './index.module.css'
|
import stylesIndex from './index.module.css'
|
||||||
import styles from './Fixed.module.css'
|
import styles from './Fixed.module.css'
|
||||||
import FormHelp from '../../../atoms/Input/Help'
|
import FormHelp from '../../../../atoms/Input/Help'
|
||||||
import Conversion from '../../../atoms/Price/Conversion'
|
import Conversion from '../../../../atoms/Price/Conversion'
|
||||||
import { useField } from 'formik'
|
import { useField } from 'formik'
|
||||||
import Input from '../../../atoms/Input'
|
import Input from '../../../../atoms/Input'
|
||||||
import Error from './Error'
|
import Error from './Error'
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
import { usePricing } from '@oceanprotocol/react'
|
import { usePricing } from '@oceanprotocol/react'
|
@ -1,8 +1,6 @@
|
|||||||
.price {
|
.price {
|
||||||
margin: -2rem;
|
margin-top: -2rem;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
border-bottom: 1px solid var(--brand-grey-lighter);
|
|
||||||
padding-bottom: var(--spacer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
@ -1,13 +1,13 @@
|
|||||||
import React, { ReactElement, useEffect } from 'react'
|
import React, { ReactElement, useEffect } from 'react'
|
||||||
import { graphql, useStaticQuery } from 'gatsby'
|
import { graphql, useStaticQuery } from 'gatsby'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import Tabs from '../../../atoms/Tabs'
|
import Tabs from '../../../../atoms/Tabs'
|
||||||
import Fixed from './Fixed'
|
import Fixed from './Fixed'
|
||||||
import Dynamic from './Dynamic'
|
import Dynamic from './Dynamic'
|
||||||
import { useFormikContext } from 'formik'
|
import { useFormikContext } from 'formik'
|
||||||
import { useUserPreferences } from '../../../../providers/UserPreferences'
|
import { useUserPreferences } from '../../../../../providers/UserPreferences'
|
||||||
import { PriceOptionsMarket } from '../../../../@types/MetaData'
|
import { PriceOptionsMarket } from '../../../../../@types/MetaData'
|
||||||
import Button from '../../../atoms/Button'
|
import Button from '../../../../atoms/Button'
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
const query = graphql`
|
const query = graphql`
|
@ -1,5 +1,12 @@
|
|||||||
.pricing {
|
.pricing {
|
||||||
margin-bottom: var(--spacer);
|
margin-bottom: var(--spacer);
|
||||||
|
padding-bottom: var(--spacer);
|
||||||
|
border-bottom: 1px solid var(--brand-grey-lighter);
|
||||||
|
margin-left: -2rem;
|
||||||
|
margin-right: -2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedback {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 20vh;
|
min-height: 20vh;
|
||||||
display: flex;
|
display: flex;
|
@ -1,15 +1,14 @@
|
|||||||
import React, { FormEvent, ReactElement, useState } from 'react'
|
import React, { FormEvent, ReactElement, useState } from 'react'
|
||||||
import { Formik } from 'formik'
|
import { Formik } from 'formik'
|
||||||
import { initialValues, validationSchema } from '../../../models/FormPricing'
|
import { initialValues, validationSchema } from '../../../../models/FormPricing'
|
||||||
import { DDO, Logger } from '@oceanprotocol/lib'
|
import { DDO, Logger } from '@oceanprotocol/lib'
|
||||||
import { usePricing } from '@oceanprotocol/react'
|
import { usePricing } from '@oceanprotocol/react'
|
||||||
import { PriceOptionsMarket } from '../../../@types/MetaData'
|
import { PriceOptionsMarket } from '../../../../@types/MetaData'
|
||||||
import Alert from '../../atoms/Alert'
|
import Alert from '../../../atoms/Alert'
|
||||||
import styles from './Pricing.module.css'
|
import styles from './index.module.css'
|
||||||
import FormPricing from './FormPricing'
|
import FormPricing from './FormPricing'
|
||||||
import Loader from '../../atoms/Loader'
|
|
||||||
import SuccessConfetti from '../../atoms/SuccessConfetti'
|
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
|
import Feedback from './Feedback'
|
||||||
|
|
||||||
export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
|
export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
|
||||||
const {
|
const {
|
||||||
@ -63,11 +62,7 @@ export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
|
|||||||
>
|
>
|
||||||
{() =>
|
{() =>
|
||||||
hasFeedback ? (
|
hasFeedback ? (
|
||||||
success ? (
|
<Feedback success={success} pricingStepText={pricingStepText} />
|
||||||
<SuccessConfetti success={success} />
|
|
||||||
) : (
|
|
||||||
<Loader message={pricingStepText} />
|
|
||||||
)
|
|
||||||
) : showPricing ? (
|
) : showPricing ? (
|
||||||
<FormPricing ddo={ddo} setShowPricing={setShowPricing} />
|
<FormPricing ddo={ddo} setShowPricing={setShowPricing} />
|
||||||
) : (
|
) : (
|
Loading…
Reference in New Issue
Block a user