mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
add owner & price check
This commit is contained in:
parent
8454bf9cc7
commit
1905e5b869
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user