mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 20:44:30 +08:00
abcf2b7dad
Summary: consolidate all the "untitled" stuff into a convenience method on the File itself. Previously it'd show "Unnamed Attachment", download as "Untitled" and open as "<file.id>". Now it's consistent everywhere and chooses names based on the contenttype (Event.ics). Rewrite CSS rules for uploads and attachments to be simpler - remove container divs and classnames from things that have no CSS - switch to using Flexbox so it's not necesary to have so many containers - remove zIndex hacks, apply overflow rules to name div only, so long filenames don't make action button unclickable - consolidate CSS classnames for uploads/attachments - Other style fixes - cursor "default" instead of text insertion on image attachments - cursor "default" on action buttons - image uplaods / attachments with long filenames truncate with ellpsis - attachments are not indented by an extra 15px in message bodies Prevent progress bar overflow (was ending above 100%, 100.12315%...) Update FileDownloadStore so it never creates Download objects when file is downloaded already - Previously, the download itself decided if it would be a no-op, but this meant the download was around for a split second and you'd see progress indicators flash for a moment when opening/saving an attachment. Upgrade FileDownloadStore use of promises Restore Image attachment drag and drop - was broken because the name gradient thing was covering the entire drag region. Allow file attachments to be drag and dropped to the finder and other applications 😍😍😍 Test Plan: Tests still pass Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D1745
51 lines
1.2 KiB
CoffeeScript
51 lines
1.2 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.displayName()}</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
|