Sort out right panel callapsing on GroupView

This commit is contained in:
David Baker 2017-08-15 13:12:39 +01:00
parent 64f352dda7
commit a15c2100d1
2 changed files with 31 additions and 12 deletions

View File

@ -216,6 +216,10 @@ export default React.createClass({
}); });
}, },
_onShowRhsClick: function(ev) {
dis.dispatch({ action: 'show_right_panel' });
},
_onEditClick: function() { _onEditClick: function() {
this.setState({ this.setState({
editing: true, editing: true,
@ -384,8 +388,8 @@ export default React.createClass({
let avatarNode; let avatarNode;
let nameNode; let nameNode;
let shortDescNode; let shortDescNode;
let rightButtons;
let roomBody; let roomBody;
let rightButtons = [];
const headerClasses = { const headerClasses = {
mx_GroupView_header: true, mx_GroupView_header: true,
}; };
@ -428,15 +432,19 @@ export default React.createClass({
placeholder={_t('Description')} placeholder={_t('Description')}
tabIndex="2" tabIndex="2"
/>; />;
rightButtons = <span> rightButtons.push(
<AccessibleButton className="mx_GroupView_saveButton mx_RoomHeader_textButton" onClick={this._onSaveClick}> <AccessibleButton className="mx_GroupView_saveButton mx_RoomHeader_textButton"
onClick={this._onSaveClick} key="_saveButton"
>
{_t('Save')} {_t('Save')}
</AccessibleButton> </AccessibleButton>
<AccessibleButton className='mx_GroupView_cancelButton' onClick={this._onCancelClick}> );
rightButtons.push(
<AccessibleButton className='mx_GroupView_cancelButton' onClick={this._onCancelClick} key="_cancelButton">
<img src="img/cancel.svg" className='mx_filterFlipColor' <img src="img/cancel.svg" className='mx_filterFlipColor'
width="18" height="18" alt={_t("Cancel")}/> width="18" height="18" alt={_t("Cancel")}/>
</AccessibleButton> </AccessibleButton>
</span>; );
roomBody = <div> roomBody = <div>
<textarea className="mx_GroupView_editLongDesc" value={this.state.profileForm.long_description} <textarea className="mx_GroupView_editLongDesc" value={this.state.profileForm.long_description}
onChange={this._onLongDescChange} onChange={this._onLongDescChange}
@ -471,12 +479,22 @@ export default React.createClass({
{this._getFeaturedRoomsNode()} {this._getFeaturedRoomsNode()}
{this._getFeaturedUsersNode()} {this._getFeaturedUsersNode()}
</div>; </div>;
// disabled until editing works rightButtons.push(
rightButtons = <AccessibleButton className="mx_GroupHeader_button" <AccessibleButton className="mx_GroupHeader_button"
onClick={this._onEditClick} title={_t("Edit Group")} onClick={this._onEditClick} title={_t("Edit Group")} key="_editButton"
> >
<TintableSvg src="img/icons-settings-room.svg" width="16" height="16"/> <TintableSvg src="img/icons-settings-room.svg" width="16" height="16"/>
</AccessibleButton>; </AccessibleButton>
);
if (this.props.collapsedRhs) {
rightButtons.push(
<AccessibleButton className="mx_GroupHeader_button"
onClick={this._onShowRhsClick} title={ _t('Show panel') } key="_maximiseButton"
>
<TintableSvg src="img/maximise.svg" width="10" height="16"/>
</AccessibleButton>
);
}
headerClasses.mx_GroupView_header_view = true; headerClasses.mx_GroupView_header_view = true;
} }

View File

@ -306,8 +306,9 @@ export default React.createClass({
case PageTypes.GroupView: case PageTypes.GroupView:
page_element = <GroupView page_element = <GroupView
groupId={this.props.currentGroupId} groupId={this.props.currentGroupId}
collapsedRhs={this.props.collapse_rhs}
/>; />;
right_panel = <RightPanel groupId={this.props.currentGroupId} opacity={this.props.rightOpacity} />; if (!this.props.collapse_rhs) right_panel = <RightPanel groupId={this.props.currentGroupId} opacity={this.props.rightOpacity} />;
break; break;
} }