diff --git a/.env.example b/.env.example index b8cc2fe43..7d5fd03a5 100644 --- a/.env.example +++ b/.env.example @@ -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" \ No newline at end of file +#GATSBY_PORTIS_ID="xxx" +#GATSBY_ALLOW_FIXED_PRICING="true" +#GATSBY_ALLOW_DYNAMIC_PRICING="true" \ No newline at end of file diff --git a/app.config.js b/app.config.js index 72da2d53c..722d0239d 100644 --- a/app.config.js +++ b/app.config.js @@ -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' } diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx index e9e64a28e..97ff35336 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx @@ -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: - }, - { - title: content.dynamic.title, - content: - } - ] + appConfig.allowFixedPricing === 'true' + ? { + title: content.fixed.title, + content: + } + : undefined, + appConfig.allowDynamicPricing === 'true' + ? { + title: content.dynamic.title, + content: + } + : undefined + ].filter((tab) => tab !== undefined) return ( <> diff --git a/src/hooks/useSiteMetadata.ts b/src/hooks/useSiteMetadata.ts index 3bf28f5da..c88be60cf 100644 --- a/src/hooks/useSiteMetadata.ts +++ b/src/hooks/useSiteMetadata.ts @@ -22,6 +22,8 @@ const query = graphql` marketFeeAddress currencies portisId + allowFixedPricing + allowDynamicPricing } } }