1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-30 22:01:44 +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 { DDO } from '@oceanprotocol/lib'
import { useUserPreferences } from '../../../providers/UserPreferences' import { useUserPreferences } from '../../../providers/UserPreferences'
import Pricing from './Pricing' import Pricing from './Pricing'
import { useOcean } from '@oceanprotocol/react'
export interface AssetContentProps { export interface AssetContentProps {
metadata: MetadataMarket metadata: MetadataMarket
@ -23,12 +24,17 @@ export default function AssetContent({
}: AssetContentProps): ReactElement { }: AssetContentProps): ReactElement {
const { datePublished } = metadata.main const { datePublished } = metadata.main
const { debug } = useUserPreferences() 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 ( return (
<article className={styles.grid}> <article className={styles.grid}>
<div className={styles.content}> <div className={styles.content}>
{/* TODO: check for ddo creator & no price */} {showPricing && <Pricing ddo={ddo} />}
<Pricing ddo={ddo} />
<aside className={styles.meta}> <aside className={styles.meta}>
<p>{datePublished && <Time date={datePublished} />}</p> <p>{datePublished && <Time date={datePublished} />}</p>