1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-26 03:06:49 +02:00
market/src/components/organisms/AssetContent/index.tsx

76 lines
2.1 KiB
TypeScript
Raw Normal View History

2020-10-01 17:13:19 +02:00
import { MetadataMarket } from '../../../@types/MetaData'
import React, { ReactElement } from 'react'
import Time from '../../atoms/Time'
import { Link } from 'gatsby'
import Markdown from '../../atoms/Markdown'
import MetaFull from './MetaFull'
import MetaSecondary from './MetaSecondary'
2020-07-07 09:43:45 +02:00
import styles from './index.module.css'
2020-07-08 17:57:53 +02:00
import AssetActions from '../AssetActions'
2020-07-21 14:04:32 +02:00
import { DDO } from '@oceanprotocol/lib'
2020-09-09 16:07:37 +02:00
import { useUserPreferences } from '../../../providers/UserPreferences'
2020-10-20 13:10:03 +02:00
import Pricing from './Pricing'
export interface AssetContentProps {
2020-07-16 13:39:02 +02:00
metadata: MetadataMarket
2020-07-21 13:21:22 +02:00
ddo: DDO
path?: string
}
export default function AssetContent({
metadata,
2020-07-21 13:21:22 +02:00
ddo
}: AssetContentProps): ReactElement {
const { datePublished } = metadata.main
2020-09-09 16:07:37 +02:00
const { debug } = useUserPreferences()
return (
<article className={styles.grid}>
2020-07-15 14:45:08 +02:00
<div className={styles.content}>
2020-10-20 16:59:29 +02:00
{/* TODO: check for ddo creator & no price */}
2020-10-20 13:10:03 +02:00
<Pricing ddo={ddo} />
<aside className={styles.meta}>
2020-07-07 23:00:16 +02:00
<p>{datePublished && <Time date={datePublished} />}</p>
{metadata?.additionalInformation?.categories?.length && (
<p>
<Link
to={`/search?categories=["${metadata?.additionalInformation?.categories[0]}"]`}
>
{metadata?.additionalInformation?.categories[0]}
</Link>
</p>
)}
</aside>
<Markdown text={metadata?.additionalInformation?.description || ''} />
2020-07-08 00:06:48 +02:00
<MetaSecondary metadata={metadata} />
<MetaFull ddo={ddo} metadata={metadata} />
2020-07-08 00:06:48 +02:00
<div className={styles.buttonGroup}>
{/* <EditAction
ddo={ddo}
ocean={ocean}
account={account}
refetchMetadata={refetchMetadata}
/> */}
{/* <DeleteAction ddo={ddo} /> */}
</div>
2020-08-03 12:04:03 +02:00
2020-09-09 16:07:37 +02:00
{debug === true && (
<pre>
<code>{JSON.stringify(ddo, null, 2)}</code>
</pre>
)}
</div>
<div>
<div className={styles.sticky}>
2020-08-26 08:48:22 +02:00
<AssetActions ddo={ddo} />
</div>
</div>
</article>
)
}