React = require 'react/addons' moment = require 'moment' class ActivityBarLongPollItem extends React.Component @displayName: 'ActivityBarLongPollItem' constructor: (@props) -> @state = 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")
@setState expanded: not @state?.expanded}>
{@props.item.cursor}
{" #{timestamp}: #{@props.item.event} #{@props.item.object} #{itemId}"}
e.stopPropagation() }> {payload}
module.exports = ActivityBarLongPollItem