Implement unread message status when scrolled up.

This commit is contained in:
Kegan Dougal 2015-07-22 14:49:32 +01:00
parent 8b0db49b8b
commit fbb6775523
2 changed files with 43 additions and 2 deletions

View file

@ -64,6 +64,13 @@ module.exports = React.createClass({
);
},
getUnreadMessagesString: function() {
if (!this.state.numUnreadMessages) {
return "";
}
return this.state.numUnreadMessages + " unread messages";
},
render: function() {
if (!this.state.room) {
return (
@ -120,7 +127,18 @@ module.exports = React.createClass({
);
} else {
var typingString = this.getWhoIsTypingString();
if (typingString) {
var unreadMsgs = this.getUnreadMessagesString();
// unread count trumps who is typing since the unread count is only
// set when you've scrolled up
if (unreadMsgs) {
statusBar = (
<div className="mx_RoomView_typingBar">
<img src="img/typing.png" width="40" height="40" alt=""/>
{unreadMsgs}
</div>
);
}
else if (typingString) {
statusBar = (
<div className="mx_RoomView_typingBar">
<img src="img/typing.png" width="40" height="40" alt=""/>