mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Adding fees to fixed pricing page (#758)
* Adding fess to fixed pricing page * Adding tooltips to fixed price content * Styling: Text align left * create pricing styling updates * remove console.log Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
This commit is contained in:
parent
0227b4f084
commit
60cac45e89
@ -10,7 +10,11 @@
|
|||||||
},
|
},
|
||||||
"fixed": {
|
"fixed": {
|
||||||
"title": "Fixed",
|
"title": "Fixed",
|
||||||
"info": "Set your price for accessing this data set. The datatoken for this data set will be worth the entered amount of OCEAN."
|
"info": "Set your price for accessing this data set. The datatoken for this data set will be worth the entered amount of OCEAN.",
|
||||||
|
"tooltips": {
|
||||||
|
"communityFee": "Explain community fee...",
|
||||||
|
"marketplaceFee": "Explain marketplace fee..."
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"dynamic": {
|
"dynamic": {
|
||||||
"title": "Dynamic",
|
"title": "Dynamic",
|
||||||
|
@ -45,7 +45,8 @@
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action {
|
.action,
|
||||||
|
button.action {
|
||||||
margin-top: calc(var(--spacer) / 2);
|
margin-top: calc(var(--spacer) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ export default function Dynamic({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Fees tooltips={content.tooltips} />
|
<Fees tooltips={content.tooltips} pricingType="dynamic" />
|
||||||
|
|
||||||
<footer className={styles.summary}>
|
<footer className={styles.summary}>
|
||||||
You will get: <br />
|
You will get: <br />
|
||||||
|
@ -5,14 +5,18 @@
|
|||||||
margin-left: -2rem;
|
margin-left: -2rem;
|
||||||
margin-right: -2rem;
|
margin-right: -2rem;
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--border-color);
|
||||||
padding: var(--spacer) var(--spacer) calc(var(--spacer) / 2) var(--spacer);
|
padding: var(--spacer);
|
||||||
|
|
||||||
justify-content: center;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--border-color);
|
||||||
background: var(--background-highlight);
|
background: var(--background-highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fees > div {
|
||||||
|
margin-bottom: 0;
|
||||||
|
justify-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
.fees label {
|
.fees label {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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, useFormikContext } from 'formik'
|
import { useField } from 'formik'
|
||||||
import Input from '../../../../atoms/Input'
|
import Input from '../../../../atoms/Input'
|
||||||
import Error from './Error'
|
import Error from './Error'
|
||||||
|
|
||||||
@ -30,31 +30,35 @@ const Default = ({
|
|||||||
)
|
)
|
||||||
|
|
||||||
export default function Fees({
|
export default function Fees({
|
||||||
tooltips
|
tooltips,
|
||||||
|
pricingType
|
||||||
}: {
|
}: {
|
||||||
tooltips: { [key: string]: string }
|
tooltips: { [key: string]: string }
|
||||||
|
pricingType: 'dynamic' | 'fixed'
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const [field, meta] = useField('swapFee')
|
const [field, meta] = useField('swapFee')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.fees}>
|
<div className={styles.fees}>
|
||||||
<Input
|
{pricingType === 'dynamic' && (
|
||||||
label={
|
<Input
|
||||||
<>
|
label={
|
||||||
Swap Fee
|
<>
|
||||||
<Tooltip content={tooltips.swapFee} />
|
Swap Fee
|
||||||
</>
|
<Tooltip content={tooltips.swapFee} />
|
||||||
}
|
</>
|
||||||
type="number"
|
}
|
||||||
postfix="%"
|
type="number"
|
||||||
min="0.1"
|
postfix="%"
|
||||||
max="10"
|
min="0.1"
|
||||||
step="0.1"
|
max="10"
|
||||||
size="small"
|
step="0.1"
|
||||||
{...field}
|
size="small"
|
||||||
additionalComponent={<Error meta={meta} />}
|
{...field}
|
||||||
/>
|
additionalComponent={<Error meta={meta} />}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<Default
|
<Default
|
||||||
title="Community Fee"
|
title="Community Fee"
|
||||||
|
@ -4,6 +4,7 @@ import styles from './Fixed.module.css'
|
|||||||
import FormHelp from '../../../../atoms/Input/Help'
|
import FormHelp from '../../../../atoms/Input/Help'
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
import Price from './Price'
|
import Price from './Price'
|
||||||
|
import Fees from './Fees'
|
||||||
|
|
||||||
export default function Fixed({
|
export default function Fixed({
|
||||||
ddo,
|
ddo,
|
||||||
@ -16,6 +17,7 @@ export default function Fixed({
|
|||||||
<div className={styles.fixed}>
|
<div className={styles.fixed}>
|
||||||
<FormHelp className={stylesIndex.help}>{content.info}</FormHelp>
|
<FormHelp className={stylesIndex.help}>{content.info}</FormHelp>
|
||||||
<Price ddo={ddo} />
|
<Price ddo={ddo} />
|
||||||
|
<Fees tooltips={content.tooltips} pricingType="fixed" />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,17 +2,13 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 55rem) {
|
.form * {
|
||||||
.form {
|
margin-bottom: 0;
|
||||||
max-width: 12rem;
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.price {
|
.price {
|
||||||
margin-left: -2rem;
|
margin-left: -2rem;
|
||||||
margin-right: -2rem;
|
margin-right: -2rem;
|
||||||
padding-top: var(--spacer);
|
|
||||||
background: var(--background-highlight);
|
background: var(--background-highlight);
|
||||||
border-top: 1px solid var(--border-color);
|
border-top: 1px solid var(--border-color);
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--border-color);
|
||||||
@ -20,9 +16,13 @@
|
|||||||
|
|
||||||
.grid {
|
.grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--spacer);
|
gap: calc(var(--spacer) / 2);
|
||||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||||
justify-content: center;
|
padding: var(--spacer);
|
||||||
|
max-width: 30rem;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed label {
|
.fixed label {
|
||||||
@ -30,7 +30,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.datatoken {
|
.datatoken {
|
||||||
margin-top: calc(var(--spacer) / 2);
|
|
||||||
color: var(--color-secondary);
|
color: var(--color-secondary);
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
font-weight: var(--font-weight-bold);
|
font-weight: var(--font-weight-bold);
|
||||||
@ -50,7 +49,6 @@
|
|||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
color: var(--color-secondary);
|
color: var(--color-secondary);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-top: -1rem;
|
|
||||||
padding-top: calc(var(--spacer) / 3);
|
padding-top: calc(var(--spacer) / 3);
|
||||||
padding-bottom: calc(var(--spacer) / 3);
|
padding-bottom: calc(var(--spacer) / 3);
|
||||||
border-top: 1px solid var(--border-color);
|
border-top: 1px solid var(--border-color);
|
||||||
@ -59,3 +57,7 @@
|
|||||||
.firstPrice div {
|
.firstPrice div {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.conversion strong {
|
||||||
|
color: var(--color-secondary);
|
||||||
|
}
|
||||||
|
@ -2,11 +2,11 @@ import Conversion from '../../../../atoms/Price/Conversion'
|
|||||||
import { useField } from 'formik'
|
import { useField } from 'formik'
|
||||||
import React, { ReactElement, useState, useEffect } from 'react'
|
import React, { ReactElement, useState, useEffect } from 'react'
|
||||||
import Input from '../../../../atoms/Input'
|
import Input from '../../../../atoms/Input'
|
||||||
import styles from './Price.module.css'
|
|
||||||
import Error from './Error'
|
import Error from './Error'
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
import PriceUnit from '../../../../atoms/Price/PriceUnit'
|
import PriceUnit from '../../../../atoms/Price/PriceUnit'
|
||||||
import usePricing from '../../../../../hooks/usePricing'
|
import usePricing from '../../../../../hooks/usePricing'
|
||||||
|
import styles from './Price.module.css'
|
||||||
|
|
||||||
export default function Price({
|
export default function Price({
|
||||||
ddo,
|
ddo,
|
||||||
@ -56,16 +56,14 @@ export default function Price({
|
|||||||
prefix="OCEAN"
|
prefix="OCEAN"
|
||||||
min="1"
|
min="1"
|
||||||
{...field}
|
{...field}
|
||||||
additionalComponent={
|
|
||||||
<Conversion price={field.value} className={styles.conversion} />
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Error meta={meta} />
|
<Error meta={meta} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.datatoken}>
|
<div className={styles.datatoken}>
|
||||||
<h4>
|
<h4>
|
||||||
= <strong>1</strong> {dtName} — {dtSymbol}
|
= <strong>1</strong> {dtSymbol}{' '}
|
||||||
|
<Conversion price={field.value} className={styles.conversion} />
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,12 +4,12 @@ import { initialValues, validationSchema } from '../../../../models/FormPricing'
|
|||||||
import { DDO, Logger } from '@oceanprotocol/lib'
|
import { DDO, Logger } from '@oceanprotocol/lib'
|
||||||
import { PriceOptionsMarket } from '../../../../@types/MetaData'
|
import { PriceOptionsMarket } from '../../../../@types/MetaData'
|
||||||
import Alert from '../../../atoms/Alert'
|
import Alert from '../../../atoms/Alert'
|
||||||
import styles from './index.module.css'
|
|
||||||
import FormPricing from './FormPricing'
|
import FormPricing from './FormPricing'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import Feedback from './Feedback'
|
import Feedback from './Feedback'
|
||||||
import { graphql, useStaticQuery } from 'gatsby'
|
import { graphql, useStaticQuery } from 'gatsby'
|
||||||
import { usePricing } from '../../../../hooks/usePricing'
|
import { usePricing } from '../../../../hooks/usePricing'
|
||||||
|
import styles from './index.module.css'
|
||||||
|
|
||||||
const query = graphql`
|
const query = graphql`
|
||||||
query PricingQuery {
|
query PricingQuery {
|
||||||
@ -29,6 +29,10 @@ const query = graphql`
|
|||||||
fixed {
|
fixed {
|
||||||
title
|
title
|
||||||
info
|
info
|
||||||
|
tooltips {
|
||||||
|
communityFee
|
||||||
|
marketplaceFee
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dynamic {
|
dynamic {
|
||||||
title
|
title
|
||||||
|
Loading…
Reference in New Issue
Block a user