mirror of https://github.com/vector-im/riot-web
truncate room list
parent
0752c3a6d5
commit
0ee1892a0b
|
@ -78,6 +78,7 @@ var RoomSubList = React.createClass({
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
hidden: this.props.startAsHidden || false,
|
hidden: this.props.startAsHidden || false,
|
||||||
|
truncateAt: 20,
|
||||||
sortedList: [],
|
sortedList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -96,6 +97,10 @@ var RoomSubList = React.createClass({
|
||||||
// order the room list appropriately before we re-render
|
// order the room list appropriately before we re-render
|
||||||
//if (debug) console.log("received new props, list = " + newProps.list);
|
//if (debug) console.log("received new props, list = " + newProps.list);
|
||||||
this.sortList(newProps.list, newProps.order);
|
this.sortList(newProps.list, newProps.order);
|
||||||
|
|
||||||
|
if (newProps.collapsed) { // as good a way as any to reset the truncate state
|
||||||
|
this.setState({ truncateAt : 20 });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onClick: function(ev) {
|
onClick: function(ev) {
|
||||||
|
@ -272,9 +277,32 @@ var RoomSubList = React.createClass({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_createOverflowTile: function(overflowCount, totalCount) {
|
||||||
|
var BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
|
||||||
|
// XXX: this is duplicated from RoomTile - factor it out
|
||||||
|
return (
|
||||||
|
<div className="mx_RoomTile mx_RoomTile_ellipsis" onClick={this._showFullMemberList}>
|
||||||
|
<div className="mx_RoomTile_avatar">
|
||||||
|
<BaseAvatar url="img/ellipsis.svg" name="..." width={24} height={24} />
|
||||||
|
</div>
|
||||||
|
<div className="mx_RoomTile_name">and { overflowCount } others...</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
_showFullMemberList: function() {
|
||||||
|
this.setState({
|
||||||
|
truncateAt: -1
|
||||||
|
});
|
||||||
|
// kick gemini in the balls to get it to wake up
|
||||||
|
// XXX: uuuuuuugh.
|
||||||
|
this.props.list.forceUpdate();
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var connectDropTarget = this.props.connectDropTarget;
|
var connectDropTarget = this.props.connectDropTarget;
|
||||||
var RoomDropTarget = sdk.getComponent('rooms.RoomDropTarget');
|
var RoomDropTarget = sdk.getComponent('rooms.RoomDropTarget');
|
||||||
|
var TruncatedList = sdk.getComponent('elements.TruncatedList');
|
||||||
|
|
||||||
var label = this.props.collapsed ? null : this.props.label;
|
var label = this.props.collapsed ? null : this.props.label;
|
||||||
|
|
||||||
|
@ -290,14 +318,15 @@ var RoomSubList = React.createClass({
|
||||||
var classes = "mx_RoomSubList";
|
var classes = "mx_RoomSubList";
|
||||||
|
|
||||||
if (!this.state.hidden) {
|
if (!this.state.hidden) {
|
||||||
subList = <div className={ classes }>
|
subList = <TruncatedList className={ classes } truncateAt={this.state.truncateAt}
|
||||||
|
createOverflowElement={this._createOverflowTile} >
|
||||||
{ target }
|
{ target }
|
||||||
{ this.makeRoomTiles() }
|
{ this.makeRoomTiles() }
|
||||||
</div>;
|
</TruncatedList>;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
subList = <div className={ classes }>
|
subList = <TruncatedList className={ classes }>
|
||||||
</div>;
|
</TruncatedList>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return connectDropTarget(
|
return connectDropTarget(
|
||||||
|
|
|
@ -43,6 +43,11 @@ limitations under the License.
|
||||||
color: rgba(69, 69, 69, 0.8);
|
color: rgba(69, 69, 69, 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_RoomTile_ellipsis .mx_RoomTile_name {
|
||||||
|
font-style: italic;
|
||||||
|
color: #454545;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_RoomTile_invite {
|
.mx_RoomTile_invite {
|
||||||
/* color: rgba(69, 69, 69, 0.5);
|
/* color: rgba(69, 69, 69, 0.5);
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue