 
 misc = require('misc')
 {React, Actions, Store, Table, rtypes, rclass, FluxComponent}  = require('flux')
-{Loading} = require('r_misc')
+{Loading, TimeAgo} = require('r_misc')
 {User} = require('users')
 
 class FileUseActions extends Actions

        </div>

FileUseController = rclass
    propTypes: ->
        flux     : rtypes.object
        file_use : rtypes.object

    render: ->
        if not @props.file_use? or not @props.flux?
            return <Loading/>
        file_use_list = @props.flux.getStore('file_use').get_sorted_file_use_list()
        <FileUseViewer file_use_list={file_use_list}/>

render = (flux) ->
    <FluxComponent flux={flux} connectToStores={['file_use', 'users']} >
        <FileUseController />
    </FluxComponent>


        if @_sorted_file_use_list?
            return @_sorted_file_use_list
        v = []
        @state.file_use.map (x,_) =>
            v.push(x.toJS())
        v.sort (a,b)->misc.cmp(b.last_edited, a.last_edited)
        @_sorted_file_use_list = v
        return v
