Allow extra tiles to be put into room sub lists

So we can put in tiles for group invites & other stuff
pull/4830/head
David Baker 2017-08-18 11:23:55 +01:00
parent 1a7a670c96
commit ee6e36cd90
1 changed files with 6 additions and 3 deletions

View File

@ -88,6 +88,7 @@ var RoomSubList = React.createClass({
searchFilter: React.PropTypes.string, searchFilter: React.PropTypes.string,
emptyContent: React.PropTypes.node, // content shown if the list is empty emptyContent: React.PropTypes.node, // content shown if the list is empty
headerItems: React.PropTypes.node, // content shown in the sublist header headerItems: React.PropTypes.node, // content shown in the sublist header
extraTiles: React.PropTypes.arrayOf(React.PropTypes.node), // extra elements added beneath tiles
}, },
getInitialState: function() { getInitialState: function() {
@ -101,7 +102,8 @@ var RoomSubList = React.createClass({
getDefaultProps: function() { getDefaultProps: function() {
return { return {
onHeaderClick: function() {}, // NOP onHeaderClick: function() {}, // NOP
onShowMoreRooms: function() {} // NOP onShowMoreRooms: function() {}, // NOP
extraTiles: [],
}; };
}, },
@ -532,13 +534,14 @@ var RoomSubList = React.createClass({
var label = this.props.collapsed ? null : this.props.label; var label = this.props.collapsed ? null : this.props.label;
let content; let content;
if (this.state.sortedList.length == 0 && !this.props.searchFilter) { if (this.state.sortedList.length == 0 && !this.props.searchFilter && !this.props.extraTiles) {
content = this.props.emptyContent; content = this.props.emptyContent;
} else { } else {
content = this.makeRoomTiles(); content = this.makeRoomTiles();
content.push(...this.props.extraTiles);
} }
if (this.state.sortedList.length > 0 || this.props.editable) { if (this.state.sortedList.length > 0 || this.props.extraTiles.length > 0 || this.props.editable) {
var subList; var subList;
var classes = "mx_RoomSubList"; var classes = "mx_RoomSubList";