Start rendering messages with something more than the json

pull/1/head
David Baker 2015-06-16 11:58:03 +01:00
parent 88e9ab02f9
commit 672258f604
5 changed files with 68 additions and 2 deletions

View File

@ -0,0 +1,13 @@
var React = require('react');
module.exports = React.createClass({
render: function() {
var date = new Date(this.props.ts);
return (
<span className="mx_MessageTimestamp">
{date.toLocaleTimeString()}
</span>
);
},
});

View File

@ -0,0 +1,13 @@
var React = require('react');
module.exports = React.createClass({
render: function() {
var content = this.props.mxEvent.getContent();
return (
<span className="mx_MTextTile">
{content.body}
</span>
);
},
});

View File

@ -1,11 +1,27 @@
var React = require('react');
var MessageTimestamp = require('../atoms/MessageTimestamp');
var SenderProfile = require('../molecules/SenderProfile');
var UnknownMessageTile = require('../molecules/UnknownMessageTile');
var tileTypes = {
'm.text': require('../molecules/MTextTile')
};
module.exports = React.createClass({
render: function() {
//{this.props.mxEvent.getContent().body}
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">
{JSON.stringify(this.props.mxEvent.getContent())}
<MessageTimestamp ts={this.props.mxEvent.getTs()} />
<SenderProfile memberName={this.props.mxEvent.getSender()} />:
<TileType mxEvent={this.props.mxEvent} />
</div>
);
},

View File

@ -0,0 +1,13 @@
var React = require('react');
module.exports = React.createClass({
render: function() {
var member = this.props.memberName;
return (
<span className="mx_SenderProfile">
{member}
</span>
);
},
});

View File

@ -0,0 +1,11 @@
var React = require('react');
module.exports = React.createClass({
render: function() {
return (
<span className="mx_UnknownMessageTile">
?
</span>
);
},
});