1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-17 01:43:23 +02:00
market/src/components/atoms/Price/index.tsx
Kris Liew e02babf2c2
[EPIC] Free Pricing (#681)
* Free Pricing Option at create Pricing (#621)

* Free Pricing Option + env var toggle

* Create Pricing step msg

* Default 'allowFreePricing' to true temp for review

* Fix price 0 on free tab

* Attempt fix useSiteMetadata

* Fix linting

* Feature/free price support consume compute (#654)

* Update fetch free price

* Feedback change UI remove 0's

* update button msg && fix

* compute algorithm list show 'Free' instead of '0'

* updateMetadata() v3 workaround solution for free pricing (#677)

* compute algorithm list show 'Free' instead of '0'

* workaround editMetaData free price

* utils function for compute & download

* `allowFreePricing` default to false
2021-06-16 09:32:11 +08:00

42 lines
1.1 KiB
TypeScript

import React, { ReactElement } from 'react'
import styles from './index.module.css'
import { BestPrice } from '@oceanprotocol/lib'
import Loader from '../Loader'
import Tooltip from '../Tooltip'
import PriceUnit from './PriceUnit'
export default function Price({
price,
className,
small,
conversion
}: {
price: BestPrice
className?: string
small?: boolean
conversion?: boolean
}): ReactElement {
return price?.value || price?.type === 'free' ? (
<PriceUnit
price={`${price.value}`}
className={className}
small={small}
conversion={conversion}
type={price.type}
/>
) : !price || price?.type === '' ? (
<div className={styles.empty}>
No price set{' '}
<Tooltip content="No pricing mechanism has been set on this asset yet." />
</div>
) : (
// TODO: Hacky hack, put back some check for low liquidity
// ) : price.isConsumable !== 'true' ? (
// <div className={styles.empty}>
// Low liquidity{' '}
// <Tooltip content="This pool does not have enough liquidity for using this data set." />
// </div>
<Loader message="Retrieving price..." />
)
}