summaryrefslogtreecommitdiff
path: root/app/client/common/fileList.component.js
blob: c12a4618086b5cb31c79cbbd8a93dd9c39c94d87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { h, Component } from 'preact'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import moment from 'moment'
import * as util from '../util'

class FileList extends Component {
  constructor(props){
    super()
  }
  render(){
    const { files } = this.props
	  const fileList = files.map(file => {
	   	return (
		   	<div class='row' key={file.name}>
          <div className="filename">{file.name || file.url}</div>
          <div className="size">{file.size || ''}</div>
          <div className="date">{moment(file.created_at).format("YYYY-MM-DD H:mm")}</div>
          {file.epoch && <div className="epoch">epoch {file.epoch}</div>}
	        <div className='activity'>{file.activity || ''} {file.module || ''}</div>
          {this.props.options && this.props.options(file)}
		   	</div>
	   	)
	  })
	  return (
	  	<div className='filelist rows'>
	  		{fileList}
	  	</div>
  	)
  }
}



const mapStateToProps = state => ({
})

const mapDispatchToProps = (dispatch, ownProps) => ({
  // actions: bindActionCreators(liveActions, dispatch)
})

export default connect(mapStateToProps, mapDispatchToProps)(FileList)