matrix-bot/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 16:29:13 +02: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 15:27:13 +02:00
<SenderProfile mxEvent={this.props.mxEvent} />
<TileType mxEvent={this.props.mxEvent} />
</div>
);
},
});