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

make amount of recent history items configurable

This commit is contained in:
Matthias Kretschmann 2019-03-26 16:28:08 +01:00
parent 6eda278f1b
commit 9cc5fb3a79
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 41 additions and 33 deletions

View File

@ -7,7 +7,7 @@ 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<
{ list?: boolean; recent?: boolean }, { list?: boolean; recent?: number },
{ results: any[]; isLoading: boolean } { results: any[]; isLoading: boolean }
> { > {
public state = { results: [], isLoading: true } public state = { results: [], isLoading: true }
@ -61,28 +61,34 @@ export default class AssetsUser extends PureComponent<
) : this.state.results.length ? ( ) : this.state.results.length ? (
<> <>
{this.state.results {this.state.results
.slice(0, this.props.recent ? 5 : undefined) .slice(
.filter(asset => !!asset) 0,
.map((asset: any) => ( this.props.recent
<Asset ? this.props.recent
list={this.props.list} : undefined
key={asset.id} )
asset={asset} .filter(asset => !!asset)
/> .map((asset: any) => (
))} <Asset
{this.props.recent && ( list={this.props.list}
<Link className={styles.link} to={'/history'}> key={asset.id}
All Data Sets asset={asset}
</Link> />
)} ))}
</> {this.props.recent && (
) : ( <Link className={styles.link} to={'/history'}>
<div> All Data Sets
<p>No Data Sets Yet.</p> </Link>
<Link to="/publish">+ Publish A Data Set</Link> )}
</div> </>
)} ) : (
</div> <div className={styles.empty}>
<p>No Data Sets Yet.</p>
<Link to="/publish">+ Publish A Data Set</Link>
</div>
)}
</div>
)
) )
} }
} }

View File

@ -25,13 +25,6 @@ export default class AssetDetails extends PureComponent<AssetDetailsProps> {
{base.copyrightHolder} {base.copyrightHolder}
</h2> </h2>
<div className={styles.metaPrimaryData}> <div className={styles.metaPrimaryData}>
<span title="Date published">
<Moment
date={base.dateCreated}
format="L"
interval={0}
/>
</span>
{base.categories ? ( {base.categories ? (
// TODO: Make this link to search for respective category // TODO: Make this link to search for respective category
<Link to={`/search?q=${base.categories[0]}`}> <Link to={`/search?q=${base.categories[0]}`}>
@ -40,9 +33,18 @@ export default class AssetDetails extends PureComponent<AssetDetailsProps> {
) : ( ) : (
<Link to={'/search?q='}>Fake Category</Link> <Link to={'/search?q='}>Fake Category</Link>
)} )}
<span>
{base.files ? base.files.length : 0} data files <span title="Date published">
<Moment
date={base.dateCreated}
format="L"
interval={0}
/>
</span> </span>
{base.files && (
<span>{base.files.length} data files</span>
)}
</div> </div>
</aside> </aside>

View File

@ -41,7 +41,7 @@ class Home extends Component<HomeProps, HomeState> {
} }
/> />
</Form> </Form>
<AssetsUser recent list /> <AssetsUser recent={5} list />
</Route> </Route>
) )
} }