import React from 'react' import Moment from 'react-moment' import { DDO, MetaData, File } from '@oceanprotocol/squid' import shortid from 'shortid' import Markdown from '../../atoms/Markdown' import CategoryLink from '../../atoms/CategoryLink' import styles from './AssetDetails.module.scss' import AssetFilesDetails from './AssetFilesDetails' import Report from './Report' import Web3 from 'web3' import AssetsJob from './AssetJob' import Web3message from '../../organisms/Web3message' interface AssetDetailsProps { ocean: any metadata: MetaData ddo: DDO } export function datafilesLine(files: File[]) { if (files.length === 1) { return {files.length} data file } return {files.length} data files } const MetaFixedItem = ({ name, value }: { name: string; value: string }) => (
  • {name} {value}
  • ) export default function AssetDetails({ metadata, ddo, ocean }: AssetDetailsProps) { const { main, additionalInformation } = metadata const price = main.price && Web3.utils.fromWei(main.price.toString()) const isCompute = !!ddo.findServiceByType('compute') const isAccess = !!ddo.findServiceByType('access') const metaFixed = [ { name: 'Author', value: main.author, show: true }, { name: 'License', value: main.license, show: true }, { name: 'DID', value: ddo.id, show: true }, { name: 'Price', value: `${price} OCEAN`, show: price !== '0' } ] return ( <> {additionalInformation && additionalInformation.description && ( )}

    Fixed Metadata

      {metaFixed .filter((item) => item.show) .map((item) => ( ))}
    {isAccess ? ( ) : null} {isCompute ? : null} {isCompute || isAccess ? : null} ) }