2015-06-18 04:14:45 +08:00
|
|
|
|
_ = require 'underscore'
|
|
|
|
|
React = require 'react'
|
|
|
|
|
classNames = require 'classnames'
|
|
|
|
|
{RetinaImg} = require 'nylas-component-kit'
|
|
|
|
|
{DatabaseView,
|
|
|
|
|
NylasAPI,
|
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,
|
2015-10-24 07:04:22 +08:00
|
|
|
|
Message,
|
2016-02-24 02:49:12 +08:00
|
|
|
|
FocusedPerspectiveStore,
|
2015-06-18 04:14:45 +08:00
|
|
|
|
WorkspaceStore} = require 'nylas-exports'
|
|
|
|
|
|
|
|
|
|
EmptyMessages = [{
|
|
|
|
|
"body":"The pessimist complains about the wind.\nThe optimist expects it to change.\nThe realist adjusts the sails."
|
|
|
|
|
"byline": "- William Arthur Ward"
|
|
|
|
|
},{
|
|
|
|
|
"body":"The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart."
|
2015-09-10 05:03:35 +08:00
|
|
|
|
"byline": "- Helen Keller"
|
2015-06-18 04:14:45 +08:00
|
|
|
|
},{
|
|
|
|
|
"body":"Believe you can and you're halfway there."
|
|
|
|
|
"byline": "- Theodore Roosevelt"
|
|
|
|
|
},{
|
|
|
|
|
"body":"Don't judge each day by the harvest you reap but by the seeds that you plant."
|
|
|
|
|
"byline": "- Robert Louis Stevenson"
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
class ContentGeneric extends React.Component
|
|
|
|
|
render: ->
|
|
|
|
|
<div className="generic">
|
|
|
|
|
<div className="message">
|
|
|
|
|
{@props.messageOverride ? "No threads to display."}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
class ContentQuotes extends React.Component
|
|
|
|
|
@displayName = 'Quotes'
|
|
|
|
|
|
|
|
|
|
constructor: (@props) ->
|
|
|
|
|
@state = {}
|
|
|
|
|
|
|
|
|
|
componentDidMount: ->
|
|
|
|
|
# Pick a random quote using the day as a seed. I know not all months have
|
|
|
|
|
# 31 days - this is good enough to generate one quote a day at random!
|
|
|
|
|
d = new Date()
|
|
|
|
|
r = d.getDate() + d.getMonth() * 31
|
|
|
|
|
message = EmptyMessages[r % EmptyMessages.length]
|
|
|
|
|
@setState(message: message)
|
|
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
|
<div className="quotes">
|
|
|
|
|
{@_renderMessage()}
|
|
|
|
|
<RetinaImg mode={RetinaImg.Mode.ContentLight} url="nylas://thread-list/assets/blank-bottom-left@2x.png" className="bottom-left"/>
|
|
|
|
|
<RetinaImg mode={RetinaImg.Mode.ContentLight} url="nylas://thread-list/assets/blank-top-left@2x.png" className="top-left"/>
|
|
|
|
|
<RetinaImg mode={RetinaImg.Mode.ContentLight} url="nylas://thread-list/assets/blank-bottom-right@2x.png" className="bottom-right"/>
|
|
|
|
|
<RetinaImg mode={RetinaImg.Mode.ContentLight} url="nylas://thread-list/assets/blank-top-right@2x.png" className="top-right"/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
_renderMessage: ->
|
|
|
|
|
if @props.messageOverride
|
|
|
|
|
<div className="message">{@props.messageOverride}</div>
|
|
|
|
|
else
|
|
|
|
|
<div className="message">
|
|
|
|
|
{@state.message?.body}
|
|
|
|
|
<div className="byline">
|
|
|
|
|
{@state.message?.byline}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2016-02-24 02:49:12 +08:00
|
|
|
|
class InboxZero extends React.Component
|
|
|
|
|
@displayName = "Inbox Zero"
|
|
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
|
msg = @props.messageOverride ? "No more messages"
|
|
|
|
|
<div className="inbox-zero">
|
|
|
|
|
<div className="inbox-zero-plain">
|
|
|
|
|
<RetinaImg mode={RetinaImg.Mode.ContentPreserve}
|
|
|
|
|
name="inbox-zero-plain.png"/>
|
|
|
|
|
<div className="message">Hooray! You’re done.</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-06-18 04:14:45 +08:00
|
|
|
|
|
|
|
|
|
class EmptyState extends React.Component
|
|
|
|
|
@displayName = 'EmptyState'
|
|
|
|
|
@propTypes =
|
|
|
|
|
visible: React.PropTypes.bool.isRequired
|
|
|
|
|
|
|
|
|
|
constructor: (@props) ->
|
|
|
|
|
@state =
|
|
|
|
|
layoutMode: WorkspaceStore.layoutMode()
|
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
|
|
|
|
syncing: NylasSyncStatusStore.busy()
|
2015-06-18 04:14:45 +08:00
|
|
|
|
active: false
|
|
|
|
|
|
|
|
|
|
componentDidMount: ->
|
|
|
|
|
@_unlisteners = []
|
|
|
|
|
@_unlisteners.push WorkspaceStore.listen(@_onChange, @)
|
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 NylasSyncStatusStore.listen(@_onChange, @)
|
2015-10-24 07:04:22 +08:00
|
|
|
|
if @props.visible and not @state.active
|
|
|
|
|
@setState(active:true)
|
2015-06-18 04:14:45 +08:00
|
|
|
|
|
2015-08-04 05:09:29 +08:00
|
|
|
|
shouldComponentUpdate: (nextProps, nextState) ->
|
|
|
|
|
return true if nextProps.visible isnt @props.visible
|
|
|
|
|
return not _.isEqual(nextState, @state)
|
|
|
|
|
|
2015-06-18 04:14:45 +08:00
|
|
|
|
componentWillUnmount: ->
|
|
|
|
|
unlisten() for unlisten in @_unlisteners
|
|
|
|
|
|
|
|
|
|
componentDidUpdate: ->
|
|
|
|
|
if @props.visible and not @state.active
|
|
|
|
|
@setState(active:true)
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps: (newProps) ->
|
|
|
|
|
if newProps.visible is false
|
|
|
|
|
@setState(active:false)
|
|
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
|
ContentComponent = ContentGeneric
|
2016-01-09 06:31:33 +08:00
|
|
|
|
|
|
|
|
|
messageOverride = "Nothing to display."
|
|
|
|
|
if @state.layoutMode is 'list'
|
|
|
|
|
ContentComponent = ContentQuotes
|
|
|
|
|
if @state.syncing
|
|
|
|
|
messageOverride = "Please wait while we prepare your mailbox."
|
2015-06-18 04:14:45 +08:00
|
|
|
|
|
2016-02-24 02:49:12 +08:00
|
|
|
|
if FocusedPerspectiveStore.current()?.name is "Inbox"
|
|
|
|
|
ContentComponent = InboxZero
|
|
|
|
|
|
2015-06-18 04:14:45 +08:00
|
|
|
|
classes = classNames
|
|
|
|
|
'empty-state': true
|
|
|
|
|
'visible': @props.visible
|
|
|
|
|
'active': @state.active
|
|
|
|
|
|
|
|
|
|
<div className={classes}>
|
|
|
|
|
<ContentComponent messageOverride={messageOverride}/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
_onChange: ->
|
|
|
|
|
@setState
|
|
|
|
|
layoutMode: WorkspaceStore.layoutMode()
|
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
|
|
|
|
syncing: NylasSyncStatusStore.busy()
|
2015-06-18 04:14:45 +08:00
|
|
|
|
|
|
|
|
|
module.exports = EmptyState
|