1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

changed way to get accessType, asset type declaration

This commit is contained in:
Norbi 2021-02-25 13:46:20 +02:00
parent a9e1ff1dbb
commit bee7c1ecbf
4 changed files with 15 additions and 21 deletions

View File

@ -19,7 +19,8 @@ const AssetTeaser: React.FC<AssetTeaserProps> = ({ ddo }: AssetTeaserProps) => {
const { attributes } = ddo.findServiceByType('metadata') const { attributes } = ddo.findServiceByType('metadata')
const { name, type } = attributes.main const { name, type } = attributes.main
const { dataTokenInfo } = ddo const { dataTokenInfo } = ddo
const accessType = ddo.service[1].type const isCompute = Boolean(ddo?.findServiceByType('compute'))
const accessType = isCompute ? 'compute' : 'access'
return ( return (
<article className={`${styles.teaser} ${styles[type]}`}> <article className={`${styles.teaser} ${styles[type]}`}>

View File

@ -157,25 +157,17 @@ export default function Consume({
<div className={styles.filewrapper}> <div className={styles.filewrapper}>
<File file={file} /> <File file={file} />
</div> </div>
{type === 'algorithm' ? ( <div className={styles.pricewrapper}>
<div className={styles.pricewrapper}> {isConsumable ? (
This asset can not be downloaded, it can only be used in a compute <Price ddo={ddo} conversion />
job ) : (
</div> <div className={styles.help}>
) : ( There is not enough liquidity in the pool to buy this data set.
<div className={styles.pricewrapper}> </div>
{isConsumable ? ( )}
<Price ddo={ddo} conversion /> {!isInPurgatory && <PurchaseButton />}
) : ( </div>
<div className={styles.help}>
There is not enough liquidity in the pool to buy this data set.
</div>
)}
{!isInPurgatory && <PurchaseButton />}
</div>
)}
</div> </div>
<footer className={styles.feedback}> <footer className={styles.feedback}>
<Web3Feedback isBalanceSufficient={isBalanceSufficient} /> <Web3Feedback isBalanceSufficient={isBalanceSufficient} />
</footer> </footer>

View File

@ -10,7 +10,8 @@ import AssetType from '../../atoms/AssetType'
export default function MetaMain(): ReactElement { export default function MetaMain(): ReactElement {
const { ddo, owner, type } = useAsset() const { ddo, owner, type } = useAsset()
const { networkId } = useOcean() const { networkId } = useOcean()
const accessType = ddo.service[1].type const isCompute = Boolean(ddo?.findServiceByType('compute'))
const accessType = isCompute ? 'compute' : 'access'
return ( return (
<aside className={styles.meta}> <aside className={styles.meta}>

View File

@ -25,7 +25,7 @@ interface AssetProviderValue {
title: string | undefined title: string | undefined
owner: string | undefined owner: string | undefined
price: BestPrice | undefined price: BestPrice | undefined
type: string | undefined type: 'dataset' | 'algorithm' | undefined
error?: string error?: string
refreshInterval: number refreshInterval: number
refreshDdo: (token?: CancelToken) => Promise<void> refreshDdo: (token?: CancelToken) => Promise<void>