Mailspring/internal_packages/file-list/lib/file-list.cjsx
Evan Morikawa fc4b3b56d7 refactor(utils): switch to regular underscore
Summary:
Fixes: T1334

remove final InboxApp references

move out all underscore-plus methods

Mass find and replace of underscore-plus

sed -i '' -- 's/underscore-plus/underscore/g' **/*.coffee
sed -i '' -- 's/underscore-plus/underscore/g' **/*.cjsx

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D1534
2015-05-19 16:06:59 -07:00

51 lines
1.1 KiB
CoffeeScript

_ = require 'underscore'
React = require 'react'
{ListTabular, MultiselectList} = require 'nylas-component-kit'
{Actions,
DatabaseStore,
ComponentRegistry} = require 'nylas-exports'
FileListStore = require './file-list-store'
class FileList extends React.Component
@displayName: 'FileList'
@containerRequired: false
componentWillMount: =>
prettySize = (size) ->
units = ['GB', 'MB', 'KB', 'bytes']
while size > 1024
size /= 1024
units.pop()
size = "#{(Math.ceil(size * 10) / 10)}"
pretty = units.pop()
"#{size} #{pretty}"
c1 = new ListTabular.Column
name: "Name"
flex: 1
resolver: (file) =>
<div>{file.filename}</div>
c2 = new ListTabular.Column
name: "Size"
width: '100px'
resolver: (file) =>
<div>{prettySize(file.size)}</div>
@columns = [c1, c2]
render: =>
<MultiselectList
dataStore={FileListStore}
columns={@columns}
commands={{}}
onDoubleClick={@_onDoubleClick}
itemPropsProvider={ -> {} }
className="file-list"
collection="file" />
_onDoubleClick: (item) =>
module.exports = FileList