You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-06-23 05:41:39 +03:00
hide settings/search appropriately
pass inRoom prop to RoomHeader (defaults to false) remove default onSettingsClick, handle if it is passed EVERYWHERE if onSettingsClick is passes, show that button show search button only if we are in the room, seems to fail otherwise this seems to handle all cases I could throw at it. Give it your best Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@ -1772,6 +1772,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}
|
||||||
|
inRoom={myMember && myMember.membership === 'join'}
|
||||||
collapsedRhs={ this.props.collapsedRhs }
|
collapsedRhs={ this.props.collapsedRhs }
|
||||||
onSearchClick={this.onSearchClick}
|
onSearchClick={this.onSearchClick}
|
||||||
onSettingsClick={this.onSettingsClick}
|
onSettingsClick={this.onSettingsClick}
|
||||||
|
@ -39,6 +39,7 @@ module.exports = React.createClass({
|
|||||||
oobData: React.PropTypes.object,
|
oobData: React.PropTypes.object,
|
||||||
editing: React.PropTypes.bool,
|
editing: React.PropTypes.bool,
|
||||||
saving: React.PropTypes.bool,
|
saving: React.PropTypes.bool,
|
||||||
|
inRoom: React.PropTypes.bool,
|
||||||
collapsedRhs: React.PropTypes.bool,
|
collapsedRhs: React.PropTypes.bool,
|
||||||
onSettingsClick: React.PropTypes.func,
|
onSettingsClick: React.PropTypes.func,
|
||||||
onSaveClick: React.PropTypes.func,
|
onSaveClick: React.PropTypes.func,
|
||||||
@ -49,7 +50,7 @@ module.exports = React.createClass({
|
|||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
return {
|
return {
|
||||||
editing: false,
|
editing: false,
|
||||||
onSettingsClick: function() {},
|
inRoom: false,
|
||||||
onSaveClick: function() {},
|
onSaveClick: function() {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -225,12 +226,17 @@ module.exports = React.createClass({
|
|||||||
roomName = this.props.room.name;
|
roomName = this.props.room.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const innerName =
|
||||||
|
<EmojiText element="div"
|
||||||
|
className={ "mx_RoomHeader_nametext " + (settingsHint ? "mx_RoomHeader_settingsHint" : "") }
|
||||||
|
title={ roomName }>{roomName}</EmojiText>;
|
||||||
|
|
||||||
|
if (this.props.onSettingsClick) {
|
||||||
|
name = <div className="mx_RoomHeader_name" onClick={this.props.onSettingsClick}>{ innerName }{ searchStatus }</div>;
|
||||||
|
} else {
|
||||||
|
name = <div className="mx_RoomHeader_name">{ innerName }{ searchStatus }</div>;
|
||||||
|
}
|
||||||
|
|
||||||
name =
|
|
||||||
<div className="mx_RoomHeader_name" onClick={this.props.onSettingsClick}>
|
|
||||||
<EmojiText element="div" className={ "mx_RoomHeader_nametext " + (settingsHint ? "mx_RoomHeader_settingsHint" : "") } title={ roomName }>{roomName}</EmojiText>
|
|
||||||
{ searchStatus }
|
|
||||||
</div>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (can_set_room_topic) {
|
if (can_set_room_topic) {
|
||||||
@ -299,6 +305,14 @@ module.exports = React.createClass({
|
|||||||
</AccessibleButton>;
|
</AccessibleButton>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let search_button;
|
||||||
|
if (this.props.onSearchClick && this.props.inRoom) {
|
||||||
|
search_button =
|
||||||
|
<AccessibleButton className="mx_RoomHeader_button" onClick={this.props.onSearchClick} title="Search">
|
||||||
|
<TintableSvg src="img/icons-search.svg" width="35" height="35"/>
|
||||||
|
</AccessibleButton>;
|
||||||
|
}
|
||||||
|
|
||||||
var rightPanel_buttons;
|
var rightPanel_buttons;
|
||||||
if (this.props.collapsedRhs) {
|
if (this.props.collapsedRhs) {
|
||||||
rightPanel_buttons =
|
rightPanel_buttons =
|
||||||
@ -313,9 +327,7 @@ module.exports = React.createClass({
|
|||||||
<div className="mx_RoomHeader_rightRow">
|
<div className="mx_RoomHeader_rightRow">
|
||||||
{ settings_button }
|
{ settings_button }
|
||||||
{ forget_button }
|
{ forget_button }
|
||||||
<AccessibleButton className="mx_RoomHeader_button" onClick={this.props.onSearchClick} title="Search">
|
{ search_button }
|
||||||
<TintableSvg src="img/icons-search.svg" width="35" height="35"/>
|
|
||||||
</AccessibleButton>
|
|
||||||
{ rightPanel_buttons }
|
{ rightPanel_buttons }
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user