1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00
market/src/components/molecules/AssetTeaser.tsx
claudiaHash ce81777030
view algorithms on homepage (#388)
* view algorithms on homepage

* linting error fixed

* view algos on rinkeby/mainnet, added algos on search

* global color system tweak, apply on asset teaser system

* create subtle hierarchical distinction between background & content
* output asset type
* add asset type as css class
* bonus side effect: a nicer dark mode theme on OLED screens

* add icon assets

* compute/download icons added to asset teaser

* tooltip content fix

* tooltip content width fix


tooltip message shortened

* max-width added

* links renamed, all algos section removed

* datatoken tooltip removed

* spacing tweaks

* visual separation of asset & access type, flip order
* spacing/font size tweaks, aligning things

* fix search

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* light mode color tweak

* change dataset display name

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* data set label fixed

* query updated for data sets and algos

Co-authored-by: claudia.holhos <claudia.holhos@hpm.ro>
Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
Co-authored-by: mihaisc <mihai.scarlat@smartcontrol.ro>
2021-02-22 16:25:27 +02:00

71 lines
2.2 KiB
TypeScript

import React from 'react'
import { Link } from 'gatsby'
import Dotdotdot from 'react-dotdotdot'
import Price from '../atoms/Price'
import styles from './AssetTeaser.module.css'
import { DDO } from '@oceanprotocol/lib'
import removeMarkdown from 'remove-markdown'
import Publisher from '../atoms/Publisher'
import { useMetadata } from '@oceanprotocol/react'
import Time from '../atoms/Time'
import { ReactComponent as Compute } from '../../images/compute.svg'
import { ReactComponent as Download } from '../../images/download.svg'
declare type AssetTeaserProps = {
ddo: DDO
}
const AssetTeaser: React.FC<AssetTeaserProps> = ({ ddo }: AssetTeaserProps) => {
const { owner } = useMetadata(ddo)
const { attributes } = ddo.findServiceByType('metadata')
const { name, type } = attributes.main
const { dataTokenInfo } = ddo
const accessType = ddo.service[1].type
return (
<article className={`${styles.teaser} ${styles[type]}`}>
<Link to={`/asset/${ddo.id}`} className={styles.link}>
<header className={styles.header}>
<div className={styles.symbol}>{dataTokenInfo?.symbol}</div>
<Dotdotdot clamp={3}>
<h1 className={styles.title}>{name}</h1>
</Dotdotdot>
<Publisher account={owner} minimal className={styles.publisher} />
</header>
<aside className={styles.typeDetails}>
<div className={styles.typeLabel}>
{type === 'dataset' ? 'data set' : 'algorithm'}
</div>
{accessType === 'access' ? (
<Download
role="img"
aria-label="Download"
className={styles.icon}
/>
) : (
<Compute role="img" aria-label="Compute" className={styles.icon} />
)}
</aside>
<div className={styles.content}>
<Dotdotdot tagName="p" clamp={3}>
{removeMarkdown(
attributes?.additionalInformation?.description || ''
)}
</Dotdotdot>
</div>
<footer className={styles.foot}>
<Price ddo={ddo} small />
<p className={styles.date}>
<Time date={ddo?.created} relative />
</p>
</footer>
</Link>
</article>
)
}
export default AssetTeaser