schildi-web/src/molecules/MessageTile.js

31 lines
934 B
JavaScript
Raw Normal View History

var React = require('react');
var MessageTimestamp = require('../atoms/MessageTimestamp');
var SenderProfile = require('../molecules/SenderProfile');
var UnknownMessageTile = require('../molecules/UnknownMessageTile');
var tileTypes = {
2015-06-16 10:29:13 -04:00
'm.text': require('../molecules/MTextTile'),
'm.emote': require('../molecules/MEmoteTile')
};
module.exports = React.createClass({
render: function() {
var content = this.props.mxEvent.getContent();
var msgtype = content.msgtype;
var TileType = UnknownMessageTile;
if (msgtype && tileTypes[msgtype]) {
TileType = tileTypes[msgtype];
}
return (
<div className="mx_MessageTile">
<MessageTimestamp ts={this.props.mxEvent.getTs()} />
2015-06-16 09:27:13 -04:00
<SenderProfile mxEvent={this.props.mxEvent} />
<TileType mxEvent={this.props.mxEvent} />
</div>
);
},
});