1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-26 03:06:49 +02:00
market/src/components/atoms/Price/index.tsx

42 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-09-02 11:43:15 +02:00
import React, { ReactElement } from 'react'
2020-07-13 23:45:20 +02:00
import styles from './index.module.css'
import { BestPrice } from '@oceanprotocol/lib'
2020-08-07 18:12:39 +02:00
import Loader from '../Loader'
import Tooltip from '../Tooltip'
import PriceUnit from './PriceUnit'
2020-07-07 23:00:16 +02:00
2020-05-07 08:03:30 +02:00
export default function Price({
price,
2020-05-25 14:53:38 +02:00
className,
2020-08-11 07:34:32 +02:00
small,
2020-08-20 14:22:32 +02:00
conversion
2020-05-07 08:03:30 +02:00
}: {
price: BestPrice
2020-05-07 08:03:30 +02:00
className?: string
2020-05-25 14:53:38 +02:00
small?: boolean
conversion?: boolean
2020-07-07 23:00:16 +02:00
}): ReactElement {
return price?.value || price?.type === 'free' ? (
2020-10-30 14:10:21 +01:00
<PriceUnit
price={`${price.value}`}
className={className}
small={small}
conversion={conversion}
type={price.type}
/>
) : !price || price?.type === '' ? (
2020-08-07 18:20:08 +02:00
<div className={styles.empty}>
2021-03-01 16:08:50 +01:00
No price set{' '}
2021-03-01 16:24:55 +01:00
<Tooltip content="No pricing mechanism has been set on this asset yet." />
2020-08-07 18:12:39 +02:00
</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>
2020-08-07 18:12:39 +02:00
<Loader message="Retrieving price..." />
)
2020-05-07 08:03:30 +02:00
}