diff --git a/src/skins/vector/views/organisms/RightPanel.js b/src/skins/vector/views/organisms/RightPanel.js
index 58f742414..6d9dc743d 100644
--- a/src/skins/vector/views/organisms/RightPanel.js
+++ b/src/skins/vector/views/organisms/RightPanel.js
@@ -18,13 +18,12 @@ limitations under the License.
var React = require('react');
var sdk = require('matrix-react-sdk')
+var dis = require('matrix-react-sdk/lib/dispatcher');
module.exports = React.createClass({
displayName: 'RightPanel',
Phase : {
- Blank: 'Blank',
- None: 'None',
MemberList: 'MemberList',
FileList: 'FileList',
},
@@ -36,11 +35,16 @@ module.exports = React.createClass({
},
onMemberListButtonClick: function() {
- if (this.state.phase == this.Phase.None) {
- this.setState({ phase: this.Phase.MemberList });
+ if (this.props.collapsed) {
+ this.setState({ phase: this.Phase.MemberList });
+ dis.dispatch({
+ action: 'show_right_panel',
+ });
}
else {
- this.setState({ phase: this.Phase.None });
+ dis.dispatch({
+ action: 'hide_right_panel',
+ });
}
},
@@ -48,6 +52,7 @@ module.exports = React.createClass({
var MemberList = sdk.getComponent('organisms.MemberList');
var buttonGroup;
var panel;
+
if (this.props.roomId) {
buttonGroup =
@@ -59,13 +64,13 @@ module.exports = React.createClass({
;
- if (this.state.phase == this.Phase.MemberList) {
+ if (!this.props.collapsed && this.state.phase == this.Phase.MemberList) {
panel =
}
}
var classes = "mx_RightPanel";
- if (this.state.phase === this.Phase.None) {
+ if (this.props.collapsed) {
classes += " collapsed";
}
diff --git a/src/skins/vector/views/pages/MatrixChat.js b/src/skins/vector/views/pages/MatrixChat.js
index 688ac96ff..e15584599 100644
--- a/src/skins/vector/views/pages/MatrixChat.js
+++ b/src/skins/vector/views/pages/MatrixChat.js
@@ -31,6 +31,43 @@ module.exports = React.createClass({
displayName: 'MatrixChat',
mixins: [MatrixChatController],
+ getInitialState: function() {
+ return {
+ width: 10000,
+ }
+ },
+
+ componentDidMount: function() {
+ window.addEventListener('resize', this.handleResize);
+ this.handleResize();
+ },
+
+ componentWillUnmount: function() {
+ window.removeEventListener('resize', this.handleResize);
+ },
+
+ handleResize: function(e) {
+ var hideLhsThreshold = 1000;
+ var showLhsThreshold = 1000;
+ var hideRhsThreshold = 820;
+ var showRhsThreshold = 820;
+
+ if (this.state.width > hideLhsThreshold && window.innerWidth <= hideLhsThreshold) {
+ dis.dispatch({ action: 'hide_left_panel' });
+ }
+ if (this.state.width <= showLhsThreshold && window.innerWidth > showLhsThreshold) {
+ dis.dispatch({ action: 'show_left_panel' });
+ }
+ if (this.state.width > hideRhsThreshold && window.innerWidth <= hideRhsThreshold) {
+ dis.dispatch({ action: 'hide_right_panel' });
+ }
+ if (this.state.width <= showRhsThreshold && window.innerWidth > showRhsThreshold) {
+ dis.dispatch({ action: 'show_right_panel' });
+ }
+
+ this.setState({width: window.innerWidth});
+ },
+
onRoomCreated: function(room_id) {
dis.dispatch({
action: "view_room",
@@ -57,19 +94,19 @@ module.exports = React.createClass({
switch (this.state.page_type) {
case this.PageTypes.RoomView:
page_element =
- right_panel =
+ right_panel =
break;
case this.PageTypes.UserSettings:
page_element =
- right_panel =
+ right_panel =
break;
case this.PageTypes.CreateRoom:
page_element =
- right_panel =
+ right_panel =
break;
case this.PageTypes.RoomDirectory:
page_element =
- right_panel =
+ right_panel =
break;
}