Make left panel more friendly to new users

https://github.com/vector-im/riot-web/issues/3609
This commit is contained in:
David Baker 2017-04-26 19:00:07 +01:00
parent b637ab33cc
commit 431b8aaefa
2 changed files with 30 additions and 6 deletions

View file

@ -82,6 +82,7 @@ var RoomSubList = React.createClass({
incomingCall: React.PropTypes.object,
onShowMoreRooms: React.PropTypes.func,
searchFilter: React.PropTypes.string,
emptyContent: React.PropTypes.node, // content shown if the list is empty
},
getInitialState: function() {
@ -468,16 +469,18 @@ var RoomSubList = React.createClass({
render: function() {
var connectDropTarget = this.props.connectDropTarget;
var RoomDropTarget = sdk.getComponent('rooms.RoomDropTarget');
var TruncatedList = sdk.getComponent('elements.TruncatedList');
var label = this.props.collapsed ? null : this.props.label;
//console.log("render: " + JSON.stringify(this.state.sortedList));
var target;
if (this.state.sortedList.length == 0 && this.props.editable) {
target = <RoomDropTarget label={ 'Drop here to ' + this.props.verb }/>;
let content;
if (this.state.sortedList.length == 0) {
//content = <RoomDropTarget label={ 'Drop here to ' + this.props.verb }/>;
content = this.props.emptyContent;
} else {
content = this.makeRoomTiles();
}
var roomCount = this.props.list.length > 0 ? this.props.list.length : '';
@ -497,8 +500,7 @@ var RoomSubList = React.createClass({
if (!this.state.hidden) {
subList = <TruncatedList className={ classes } truncateAt={this.state.truncateAt}
createOverflowElement={this._createOverflowTile} >
{ target }
{ this.makeRoomTiles() }
{ content }
</TruncatedList>;
}
else {