diff --git a/src/atoms/MessageTimestamp.js b/src/atoms/MessageTimestamp.js new file mode 100644 index 00000000..4ccb318e --- /dev/null +++ b/src/atoms/MessageTimestamp.js @@ -0,0 +1,13 @@ +var React = require('react'); + +module.exports = React.createClass({ + render: function() { + var date = new Date(this.props.ts); + return ( + + {date.toLocaleTimeString()} + + ); + }, +}); + diff --git a/src/molecules/MTextTile.js b/src/molecules/MTextTile.js new file mode 100644 index 00000000..b4ff3f3c --- /dev/null +++ b/src/molecules/MTextTile.js @@ -0,0 +1,13 @@ +var React = require('react'); + +module.exports = React.createClass({ + render: function() { + var content = this.props.mxEvent.getContent(); + return ( + + {content.body} + + ); + }, +}); + diff --git a/src/molecules/MessageTile.js b/src/molecules/MessageTile.js index 0ae6c02a..9956ace8 100644 --- a/src/molecules/MessageTile.js +++ b/src/molecules/MessageTile.js @@ -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 (
- {JSON.stringify(this.props.mxEvent.getContent())} + + : +
); }, diff --git a/src/molecules/SenderProfile.js b/src/molecules/SenderProfile.js new file mode 100644 index 00000000..4481e465 --- /dev/null +++ b/src/molecules/SenderProfile.js @@ -0,0 +1,13 @@ +var React = require('react'); + +module.exports = React.createClass({ + render: function() { + var member = this.props.memberName; + return ( + + {member} + + ); + }, +}); + diff --git a/src/molecules/UnknownMessageTile.js b/src/molecules/UnknownMessageTile.js new file mode 100644 index 00000000..df217fb2 --- /dev/null +++ b/src/molecules/UnknownMessageTile.js @@ -0,0 +1,11 @@ +var React = require('react'); + +module.exports = React.createClass({ + render: function() { + return ( + + ? + + ); + }, +});