var React = require('react'); var moment = require('moment'); var DIFF_PREFIXES = { A: ' ', E: ' ', D: '-', N: '+' } var SPADEN_CLASS = { A: 'blue', // array edited E: 'blue', // edited D: 'negative', // deleted N: 'positive', // added } var LogEntry = React.createClass({ propTypes: { event: React.PropTypes.object.isRequired }, render: function() { var date = moment(this.props.event.createdAt); return (
{prettyPrinted}
)
},
renderEventDiff: function() {
if (!this.props.showFullEvents && this.props.event.diffs) {
var changes = this.props.event.diffs.map(this.buildDiff);
return ({changes.length === 0 ? '(no changes)' : changes}
)
} else {
return this.renderFullEventData();
}
},
buildDiff: function(diff, idx) {
var change;
var key = diff.path.join('.');
if (diff.lhs !== undefined && diff.rhs !== undefined) {
change = (