import React, { Component } from 'react'; import PropTypes from 'prop-types'; import marked from 'marked'; import { connect } from 'react-redux'; import FileChatEntry from './FileChatEntry'; const scrollToBottom = () => { const messagesDiv = document.getElementById('messages'); messagesDiv.scrollTop = messagesDiv.scrollHeight; }; const linkRenderer = new marked.Renderer(); linkRenderer.link = (href, title, text) => { title = title ? title : href; text = text ? text : href; return (`${ text }`); }; class MessageList extends Component { componentDidMount() { scrollToBottom(); } componentDidUpdate() { scrollToBottom(); } getTimeString(time) { return `${(time.getHours() < 10 ? '0' : '')}${time.getHours()}:${(time.getMinutes() < 10 ? '0' : '')}${time.getMinutes()}`; } render() { const { chatmessages } = this.props; return (