import { h, Component } from 'preact' import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import { Link } from 'react-router-dom'; import moment from 'moment' import * as util from '../util' class FileList extends Component { constructor(props){ super() } render(){ const { files, linkFiles, onClick } = this.props const fileList = files.map(file => { return (
{(linkFiles && file.url) ? {file.name || file.url} : onClick(file)}>{file.name || file.url} }
{moment(file.created_at).format("YYYY-MM-DD h:mm a")}
{file.size ? ((file.size) / 1024 / 1024).toFixed(1) + ' mb.' : ''}
{file.epoch > 0 ? 'epoch ' + file.epoch : ' '}
{file.activity || ''} {file.module || ''}
{this.props.options && this.props.options(file)}
) }) return (
{fileList}
) } } const mapStateToProps = state => ({ }) const mapDispatchToProps = (dispatch, ownProps) => ({ // actions: bindActionCreators(liveActions, dispatch) }) export default connect(mapStateToProps, mapDispatchToProps)(FileList)