Mailspring/internal_packages/developer-bar/lib/developer-bar-long-poll-item.cjsx
Ben Gotow 0efdec5fd5 fix(initial-sync): Make initial sync more robust, show progress, retry on failure
Summary:
Rename ActivityBar => DeveloperBar

Expose sync workers and make them observable

New activity sidebar that replaces momentary notifications

Updated specs

Test Plan: Run new specs!

Reviewers: evan

Reviewed By: evan

Maniphest Tasks: T1131

Differential Revision: https://phab.nylas.com/D1521
2015-05-19 15:59:37 -07:00

36 lines
1.1 KiB
CoffeeScript

React = require 'react/addons'
moment = require 'moment'
{Utils} = require 'nylas-exports'
class DeveloperBarLongPollItem extends React.Component
@displayName: 'DeveloperBarLongPollItem'
constructor: (@props) ->
@state = expanded: false
shouldComponentUpdate: (nextProps, nextState) =>
return not Utils.isEqualReact(nextProps, @props) or not Utils.isEqualReact(nextState, @state)
render: =>
if @state.expanded
payload = JSON.stringify(@props.item)
else
payload = []
itemId = @props.item.id
itemVersion = @props.item.version || @props.item.attributes?.version
itemId += " (version #{itemVersion})" if itemVersion
timestamp = moment(@props.item.timestamp).format("h:mm:ss")
<div className={"item"} onClick={ => @setState expanded: not @state?.expanded}>
<div className="cursor">{@props.item.cursor}</div>
{" #{timestamp}: #{@props.item.event} #{@props.item.object} #{itemId}"}
<div className="payload" onClick={ (e) -> e.stopPropagation() }>
{payload}
</div>
</div>
module.exports = DeveloperBarLongPollItem