import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import Radium from 'radium' import color from 'color' import Comment from './Comment.jsx' import Revision from './Revision.jsx' import { translate } from 'react-i18next' require('./Timeline.styl') class Timeline extends React.Component { componentDidMount () { this.scrollToBottom() } componentDidUpdate () { this.props.shouldScrollToBottom && this.scrollToBottom() } scrollToBottom = () => this.timelineBottom.scrollIntoView({behavior: 'instant'}) render () { const { props } = this if (!Array.isArray(props.timelineData)) { console.log('Error in Timeline.jsx, props.timelineData is not an array. timelineData: ', props.timelineData) return null } return (
{props.showHeader &&
{this.props.t('Timeline')}
} {props.isArchived &&
{this.props.t('This content is archived.')}
} {props.isDeleted &&
{this.props.t('This content is deleted.')}
}
    {props.timelineData.map(content => { switch (content.timelineType) { case 'comment': return case 'revision': return props.onClickRevisionBtn(content)} /> } })}
  • { this.timelineBottom = el }} />
{props.loggedUser.idRoleUserWorkspace >= 2 &&