import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Link } from 'react-router';
import { Helmet } from 'react-helmet';
import prettyBytes from 'pretty-bytes';
import Loader from '../../App/components/loader';
import * as AssetActions from '../actions/assets';
class AssetList extends React.Component {
constructor(props) {
super(props);
this.props.getAssets();
}
getAssetsTitle() {
if (!this.props.username || this.props.username === this.props.user.username) {
return 'p5.js Web Editor | My assets';
}
return `p5.js Web Editor | ${this.props.username}'s assets`;
}
hasAssets() {
return !this.props.loading && this.props.assetList.length > 0;
}
renderLoader() {
if (this.props.loading) return
No uploaded assets.
); } return null; } render() { const username = this.props.username !== undefined ? this.props.username : this.props.user.username; const { assetList, totalSize } = this.props; return ({`${prettyBytes(totalSize)} Total`}
}Name | Size | View | Sketch |
---|---|---|---|
{asset.name} | {prettyBytes(asset.size)} | View | {asset.sketchName} |