Mailspring/internal_packages/file-list/lib/file-frame.cjsx

40 lines
1 KiB
Plaintext
Raw Normal View History

refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
React = require 'react'
_ = require "underscore"
{Utils, FileDownloadStore, Actions} = require 'nylas-exports'
{Spinner, EventedIFrame} = require 'nylas-component-kit'
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
FileFrameStore = require './file-frame-store'
class FileFrame extends React.Component
@displayName: 'FileFrame'
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
render: =>
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
src = if @state.ready then @state.filepath else ''
if @state.file
<div className="file-frame-container">
<EventedIFrame src={src} />
<Spinner visible={!@state.ready} />
</div>
else
<div></div>
constructor: (@props) ->
@state = @getStateFromStores()
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
componentDidMount: =>
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
@_unsubscribers = []
@_unsubscribers.push FileFrameStore.listen @_onChange
componentWillUnmount: =>
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
unsubscribe() for unsubscribe in @_unsubscribers
getStateFromStores: =>
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
file: FileFrameStore.file()
filepath: FileDownloadStore.pathForFile(FileFrameStore.file())
ready: FileFrameStore.ready()
_onChange: =>
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets Summary: Remember to remove all the event listeners added to email frame New files tab, queryable filename, not attribute Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well Initial file list and file list store, File Location Remove unnecessary shouldComponentUpdate Always track whether new requests have happened since ours to prevent out of order triggers Always scroll to the current [focused/keyboard-cursor] in lists So goodbye to the trash tag Only scroll to current item if focus or keyboard has moved Show message snippet in notification if no subject line Make the RootSelectionBar pull items from Component Registry New Archive button (prettier than the other one) Refactor event additions to iframe so iframe can be used for file display also Thread List is no longer the uber root package - drafts and files moved to separate packages WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode" Don't animate transitions between two root sheets Mode switch is only visible on root sheets that support multiple modes Account sidebar now shows "Views" that have registered themselves: drafts and files for now Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List Misc supporting changes New files package which registers it's views and components Rename files package to `file-list` Move checkmark column down into model list Don't throw exception if shift-down arrow and nothing selected Takes a long time on login to fetch first page of threads, make pages smaller Displaynames, spec fixes Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
@setState(@getStateFromStores())
module.exports = FileFrame