diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 13330ec6..461c87fb 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -61,20 +61,34 @@ var RoomSubList = React.createClass({ tagName: React.PropTypes.string, editable: React.PropTypes.bool, order: React.PropTypes.string.isRequired, - bottommost: React.PropTypes.bool, selectedRoom: React.PropTypes.string.isRequired, activityMap: React.PropTypes.object.isRequired, + startAsHidden: React.PropTypes.bool, + showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded + + // TODO: Fix the name of this. This is too easily confused with the + // "hidden" state which is the expanded (or not) view of the list of rooms. + // What this prop *really* does is control whether the room name is displayed + // so it should be named as such. collapsed: React.PropTypes.bool.isRequired, - incomingCall: React.PropTypes.object, + onHeaderClick: React.PropTypes.func, + alwaysShowHeader: React.PropTypes.bool, + incomingCall: React.PropTypes.object }, getInitialState: function() { return { - hidden: false, + hidden: this.props.startAsHidden || false, sortedList: [], }; }, + getDefaultProps: function() { + return { + onHeaderClick: function() {} // NOP + }; + }, + componentWillMount: function() { this.sortList(this.props.list, this.props.order); }, @@ -86,7 +100,9 @@ var RoomSubList = React.createClass({ }, onClick: function(ev) { - this.setState({ hidden : !this.state.hidden }); + var isHidden = !this.state.hidden; + this.setState({ hidden : isHidden }); + this.props.onHeaderClick(isHidden); }, tsOfNewestEvent: function(room) { @@ -247,6 +263,17 @@ var RoomSubList = React.createClass({ }); }, + _getHeaderJsx: function() { + return ( +