fix(activity-sidebar): render correct copy on only correct moments

Summary:
fixes T3725

changes:
- show the sync mail activity only if number of deltas received is greater than 10
- make the sync mail activity notification persist for longer, since large deltas (>1k) come in intervals of about 25 seconds, which was greater than our previous timeout interval of 15 seconds
- change to clearer copy
- minor style changes to match new copy

Test Plan: tested manually

Reviewers: bengotow

Maniphest Tasks: T3725

Differential Revision: https://phab.nylas.com/D2051
This commit is contained in:
dillon 2015-09-22 14:05:26 -07:00
parent abdefb7d84
commit ab3da1891f
3 changed files with 10 additions and 7 deletions

View file

@ -3,6 +3,6 @@ NylasStore = require 'nylas-store'
class AccountSidebarLongPollStore extends NylasStore
constructor: ->
@listenTo Actions.longPollReceivedRawDeltasPing, => @trigger()
@listenTo Actions.longPollReceivedRawDeltasPing, (n) => @trigger(n)
module.exports = new AccountSidebarLongPollStore()

View file

@ -94,7 +94,7 @@ class ActivitySidebar extends React.Component
<div className="progress-track">
<div className="progress" style={width: "#{progress}%"}></div>
</div>
<div className="inner">Syncing mail data...</div>
<div className="inner">Syncing mail data&hellip;</div>
</div>
_renderTaskActivityItems: =>
@ -115,11 +115,11 @@ class ActivitySidebar extends React.Component
_renderDeltaSyncActivityItem: =>
<div className="item" key="delta-sync-item">
<div style={padding: "14px 7px 0 10px", float: "left"}>
<div style={padding: "8px 7px 0 10px", float: "left"}>
<RetinaImg name="sending-spinner.gif" mode={RetinaImg.Mode.ContentPreserve} />
</div>
<div className="inner">
Getting your mail&hellip;this might take a while
Syncing mail data&hellip;
</div>
</div>
@ -142,14 +142,17 @@ class ActivitySidebar extends React.Component
tasks: TaskQueueStatusStore.queue()
sync: NylasSyncStatusStore.state()
_onDeltaReceived: =>
_onDeltaReceived: (countDeltas) =>
tooSmallForNotification = countDeltas <= 10
return if tooSmallForNotification
if @_timeoutId
clearTimeout @_timeoutId
@_timeoutId = setTimeout(( =>
delete @_timeoutId
@setState receivingDelta: false
), 15000)
), 30000)
@setState receivingDelta: true

View file

@ -64,7 +64,7 @@ class NylasSyncWorkerPool
_handleDeltas: (deltas) ->
Actions.longPollReceivedRawDeltas(deltas)
Actions.longPollReceivedRawDeltasPing()
Actions.longPollReceivedRawDeltasPing(deltas.length)
# Create a (non-enumerable) reference from the attributes which we carry forward
# back to their original deltas. This allows us to mark the deltas that the