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:
parent
ed9eb61c1c
commit
30b4c77093
@ -5,3 +5,5 @@ GATSBY_NETWORK="rinkeby"
|
|||||||
#GATSBY_MARKET_FEE_ADDRESS="0xxx"
|
#GATSBY_MARKET_FEE_ADDRESS="0xxx"
|
||||||
#GATSBY_ANALYTICS_ID="xxx"
|
#GATSBY_ANALYTICS_ID="xxx"
|
||||||
#GATSBY_PORTIS_ID="xxx"
|
#GATSBY_PORTIS_ID="xxx"
|
||||||
|
#GATSBY_ALLOW_FIXED_PRICING="true"
|
||||||
|
#GATSBY_ALLOW_DYNAMIC_PRICING="true"
|
@ -38,5 +38,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Wallets
|
// 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'
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ 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'
|
||||||
import FormHelp from '../../../../atoms/Input/Help'
|
import FormHelp from '../../../../atoms/Input/Help'
|
||||||
|
import { useSiteMetadata } from '../../../../../hooks/useSiteMetadata'
|
||||||
|
|
||||||
export default function FormPricing({
|
export default function FormPricing({
|
||||||
ddo,
|
ddo,
|
||||||
@ -20,6 +21,7 @@ export default function FormPricing({
|
|||||||
content: any
|
content: any
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { debug } = useUserPreferences()
|
const { debug } = useUserPreferences()
|
||||||
|
const { appConfig } = useSiteMetadata()
|
||||||
|
|
||||||
// Connect with form
|
// Connect with form
|
||||||
const { values, setFieldValue, submitForm } = useFormikContext()
|
const { values, setFieldValue, submitForm } = useFormikContext()
|
||||||
@ -49,15 +51,19 @@ export default function FormPricing({
|
|||||||
}, [price, oceanAmount, weightOnOcean, weightOnDataToken, type])
|
}, [price, oceanAmount, weightOnOcean, weightOnDataToken, type])
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
appConfig.allowFixedPricing === 'true'
|
||||||
|
? {
|
||||||
title: content.fixed.title,
|
title: content.fixed.title,
|
||||||
content: <Fixed content={content.fixed} ddo={ddo} />
|
content: <Fixed content={content.fixed} ddo={ddo} />
|
||||||
},
|
}
|
||||||
{
|
: undefined,
|
||||||
|
appConfig.allowDynamicPricing === 'true'
|
||||||
|
? {
|
||||||
title: content.dynamic.title,
|
title: content.dynamic.title,
|
||||||
content: <Dynamic content={content.dynamic} ddo={ddo} />
|
content: <Dynamic content={content.dynamic} ddo={ddo} />
|
||||||
}
|
}
|
||||||
]
|
: undefined
|
||||||
|
].filter((tab) => tab !== undefined)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -22,6 +22,8 @@ const query = graphql`
|
|||||||
marketFeeAddress
|
marketFeeAddress
|
||||||
currencies
|
currencies
|
||||||
portisId
|
portisId
|
||||||
|
allowFixedPricing
|
||||||
|
allowDynamicPricing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user