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

feature/add toggle option for fixed & dynamic pricing (#453)

* add toggle for create pricing option variable

* code refactor

* Minor fix from feedback
This commit is contained in:
Kris Liew 2021-03-24 20:27:32 +08:00 committed by GitHub
parent ed9eb61c1c
commit 30b4c77093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 11 deletions

View File

@ -4,4 +4,6 @@ GATSBY_NETWORK="rinkeby"
#GATSBY_INFURA_PROJECT_ID="xxx"
#GATSBY_MARKET_FEE_ADDRESS="0xxx"
#GATSBY_ANALYTICS_ID="xxx"
#GATSBY_PORTIS_ID="xxx"
#GATSBY_PORTIS_ID="xxx"
#GATSBY_ALLOW_FIXED_PRICING="true"
#GATSBY_ALLOW_DYNAMIC_PRICING="true"

View File

@ -38,5 +38,10 @@ module.exports = {
},
// Wallets
portisId: process.env.GATSBY_PORTIS_ID || 'xxx'
portisId: process.env.GATSBY_PORTIS_ID || 'xxx',
// Used to show or hide the fixed and dynamic price options
// tab to publishers during the price creation.
allowFixedPricing: process.env.GATSBY_ALLOW_FIXED_PRICING || 'true',
allowDynamicPricing: process.env.GATSBY_ALLOW_DYNAMIC_PRICING || 'true'
}

View File

@ -9,6 +9,7 @@ import { PriceOptionsMarket } from '../../../../../@types/MetaData'
import Button from '../../../../atoms/Button'
import { DDO } from '@oceanprotocol/lib'
import FormHelp from '../../../../atoms/Input/Help'
import { useSiteMetadata } from '../../../../../hooks/useSiteMetadata'
export default function FormPricing({
ddo,
@ -20,6 +21,7 @@ export default function FormPricing({
content: any
}): ReactElement {
const { debug } = useUserPreferences()
const { appConfig } = useSiteMetadata()
// Connect with form
const { values, setFieldValue, submitForm } = useFormikContext()
@ -49,15 +51,19 @@ export default function FormPricing({
}, [price, oceanAmount, weightOnOcean, weightOnDataToken, type])
const tabs = [
{
title: content.fixed.title,
content: <Fixed content={content.fixed} ddo={ddo} />
},
{
title: content.dynamic.title,
content: <Dynamic content={content.dynamic} ddo={ddo} />
}
]
appConfig.allowFixedPricing === 'true'
? {
title: content.fixed.title,
content: <Fixed content={content.fixed} ddo={ddo} />
}
: undefined,
appConfig.allowDynamicPricing === 'true'
? {
title: content.dynamic.title,
content: <Dynamic content={content.dynamic} ddo={ddo} />
}
: undefined
].filter((tab) => tab !== undefined)
return (
<>

View File

@ -22,6 +22,8 @@ const query = graphql`
marketFeeAddress
currencies
portisId
allowFixedPricing
allowDynamicPricing
}
}
}