1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-26 03:06:49 +02:00

add owner & price check

This commit is contained in:
Matthias Kretschmann 2020-10-20 18:33:24 +02:00
parent 8454bf9cc7
commit 1905e5b869
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -10,6 +10,7 @@ import AssetActions from '../AssetActions'
import { DDO } from '@oceanprotocol/lib'
import { useUserPreferences } from '../../../providers/UserPreferences'
import Pricing from './Pricing'
import { useOcean } from '@oceanprotocol/react'
export interface AssetContentProps {
metadata: MetadataMarket
@ -23,12 +24,17 @@ export default function AssetContent({
}: AssetContentProps): ReactElement {
const { datePublished } = metadata.main
const { debug } = useUserPreferences()
const { accountId } = useOcean()
const isOwner = accountId === ddo.publicKey[0].owner
// TODO: check if assets without price actually have ddo.price or not
const hasPrice = typeof ddo.price !== 'undefined'
const showPricing = isOwner && !hasPrice
return (
<article className={styles.grid}>
<div className={styles.content}>
{/* TODO: check for ddo creator & no price */}
<Pricing ddo={ddo} />
{showPricing && <Pricing ddo={ddo} />}
<aside className={styles.meta}>
<p>{datePublished && <Time date={datePublished} />}</p>