- { buttons }
+ return buttons;
+ }
+
+ private renderName(oobName) {
+ let contextMenu: JSX.Element;
+ if (this.state.contextMenuPosition && this.props.room) {
+ contextMenu = (
+
+ );
+ }
+
+ // XXX: this is a bit inefficient - we could just compare room.name for 'Empty room'...
+ let settingsHint = false;
+ const members = this.props.room ? this.props.room.getJoinedMembers() : undefined;
+ if (members) {
+ if (members.length === 1 && members[0].userId === MatrixClientPeg.get().credentials.userId) {
+ const nameEvent = this.props.room.currentState.getStateEvents('m.room.name', '');
+ if (!nameEvent || !nameEvent.getContent().name) {
+ settingsHint = true;
+ }
+ }
+ }
+
+ const textClasses = classNames('mx_RoomHeader_nametext', { mx_RoomHeader_settingsHint: settingsHint });
+ const roomName =
+ { (name) => {
+ const roomName = name || oobName;
+ return { roomName }
;
+ } }
+ ;
+
+ if (this.props.enableRoomOptionsMenu) {
+ return (
+
+ { roomName }
+ { this.props.room && }
+ { contextMenu }
+
+ );
+ }
+
+ return
+ { roomName }
+
;
+ }
+
+ public render() {
+ let searchStatus = null;
+
+ // don't display the search count until the search completes and
+ // gives us a valid (possibly zero) searchCount.
+ if (this.props.searchInfo &&
+ this.props.searchInfo.searchCount !== undefined &&
+ this.props.searchInfo.searchCount !== null) {
+ searchStatus =
+ { _t("(~%(count)s results)", { count: this.props.searchInfo.searchCount }) }
;
+ }
+
+ let oobName = _t("Join Room");
+ if (this.props.oobData && this.props.oobData.name) {
+ oobName = this.props.oobData.name;
+ }
+
+ const name = this.renderName(oobName);
+
+ const topicElement =
;
+
+ let roomAvatar;
+ if (this.props.room) {
+ roomAvatar =
;
+ }
+
+ let buttons;
+ if (this.props.showButtons) {
+ buttons =
+
+ { this.renderButtons() }
+
+
+ ;
+ }
const e2eIcon = this.props.e2eStatus ?
: undefined;
@@ -294,8 +319,7 @@ export default class RoomHeader extends React.Component
{
{ searchStatus }
{ topicElement }
{ betaPill }
- { rightRow }
-
+ { buttons }