make it work

This commit is contained in:
Matthew Hodgson 2016-09-13 19:00:35 +01:00
parent 32b1b6f58a
commit eb6a4f97ba
3 changed files with 31 additions and 4 deletions

View file

@ -1398,7 +1398,11 @@ module.exports = React.createClass({
// We have a regular invite for this room.
return (
<div className="mx_RoomView">
<RoomHeader ref="header" room={this.state.room}/>
<RoomHeader
ref="header"
room={this.state.room}
collapsedRhs={ this.props.collapsedRhs }
/>
<div className="mx_RoomView_auxPanel">
<RoomPreviewBar onJoinClick={ this.onJoinButtonClicked }
onRejectClick={ this.onRejectButtonClicked }
@ -1607,6 +1611,7 @@ module.exports = React.createClass({
oobData={this.props.oobData}
editing={this.state.editingRoomSettings}
saving={this.state.uploadingRoomSettings}
collapsedRhs={ this.props.collapsedRhs }
onSearchClick={this.onSearchClick}
onSettingsClick={this.onSettingsClick}
onSaveClick={this.onSettingsSaveClick}

View file

@ -115,8 +115,8 @@ module.exports = React.createClass({
}).done();
},
onCollapseRhsClick: function(ev) {
dis.dispatch({ action: 'hide_right_panel' });
onShowRhsClick: function(ev) {
dis.dispatch({ action: 'show_right_panel' });
},
/**
@ -294,7 +294,7 @@ module.exports = React.createClass({
var rightPanel_buttons;
if (this.props.collapsedRhs) {
rightPanel_buttons =
<div className="mx_RoomHeader_button" onClick={this.onCollapseRhsClick} title=">">
<div className="mx_RoomHeader_button" onClick={this.onShowRhsClick} title=">">
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
</div>
}

View file

@ -17,6 +17,8 @@ limitations under the License.
'use strict';
var React = require('react');
var sdk = require('../../../index');
var dis = require("../../../dispatcher");
/*
* A stripped-down room header used for things like the user settings
@ -28,19 +30,39 @@ module.exports = React.createClass({
propTypes: {
title: React.PropTypes.string,
onCancelClick: React.PropTypes.func,
// is the RightPanel collapsed?
collapsedRhs: React.PropTypes.bool,
},
onShowRhsClick: function(ev) {
dis.dispatch({ action: 'show_right_panel' });
},
render: function() {
var TintableSvg = sdk.getComponent("elements.TintableSvg");
var cancelButton;
if (this.props.onCancelClick) {
cancelButton = <div className="mx_RoomHeader_cancelButton" onClick={this.props.onCancelClick}><img src="img/cancel.svg" width="18" height="18" alt="Cancel"/> </div>
}
var showRhsButton;
/* // don't bother cluttering things up with this for now.
if (this.props.collapsedRhs) {
showRhsButton =
<div className="mx_RoomHeader_button" style={{ float: 'right' }} onClick={this.onShowRhsClick} title=">">
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
</div>
}
*/
return (
<div className="mx_RoomHeader" >
<div className="mx_RoomHeader_wrapper">
<div className="mx_RoomHeader_simpleHeader">
{ this.props.title }
{ showRhsButton }
{ cancelButton }
</div>
</div>