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

consolidate all copy for price widget

This commit is contained in:
Matthias Kretschmann 2020-08-06 14:07:01 +02:00
parent 3811050fa6
commit 0d4e0599ac
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 65 additions and 38 deletions

View File

@ -90,8 +90,18 @@
], ],
"success": "Asset Created!" "success": "Asset Created!"
}, },
"price": {
"simple": {
"title": "Simple: Fixed",
"info": "Set your price for accessing this data set. A Data Token contract for this data set, worth the entered amount of OCEAN will be created."
},
"advanced": {
"title": "Advanced: Dynamic",
"info": "Let's create a decentralized, automated market for your data set. A Data Token contract for this data set worth the entered amount of OCEAN will be created. Additionally, you will provide liquidity into a Data Token/OCEAN liquidity pool with Balancer.",
"tooltips": { "tooltips": {
"poolInfo": "Help me", "poolInfo": "Help me",
"liquidityProviderFee": "Help me" "liquidityProviderFee": "Help me"
} }
}
}
} }

View File

@ -13,39 +13,21 @@ import InputElement from '../../../atoms/Input/InputElement'
import Label from '../../../atoms/Input/Label' import Label from '../../../atoms/Input/Label'
import Tooltip from '../../../atoms/Tooltip' import Tooltip from '../../../atoms/Tooltip'
const query = graphql`
query PriceAdvancedQuery {
tooltips: allFile(filter: { relativePath: { eq: "pages/publish.json" } }) {
edges {
node {
childPagesJson {
tooltips {
poolInfo
liquidityProviderFee
}
}
}
}
}
}
`
export default function Advanced({ export default function Advanced({
ocean, ocean,
tokensToMint, tokensToMint,
weightOnDataToken, weightOnDataToken,
liquidityProviderFee, liquidityProviderFee,
onOceanChange onOceanChange,
content
}: { }: {
ocean: string ocean: string
tokensToMint: number tokensToMint: number
weightOnDataToken: string weightOnDataToken: string
liquidityProviderFee: string liquidityProviderFee: string
onOceanChange: (event: ChangeEvent<HTMLInputElement>) => void onOceanChange: (event: ChangeEvent<HTMLInputElement>) => void
content: any
}): ReactElement { }): ReactElement {
const data = useStaticQuery(query)
const { tooltips } = data.tooltips.edges[0].node.childPagesJson
const { appConfig } = useSiteMetadata() const { appConfig } = useSiteMetadata()
const { account, balance, chainId, refreshBalance } = useOcean() const { account, balance, chainId, refreshBalance } = useOcean()
@ -83,10 +65,7 @@ export default function Advanced({
return ( return (
<div className={stylesIndex.content}> <div className={stylesIndex.content}>
<div className={styles.advanced}> <div className={styles.advanced}>
<FormHelp className={stylesIndex.help}> <FormHelp className={stylesIndex.help}>{content.info}</FormHelp>
{`Let's create a decentralized, automated market for your data set. A Data Token contract for this data set worth the entered amount of OCEAN will be created. Additionally, you will provide liquidity into a Data Token/OCEAN
liquidity pool with Balancer.`}
</FormHelp>
<aside className={styles.wallet}> <aside className={styles.wallet}>
{balance && balance.ocean && ( {balance && balance.ocean && (
@ -98,7 +77,8 @@ export default function Advanced({
</aside> </aside>
<h4 className={styles.title}> <h4 className={styles.title}>
Data Token Liquidity Pool <Tooltip content={tooltips.poolInfo} /> Data Token Liquidity Pool{' '}
<Tooltip content={content.tooltips.poolInfo} />
</h4> </h4>
<div className={styles.tokens}> <div className={styles.tokens}>
@ -121,7 +101,7 @@ export default function Advanced({
<footer className={styles.summary}> <footer className={styles.summary}>
<Label htmlFor="liquidityProviderFee"> <Label htmlFor="liquidityProviderFee">
Liquidity Provider Fee{' '} Liquidity Provider Fee{' '}
<Tooltip content={tooltips.liquidityProviderFee} /> <Tooltip content={content.tooltips.liquidityProviderFee} />
</Label> </Label>
<InputElement <InputElement
value={liquidityProviderFee} value={liquidityProviderFee}

View File

@ -8,18 +8,17 @@ import Conversion from '../../../atoms/Price/Conversion'
export default function Simple({ export default function Simple({
ocean, ocean,
onChange onChange,
content
}: { }: {
ocean: string ocean: string
onChange: (event: ChangeEvent<HTMLInputElement>) => void onChange: (event: ChangeEvent<HTMLInputElement>) => void
content: any
}): ReactElement { }): ReactElement {
return ( return (
<div className={stylesIndex.content}> <div className={stylesIndex.content}>
<div className={styles.simple}> <div className={styles.simple}>
<FormHelp className={stylesIndex.help}> <FormHelp className={stylesIndex.help}>{content.info}</FormHelp>
Set your price for accessing this data set. A Data Token contract for
this data set, worth the entered amount of OCEAN will be created.
</FormHelp>
<div className={styles.form}> <div className={styles.form}>
<Label htmlFor="ocean">Ocean Tokens</Label> <Label htmlFor="ocean">Ocean Tokens</Label>

View File

@ -1,4 +1,5 @@
import React, { ReactElement, useState, ChangeEvent, useEffect } from 'react' import React, { ReactElement, useState, ChangeEvent, useEffect } from 'react'
import { graphql, useStaticQuery } from 'gatsby'
import { InputProps } from '../../../atoms/Input' import { InputProps } from '../../../atoms/Input'
import styles from './index.module.css' import styles from './index.module.css'
import Tabs from '../../../atoms/Tabs' import Tabs from '../../../atoms/Tabs'
@ -6,7 +7,37 @@ import Simple from './Simple'
import Advanced from './Advanced' import Advanced from './Advanced'
import { useField } from 'formik' import { useField } from 'formik'
const query = graphql`
query PriceFieldQuery {
content: allFile(filter: { relativePath: { eq: "pages/publish.json" } }) {
edges {
node {
childPagesJson {
price {
simple {
title
info
}
advanced {
title
info
tooltips {
poolInfo
liquidityProviderFee
}
}
}
}
}
}
}
}
`
export default function Price(props: InputProps): ReactElement { export default function Price(props: InputProps): ReactElement {
const data = useStaticQuery(query)
const content = data.content.edges[0].node.childPagesJson.price
const [field, meta, helpers] = useField(props) const [field, meta, helpers] = useField(props)
const { weightOnDataToken, liquidityProviderFee } = field.value const { weightOnDataToken, liquidityProviderFee } = field.value
@ -31,11 +62,17 @@ export default function Price(props: InputProps): ReactElement {
const tabs = [ const tabs = [
{ {
title: 'Simple: Fixed', title: content.simple.title,
content: <Simple ocean={ocean} onChange={handleOceanChange} /> content: (
<Simple
ocean={ocean}
onChange={handleOceanChange}
content={content.simple}
/>
)
}, },
{ {
title: 'Advanced: Dynamic', title: content.advanced.title,
content: ( content: (
<Advanced <Advanced
ocean={ocean} ocean={ocean}
@ -43,6 +80,7 @@ export default function Price(props: InputProps): ReactElement {
weightOnDataToken={weightOnDataToken} weightOnDataToken={weightOnDataToken}
onOceanChange={handleOceanChange} onOceanChange={handleOceanChange}
liquidityProviderFee={liquidityProviderFee} liquidityProviderFee={liquidityProviderFee}
content={content.advanced}
/> />
) )
} }