mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 01:34:57 +01:00
hide pool for simple pricing
This commit is contained in:
parent
71e4afe42a
commit
63fe171dd7
@ -2,25 +2,20 @@ import React, { ReactElement, useState, useEffect } from 'react'
|
|||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import Compute from './Compute'
|
import Compute from './Compute'
|
||||||
import Consume from './Consume'
|
import Consume from './Consume'
|
||||||
import { MetadataMarket } from '../../../@types/Metadata'
|
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
import Tabs from '../../atoms/Tabs'
|
import Tabs from '../../atoms/Tabs'
|
||||||
import { useOcean, useMetadata } from '@oceanprotocol/react'
|
import { useOcean, useMetadata } from '@oceanprotocol/react'
|
||||||
import compareAsBN from '../../../utils/compareAsBN'
|
import compareAsBN from '../../../utils/compareAsBN'
|
||||||
import Pool from './Pool'
|
import Pool from './Pool'
|
||||||
|
|
||||||
export default function AssetActions({
|
export default function AssetActions({ ddo }: { ddo: DDO }): ReactElement {
|
||||||
metadata,
|
|
||||||
ddo
|
|
||||||
}: {
|
|
||||||
metadata: MetadataMarket
|
|
||||||
ddo: DDO
|
|
||||||
}): ReactElement {
|
|
||||||
const { balance } = useOcean()
|
const { balance } = useOcean()
|
||||||
const { price } = useMetadata(ddo)
|
const { price } = useMetadata(ddo)
|
||||||
const [isBalanceSufficient, setIsBalanceSufficient] = useState<boolean>()
|
const [isBalanceSufficient, setIsBalanceSufficient] = useState<boolean>()
|
||||||
|
|
||||||
const isCompute = Boolean(ddo.findServiceByType('compute'))
|
const isCompute = Boolean(ddo.findServiceByType('compute'))
|
||||||
|
const { attributes } = ddo.findServiceByType('metadata')
|
||||||
|
const { priceType } = attributes.additionalInformation
|
||||||
|
|
||||||
// Check user balance against price
|
// Check user balance against price
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -40,7 +35,7 @@ export default function AssetActions({
|
|||||||
<Consume
|
<Consume
|
||||||
ddo={ddo}
|
ddo={ddo}
|
||||||
isBalanceSufficient={isBalanceSufficient}
|
isBalanceSufficient={isBalanceSufficient}
|
||||||
file={metadata.main.files[0]}
|
file={attributes.main.files[0]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -49,7 +44,7 @@ export default function AssetActions({
|
|||||||
title: 'Use',
|
title: 'Use',
|
||||||
content: UseContent
|
content: UseContent
|
||||||
},
|
},
|
||||||
{
|
(!priceType || priceType === 'advanced') && {
|
||||||
title: 'Pool',
|
title: 'Pool',
|
||||||
content: <Pool ddo={ddo} />
|
content: <Pool ddo={ddo} />
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ export default function AssetContent({
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className={styles.sticky}>
|
<div className={styles.sticky}>
|
||||||
<AssetActions metadata={metadata} ddo={ddo} />
|
<AssetActions ddo={ddo} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
Loading…
Reference in New Issue
Block a user