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

View file

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

View file

@ -17,6 +17,8 @@ limitations under the License.
'use strict'; 'use strict';
var React = require('react'); var React = require('react');
var sdk = require('../../../index');
var dis = require("../../../dispatcher");
/* /*
* A stripped-down room header used for things like the user settings * A stripped-down room header used for things like the user settings
@ -28,19 +30,39 @@ module.exports = React.createClass({
propTypes: { propTypes: {
title: React.PropTypes.string, title: React.PropTypes.string,
onCancelClick: React.PropTypes.func, onCancelClick: React.PropTypes.func,
// is the RightPanel collapsed?
collapsedRhs: React.PropTypes.bool,
},
onShowRhsClick: function(ev) {
dis.dispatch({ action: 'show_right_panel' });
}, },
render: function() { render: function() {
var TintableSvg = sdk.getComponent("elements.TintableSvg");
var cancelButton; var cancelButton;
if (this.props.onCancelClick) { 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> 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 ( return (
<div className="mx_RoomHeader" > <div className="mx_RoomHeader" >
<div className="mx_RoomHeader_wrapper"> <div className="mx_RoomHeader_wrapper">
<div className="mx_RoomHeader_simpleHeader"> <div className="mx_RoomHeader_simpleHeader">
{ this.props.title } { this.props.title }
{ showRhsButton }
{ cancelButton } { cancelButton }
</div> </div>
</div> </div>