2015-05-20 06:59:37 +08:00
|
|
|
React = require 'react'
|
2016-03-29 16:41:24 +08:00
|
|
|
ReactDOM = require 'react-dom'
|
|
|
|
ReactCSSTransitionGroup = require 'react-addons-css-transition-group'
|
2015-05-20 07:06:59 +08:00
|
|
|
_ = require 'underscore'
|
2015-05-20 06:59:37 +08:00
|
|
|
classNames = require 'classnames'
|
2016-03-29 16:41:24 +08:00
|
|
|
|
2017-01-16 06:10:04 +08:00
|
|
|
SyncActivity = require("./sync-activity").default
|
|
|
|
SyncbackActivity = require("./syncback-activity").default
|
2016-04-05 08:11:09 +08:00
|
|
|
|
2017-01-16 07:12:54 +08:00
|
|
|
{Utils,
|
|
|
|
Actions,
|
2015-05-20 06:59:37 +08:00
|
|
|
TaskQueue,
|
feat(accounts): Kill namespaces, long live accounts
Summary:
This diff replaces the Namespace object with the Account object, and changes all references to namespace_id => account_id, etc. The endpoints are now `/threads` instead of `/n/<id>/threads`.
This diff also adds preliminary support for multiple accounts. When you log in, we now log you in to all the attached accounts on edgehill server. From the preferences panel, you can auth with / unlink additional accounts. Shockingly, this all seems to pretty much work.
When replying to a thread, you cannot switch from addresses. However, when creating a new message in a popout composer, you can change the from address and the SaveDraftTask will delete/re-root the draft on the new account.
Search bar doesn't need to do full refresh on clear if it never committed
Allow drafts to be switched to a different account when not in reply to an existing thread
Fix edge case where ChangeMailTask throws exception if no models are modified during performLocal
Show many dots for many accounts in long polling status bar
add/remove accounts from prefs
Spec fixes!
Test Plan: Run tests, none broken!
Reviewers: evan, dillon
Reviewed By: evan, dillon
Differential Revision: https://phab.nylas.com/D1928
2015-08-22 06:29:58 +08:00
|
|
|
AccountStore,
|
feat(work): Create the "Work" window, move TaskQueue, Nylas sync workers
Summary:
Move sync workers and Edgehill token checks to work window
Move the task queue and database setup to the work window
Move ContactStore background refresh to work window
Store the task queue in the database
WIP
The TaskQueue now puts tasks in the database instead of in a file, which also means it can be observed
Move all delta sync and initial sync to a package, make NylasSyncStore which exposes read-only sync state
DraftStore no longer reads task status. Once you set the "sending" bit on a draft, it never gets unset. But that's fine actually.
If your package lists windowTypes, you *only* get loaded in those windowTypes. If you specify no windowTypes, you get loaded in the root window.
This means that onboarding, worker-ui, worker-sync, etc. no longer get loaded into the main window
ActivitySidebar has a special little store that observes the task queue since it's no longer in the window
Move "toggle component regions" / "toggle react remote" to the Developer menu
Move sync worker specs, update draft store specs to not rely on TaskQueue at all
Test Plan: Run existing tests, all pass
Reviewers: dillon, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D1936
2015-08-28 07:39:40 +08:00
|
|
|
NylasSyncStatusStore,
|
2017-01-16 06:10:04 +08:00
|
|
|
TaskQueueStatusStore
|
|
|
|
PerformSendActionTask,
|
|
|
|
SendDraftTask} = require 'nylas-exports'
|
|
|
|
|
|
|
|
SEND_TASK_CLASSES = [PerformSendActionTask, SendDraftTask]
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
class ActivitySidebar extends React.Component
|
|
|
|
@displayName: 'ActivitySidebar'
|
|
|
|
|
|
|
|
@containerRequired: false
|
2015-06-03 10:04:21 +08:00
|
|
|
@containerStyles:
|
|
|
|
minWidth: 165
|
feat(accounts): Kill namespaces, long live accounts
Summary:
This diff replaces the Namespace object with the Account object, and changes all references to namespace_id => account_id, etc. The endpoints are now `/threads` instead of `/n/<id>/threads`.
This diff also adds preliminary support for multiple accounts. When you log in, we now log you in to all the attached accounts on edgehill server. From the preferences panel, you can auth with / unlink additional accounts. Shockingly, this all seems to pretty much work.
When replying to a thread, you cannot switch from addresses. However, when creating a new message in a popout composer, you can change the from address and the SaveDraftTask will delete/re-root the draft on the new account.
Search bar doesn't need to do full refresh on clear if it never committed
Allow drafts to be switched to a different account when not in reply to an existing thread
Fix edge case where ChangeMailTask throws exception if no models are modified during performLocal
Show many dots for many accounts in long polling status bar
add/remove accounts from prefs
Spec fixes!
Test Plan: Run tests, none broken!
Reviewers: evan, dillon
Reviewed By: evan, dillon
Differential Revision: https://phab.nylas.com/D1928
2015-08-22 06:29:58 +08:00
|
|
|
maxWidth: 400
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
constructor: (@props) ->
|
|
|
|
@state = @_getStateFromStores()
|
|
|
|
|
2017-01-16 07:12:54 +08:00
|
|
|
shouldComponentUpdate: (nextProps, nextState) =>
|
|
|
|
not Utils.isEqualReact(nextProps, @props) or
|
|
|
|
not Utils.isEqualReact(nextState, @state)
|
|
|
|
|
2015-05-20 06:59:37 +08:00
|
|
|
componentDidMount: =>
|
|
|
|
@_unlisteners = []
|
feat(work): Create the "Work" window, move TaskQueue, Nylas sync workers
Summary:
Move sync workers and Edgehill token checks to work window
Move the task queue and database setup to the work window
Move ContactStore background refresh to work window
Store the task queue in the database
WIP
The TaskQueue now puts tasks in the database instead of in a file, which also means it can be observed
Move all delta sync and initial sync to a package, make NylasSyncStore which exposes read-only sync state
DraftStore no longer reads task status. Once you set the "sending" bit on a draft, it never gets unset. But that's fine actually.
If your package lists windowTypes, you *only* get loaded in those windowTypes. If you specify no windowTypes, you get loaded in the root window.
This means that onboarding, worker-ui, worker-sync, etc. no longer get loaded into the main window
ActivitySidebar has a special little store that observes the task queue since it's no longer in the window
Move "toggle component regions" / "toggle react remote" to the Developer menu
Move sync worker specs, update draft store specs to not rely on TaskQueue at all
Test Plan: Run existing tests, all pass
Reviewers: dillon, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D1936
2015-08-28 07:39:40 +08:00
|
|
|
@_unlisteners.push TaskQueueStatusStore.listen @_onDataChanged
|
2015-09-25 02:03:11 +08:00
|
|
|
@_unlisteners.push NylasSyncStatusStore.listen @_onDataChanged
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
componentWillUnmount: =>
|
|
|
|
unlisten() for unlisten in @_unlisteners
|
|
|
|
|
|
|
|
render: =>
|
2017-01-16 06:10:04 +08:00
|
|
|
sendTasks = []
|
|
|
|
nonSendTasks = []
|
|
|
|
@state.tasks.forEach (task) ->
|
|
|
|
if SEND_TASK_CLASSES.some(((taskClass) -> task instanceof taskClass ))
|
|
|
|
sendTasks.push(task)
|
|
|
|
else
|
|
|
|
nonSendTasks.push(task)
|
2015-09-25 02:03:11 +08:00
|
|
|
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
names = classNames
|
|
|
|
"sidebar-activity": true
|
|
|
|
"sidebar-activity-error": error?
|
|
|
|
|
2015-09-15 02:04:24 +08:00
|
|
|
wrapperClass = "sidebar-activity-transition-wrapper "
|
|
|
|
|
2017-01-16 06:10:04 +08:00
|
|
|
inside = <ReactCSSTransitionGroup
|
|
|
|
className={names}
|
|
|
|
transitionLeaveTimeout={625}
|
|
|
|
transitionEnterTimeout={125}
|
|
|
|
transitionName="activity-opacity">
|
|
|
|
<SyncbackActivity syncbackTasks={sendTasks} />
|
|
|
|
<SyncActivity
|
|
|
|
initialSync={!@state.isInitialSyncComplete}
|
|
|
|
syncbackTasks={nonSendTasks}
|
|
|
|
/>
|
|
|
|
</ReactCSSTransitionGroup>
|
2015-09-15 02:04:24 +08:00
|
|
|
|
2016-03-29 16:41:24 +08:00
|
|
|
<ReactCSSTransitionGroup
|
2015-09-15 02:04:24 +08:00
|
|
|
className={wrapperClass}
|
2016-03-29 16:41:24 +08:00
|
|
|
transitionLeaveTimeout={625}
|
|
|
|
transitionEnterTimeout={125}
|
2015-09-15 02:04:24 +08:00
|
|
|
transitionName="activity-opacity">
|
|
|
|
{inside}
|
2016-03-29 16:41:24 +08:00
|
|
|
</ReactCSSTransitionGroup>
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
_onDataChanged: =>
|
|
|
|
@setState(@_getStateFromStores())
|
|
|
|
|
|
|
|
_getStateFromStores: =>
|
feat(work): Create the "Work" window, move TaskQueue, Nylas sync workers
Summary:
Move sync workers and Edgehill token checks to work window
Move the task queue and database setup to the work window
Move ContactStore background refresh to work window
Store the task queue in the database
WIP
The TaskQueue now puts tasks in the database instead of in a file, which also means it can be observed
Move all delta sync and initial sync to a package, make NylasSyncStore which exposes read-only sync state
DraftStore no longer reads task status. Once you set the "sending" bit on a draft, it never gets unset. But that's fine actually.
If your package lists windowTypes, you *only* get loaded in those windowTypes. If you specify no windowTypes, you get loaded in the root window.
This means that onboarding, worker-ui, worker-sync, etc. no longer get loaded into the main window
ActivitySidebar has a special little store that observes the task queue since it's no longer in the window
Move "toggle component regions" / "toggle react remote" to the Developer menu
Move sync worker specs, update draft store specs to not rely on TaskQueue at all
Test Plan: Run existing tests, all pass
Reviewers: dillon, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D1936
2015-08-28 07:39:40 +08:00
|
|
|
tasks: TaskQueueStatusStore.queue()
|
2016-03-15 06:34:16 +08:00
|
|
|
isInitialSyncComplete: NylasSyncStatusStore.isSyncComplete()
|
2015-05-20 06:59:37 +08:00
|
|
|
|
|
|
|
module.exports = ActivitySidebar
|