mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
metadata display tweaks
This commit is contained in:
parent
2fdad243b4
commit
7113db6419
@ -57,7 +57,8 @@
|
|||||||
{
|
{
|
||||||
"name": "copyrightHolder",
|
"name": "copyrightHolder",
|
||||||
"label": "Copyright Holder",
|
"label": "Copyright Holder",
|
||||||
"placeholder": "e.g. Marine Institute of Jellyfish"
|
"placeholder": "e.g. Marine Institute of Jellyfish",
|
||||||
|
"help": "Add this if the holder of the copyright is different from the author."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tags",
|
"name": "tags",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.metaFull {
|
.metaFull {
|
||||||
margin-top: calc(var(--spacer) * 2);
|
margin-top: var(--spacer);
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--spacer);
|
gap: var(--spacer);
|
||||||
|
@ -4,8 +4,6 @@ import MetaItem from './MetaItem'
|
|||||||
import styles from './MetaFull.module.css'
|
import styles from './MetaFull.module.css'
|
||||||
import { MetadataMarket } from '../../../@types/MetaData'
|
import { MetadataMarket } from '../../../@types/MetaData'
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
import EtherscanLink from '../../atoms/EtherscanLink'
|
|
||||||
import { useOcean, usePricing } from '@oceanprotocol/react'
|
|
||||||
|
|
||||||
export default function MetaFull({
|
export default function MetaFull({
|
||||||
ddo,
|
ddo,
|
||||||
@ -14,15 +12,12 @@ export default function MetaFull({
|
|||||||
ddo: DDO
|
ddo: DDO
|
||||||
metadata: MetadataMarket
|
metadata: MetadataMarket
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { networkId } = useOcean()
|
const { id } = ddo
|
||||||
const { id, dataToken } = ddo
|
const { dateCreated, datePublished, license } = metadata.main
|
||||||
const { dateCreated, datePublished, author, license } = metadata.main
|
|
||||||
const { dtSymbol, dtName } = usePricing(ddo)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.metaFull}>
|
<div className={styles.metaFull}>
|
||||||
<MetaItem title="Author" content={author} />
|
<MetaItem title="Author" content={metadata?.main.author} />
|
||||||
|
|
||||||
{metadata?.additionalInformation?.copyrightHolder && (
|
{metadata?.additionalInformation?.copyrightHolder && (
|
||||||
<MetaItem
|
<MetaItem
|
||||||
title="Copyright Holder"
|
title="Copyright Holder"
|
||||||
@ -40,21 +35,7 @@ export default function MetaFull({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<MetaItem title="Data Created" content={<Time date={dateCreated} />} />
|
<MetaItem title="Data Created" content={<Time date={dateCreated} />} />
|
||||||
|
<MetaItem title="Published" content={<Time date={datePublished} />} />
|
||||||
<MetaItem
|
|
||||||
title="Data Published"
|
|
||||||
content={<Time date={datePublished} />}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<MetaItem
|
|
||||||
title="Datatoken"
|
|
||||||
content={
|
|
||||||
<EtherscanLink networkId={networkId} path={`token/${dataToken}`}>
|
|
||||||
{dtName ? `${dtName} - ${dtSymbol}` : <code>{dataToken}</code>}
|
|
||||||
</EtherscanLink>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<MetaItem title="DID" content={<code>{id}</code>} />
|
<MetaItem title="DID" content={<code>{id}</code>} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -14,3 +14,7 @@
|
|||||||
.samples {
|
.samples {
|
||||||
margin-top: var(--spacer);
|
margin-top: var(--spacer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.date {
|
||||||
|
color: var(--color-secondary);
|
||||||
|
}
|
||||||
|
@ -4,6 +4,7 @@ import styles from './MetaSecondary.module.css'
|
|||||||
import { MetadataMarket } from '../../../@types/MetaData'
|
import { MetadataMarket } from '../../../@types/MetaData'
|
||||||
import Tags from '../../atoms/Tags'
|
import Tags from '../../atoms/Tags'
|
||||||
import Button from '../../atoms/Button'
|
import Button from '../../atoms/Button'
|
||||||
|
import Time from '../../atoms/Time'
|
||||||
|
|
||||||
export default function MetaSecondary({
|
export default function MetaSecondary({
|
||||||
metadata
|
metadata
|
||||||
@ -12,10 +13,6 @@ export default function MetaSecondary({
|
|||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
return (
|
return (
|
||||||
<aside className={styles.metaSecondary}>
|
<aside className={styles.metaSecondary}>
|
||||||
{metadata?.additionalInformation?.tags?.length > 0 && (
|
|
||||||
<Tags items={metadata?.additionalInformation?.tags} />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{metadata?.additionalInformation?.links?.length && (
|
{metadata?.additionalInformation?.links?.length && (
|
||||||
<div className={styles.samples}>
|
<div className={styles.samples}>
|
||||||
<MetaItem
|
<MetaItem
|
||||||
@ -35,6 +32,14 @@ export default function MetaSecondary({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{metadata?.additionalInformation?.tags?.length > 0 && (
|
||||||
|
<Tags items={metadata?.additionalInformation?.tags} />
|
||||||
|
)}
|
||||||
|
|
||||||
|
<p className={styles.date}>
|
||||||
|
Published <Time date={metadata?.main.datePublished} relative />
|
||||||
|
</p>
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,20 @@
|
|||||||
.meta {
|
.meta {
|
||||||
margin-bottom: var(--spacer);
|
margin-bottom: var(--spacer);
|
||||||
color: var(--color-secondary);
|
color: var(--color-secondary);
|
||||||
font-weight: var(--font-weight-bold);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta p {
|
.meta p {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.author {
|
||||||
|
font-weight: var(--font-weight-bold);
|
||||||
|
}
|
||||||
|
|
||||||
|
.datatoken a {
|
||||||
|
color: var(--color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
.buttonGroup {
|
.buttonGroup {
|
||||||
margin-top: var(--spacer);
|
margin-top: var(--spacer);
|
||||||
margin-bottom: var(--spacer);
|
margin-bottom: var(--spacer);
|
||||||
|
@ -10,7 +10,9 @@ 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'
|
import { useOcean, usePricing } from '@oceanprotocol/react'
|
||||||
|
import EtherscanLink from '../../atoms/EtherscanLink'
|
||||||
|
import MetaItem from './MetaItem'
|
||||||
|
|
||||||
export interface AssetContentProps {
|
export interface AssetContentProps {
|
||||||
metadata: MetadataMarket
|
metadata: MetadataMarket
|
||||||
@ -22,9 +24,9 @@ export default function AssetContent({
|
|||||||
metadata,
|
metadata,
|
||||||
ddo
|
ddo
|
||||||
}: AssetContentProps): ReactElement {
|
}: AssetContentProps): ReactElement {
|
||||||
const { datePublished } = metadata.main
|
|
||||||
const { debug } = useUserPreferences()
|
const { debug } = useUserPreferences()
|
||||||
const { accountId } = useOcean()
|
const { accountId, networkId } = useOcean()
|
||||||
|
const { dtSymbol, dtName } = usePricing(ddo)
|
||||||
|
|
||||||
const isOwner = accountId === ddo.publicKey[0].owner
|
const isOwner = accountId === ddo.publicKey[0].owner
|
||||||
const hasNoPrice = ddo.price.type === ''
|
const hasNoPrice = ddo.price.type === ''
|
||||||
@ -37,7 +39,24 @@ export default function AssetContent({
|
|||||||
|
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<aside className={styles.meta}>
|
<aside className={styles.meta}>
|
||||||
<p>{datePublished && <Time date={datePublished} />}</p>
|
<p className={styles.author}>
|
||||||
|
{metadata?.additionalInformation?.copyrightHolder ||
|
||||||
|
metadata?.main.author}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p className={styles.datatoken}>
|
||||||
|
<EtherscanLink
|
||||||
|
networkId={networkId}
|
||||||
|
path={`token/${ddo.dataToken}`}
|
||||||
|
>
|
||||||
|
{dtName ? (
|
||||||
|
`${dtName} - ${dtSymbol}`
|
||||||
|
) : (
|
||||||
|
<code>{ddo.dataToken}</code>
|
||||||
|
)}
|
||||||
|
</EtherscanLink>
|
||||||
|
</p>
|
||||||
|
|
||||||
{metadata?.additionalInformation?.categories?.length && (
|
{metadata?.additionalInformation?.categories?.length && (
|
||||||
<p>
|
<p>
|
||||||
<Link
|
<Link
|
||||||
|
@ -21,7 +21,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin-bottom: calc(var(--spacer) / 2);
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.author {
|
||||||
|
margin-top: calc(var(--spacer) / 8);
|
||||||
|
margin-bottom: 0;
|
||||||
|
color: var(--color-secondary);
|
||||||
|
font-weight: var(--font-weight-bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview [class*='MetaItem-module--metaItem'] h3 {
|
.preview [class*='MetaItem-module--metaItem'] h3 {
|
||||||
@ -30,6 +37,7 @@
|
|||||||
|
|
||||||
.description {
|
.description {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-top: calc(var(--spacer) / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle {
|
.toggle {
|
||||||
|
@ -34,6 +34,7 @@ export default function Preview({
|
|||||||
<h2 className={styles.previewTitle}>Preview</h2>
|
<h2 className={styles.previewTitle}>Preview</h2>
|
||||||
<header>
|
<header>
|
||||||
{values.name && <h3 className={styles.title}>{values.name}</h3>}
|
{values.name && <h3 className={styles.title}>{values.name}</h3>}
|
||||||
|
{values.author && <p className={styles.author}>{values.author}</p>}
|
||||||
|
|
||||||
{values.description && (
|
{values.description && (
|
||||||
<div className={styles.description}>
|
<div className={styles.description}>
|
||||||
@ -81,6 +82,7 @@ export default function Preview({
|
|||||||
.filter(
|
.filter(
|
||||||
([key, value]) =>
|
([key, value]) =>
|
||||||
!(
|
!(
|
||||||
|
key.includes('author') ||
|
||||||
key.includes('name') ||
|
key.includes('name') ||
|
||||||
key.includes('description') ||
|
key.includes('description') ||
|
||||||
key.includes('tags') ||
|
key.includes('tags') ||
|
||||||
|
Loading…
Reference in New Issue
Block a user