import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import { uploadUri, formatDateTime } from '../../../util'
import { MenuButton, SmallMenuButton, Loader } from '../../../common'
import actions from '../../../actions'
import UploadIndexOptions from './upload.indexOptions'
import UploadMenu from './upload.menu'
// const { result, collectionLookup } = this.props
export default class UploadIndex extends Component {
componentDidMount() {
this.fetch(false)
}
componentDidUpdate(prevProps) {
if (this.props.upload.options.sort !== prevProps.upload.options.sort) {
this.fetch(false)
}
}
fetch(load_more) {
const { options, index } = this.props.upload
const { order: index_order } = index
const [ sort, order ] = options.sort.split('-')
actions.upload.index({
sort, order, limit: 50, offset: load_more ? index_order.length : 0,
}, load_more)
}
render() {
const { uploadActions } = this.props
const { options } = this.props.upload
const { loading, lookup, order } = this.props.upload.index
if (loading) {
return (
{"No uploads"}