1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

user assets list with new Asset component

This commit is contained in:
Matthias Kretschmann 2019-02-15 16:48:43 +01:00
parent f10ca30c15
commit 409d13b961
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 22 additions and 13 deletions

View File

@ -11,6 +11,21 @@
} }
} }
.assets {
display: grid;
grid-template-columns: 1fr;
grid-gap: $spacer;
max-width: 100%;
@media (min-width: $break-point--small) {
grid-template-columns: 2fr 2fr;
}
@media (min-width: $break-point--medium) {
grid-template-columns: 2fr 2fr 2fr;
}
}
.subTitle { .subTitle {
font-size: $font-size-h4; font-size: $font-size-h4;
color: $brand-grey-light; color: $brand-grey-light;

View File

@ -1,5 +1,6 @@
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import Asset from '../molecules/Asset'
import styles from './AssetsUser.module.scss' import styles from './AssetsUser.module.scss'
export default class AssetsUser extends PureComponent { export default class AssetsUser extends PureComponent {
@ -16,7 +17,7 @@ export default class AssetsUser extends PureComponent {
query: { query: {
// TODO: query all assets published by current active account // TODO: query all assets published by current active account
$text: { $text: {
$search: 'account ID' $search: 'zoid'
} }
} }
} }
@ -24,24 +25,17 @@ export default class AssetsUser extends PureComponent {
this.setState({ results: assets }) this.setState({ results: assets })
} }
// TODO: this should be removed and replaced by Asset.tsx component
private renderAssetBox = (asset: any) => {
const { metadata } = asset.findServiceByType('Metadata')
return (
<Link key={asset.id} to={`/asset/${asset.id}`}>
<div>{metadata.base.name}</div>
<div>{metadata.base.description}</div>
</Link>
)
}
public render() { public render() {
return ( return (
<div className={styles.assetsUser}> <div className={styles.assetsUser}>
<h2 className={styles.subTitle}>Your Data Sets</h2> <h2 className={styles.subTitle}>Your Data Sets</h2>
{this.state.results.length ? ( {this.state.results.length ? (
this.state.results.map(asset => this.renderAssetBox(asset)) <div className={styles.assets}>
{this.state.results.map((asset, index) => (
<Asset key={index} asset={asset} />
))}
</div>
) : ( ) : (
<div> <div>
<p>None yet.</p> <p>None yet.</p>