mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
32 lines
871 B
Text
32 lines
871 B
Text
|
React = require 'react/addons'
|
||
|
moment = require 'moment'
|
||
|
|
||
|
|
||
|
module.exports =
|
||
|
ActivityBarLongPollItem = React.createClass
|
||
|
displayName: 'ActivityBarLongPollItem'
|
||
|
|
||
|
getInitialState: ->
|
||
|
expanded: false
|
||
|
|
||
|
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>
|
||
|
|