diff --git a/css/molecules/RoomTile.css b/css/molecules/RoomTile.css index a762b1cb..50a7157b 100644 --- a/css/molecules/RoomTile.css +++ b/css/molecules/RoomTile.css @@ -27,6 +27,10 @@ background-color: #66e; } +.mx_RoomTile.invited { + background-color: #6e6; +} + .mx_RoomTile:hover { background-color: #ff8; } diff --git a/css/organisms/RoomView.css b/css/organisms/RoomView.css index 87d94e94..5599039e 100644 --- a/css/organisms/RoomView.css +++ b/css/organisms/RoomView.css @@ -24,6 +24,17 @@ list-style-type: none; } +.mx_RoomView .mx_RoomView_invitePrompt { + text-align: center; + background-color: #ddd; + border: 1px solid black; + width: 400px; + margin-left: auto; + margin-right: auto; + margin-top: 200px; + padding: 50px; +} + .mx_RoomView .mx_MemberList { position: absolute; top: 35px; diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index 35e7aab1..673ba782 100644 --- a/src/controllers/organisms/RoomView.js +++ b/src/controllers/organisms/RoomView.js @@ -26,23 +26,44 @@ module.exports = { onRoomTimeline: function(ev, room, toStartOfTimeline) { if (room.roomId != this.props.roomId) return; - var messageUl = this.refs.messageList.getDOMNode(); - this.atBottom = messageUl.scrollHeight - messageUl.scrollTop <= messageUl.clientHeight; + + if (this.refs.messageList) { + var messageUl = this.refs.messageList.getDOMNode(); + this.atBottom = messageUl.scrollHeight - messageUl.scrollTop <= messageUl.clientHeight; + } this.setState({ room: MatrixClientPeg.get().getRoom(this.props.roomId) }); }, componentDidMount: function() { - var messageUl = this.refs.messageList.getDOMNode(); - messageUl.scrollTop = messageUl.scrollHeight; - }, - - componentDidUpdate: function() { - if (this.atBottom) { + if (this.refs.messageList) { var messageUl = this.refs.messageList.getDOMNode(); messageUl.scrollTop = messageUl.scrollHeight; } + }, + + componentDidUpdate: function() { + if (this.refs.messageList && this.atBottom) { + var messageUl = this.refs.messageList.getDOMNode(); + messageUl.scrollTop = messageUl.scrollHeight; + } + }, + + onJoinButtonClicked: function(ev) { + MatrixClientPeg.get().joinRoom(this.props.roomId).then(function() { + this.setState({ + joining: undefined + }); + }, function(error) { + this.setState({ + joining: undefined, + joinError: error + }); + }); + this.setState({ + joining: true + }); } }; diff --git a/src/views/molecules/RoomTile.js b/src/views/molecules/RoomTile.js index f77e881e..c772b06f 100644 --- a/src/views/molecules/RoomTile.js +++ b/src/views/molecules/RoomTile.js @@ -3,14 +3,18 @@ var classNames = require('classnames'); var RoomTileController = require("../../controllers/molecules/RoomTile"); +var MatrixClientPeg = require("../../MatrixClientPeg"); + module.exports = React.createClass({ displayName: 'RoomTile', mixins: [RoomTileController], render: function() { + var myUserId = MatrixClientPeg.get().credentials.userId; var classes = classNames({ 'mx_RoomTile': true, 'selected': this.props.selected, - 'unread': this.props.unread + 'unread': this.props.unread, + 'invited': this.props.room.currentState.members[myUserId].membership == 'invite' }); return (