wire up searchbox filtering

This commit is contained in:
Matthew Hodgson 2016-04-15 17:55:00 +01:00
parent 7c8d7e5361
commit a06b420942
2 changed files with 15 additions and 19 deletions

View file

@ -24,6 +24,7 @@ const KEY_WINDOWS = 91;
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'EditableText', displayName: 'EditableText',
propTypes: { propTypes: {
onValueChanged: React.PropTypes.func, onValueChanged: React.PropTypes.func,
initialValue: React.PropTypes.string, initialValue: React.PropTypes.string,

View file

@ -34,7 +34,8 @@ module.exports = React.createClass({
propTypes: { propTypes: {
ConferenceHandler: React.PropTypes.any, ConferenceHandler: React.PropTypes.any,
collapsed: React.PropTypes.bool, collapsed: React.PropTypes.bool,
currentRoom: React.PropTypes.string currentRoom: React.PropTypes.string,
searchFilter: React.PropTypes.string,
}, },
getInitialState: function() { getInitialState: function() {
@ -82,7 +83,7 @@ module.exports = React.createClass({
else { else {
this.setState({ this.setState({
incomingCall: null incomingCall: null
}); });
} }
break; break;
} }
@ -312,12 +313,6 @@ module.exports = React.createClass({
} }
}, },
onShowClick: function() {
dis.dispatch({
action: 'show_left_panel',
});
},
onShowMoreRooms: function() { onShowMoreRooms: function() {
// kick gemini in the balls to get it to wake up // kick gemini in the balls to get it to wake up
// XXX: uuuuuuugh. // XXX: uuuuuuugh.
@ -325,18 +320,12 @@ module.exports = React.createClass({
}, },
render: function() { render: function() {
var expandButton = this.props.collapsed ?
<img className="mx_RoomList_expandButton" onClick={ this.onShowClick } src="img/menu.png" width="20" alt=">"/> :
null;
var RoomSubList = sdk.getComponent('structures.RoomSubList'); var RoomSubList = sdk.getComponent('structures.RoomSubList');
var self = this; var self = this;
return ( return (
<GeminiScrollbar className="mx_RoomList_scrollbar" autoshow={true} onScroll={ self._repositionTooltips } ref="gemscroll"> <GeminiScrollbar className="mx_RoomList_scrollbar" autoshow={true} onScroll={ self._repositionTooltips } ref="gemscroll">
<div className="mx_RoomList"> <div className="mx_RoomList">
{ expandButton }
<RoomSubList list={ self.state.lists['im.vector.fake.invite'] } <RoomSubList list={ self.state.lists['im.vector.fake.invite'] }
label="Invites" label="Invites"
editable={ false } editable={ false }
@ -344,7 +333,8 @@ module.exports = React.createClass({
selectedRoom={ self.props.selectedRoom } selectedRoom={ self.props.selectedRoom }
incomingCall={ self.state.incomingCall } incomingCall={ self.state.incomingCall }
collapsed={ self.props.collapsed } collapsed={ self.props.collapsed }
onShowMoreRooms={ this.onShowMoreRooms } /> searchFilter={ self.props.searchFilter }
onShowMoreRooms={ self.onShowMoreRooms } />
<RoomSubList list={ self.state.lists['m.favourite'] } <RoomSubList list={ self.state.lists['m.favourite'] }
label="Favourites" label="Favourites"
@ -355,7 +345,8 @@ module.exports = React.createClass({
selectedRoom={ self.props.selectedRoom } selectedRoom={ self.props.selectedRoom }
incomingCall={ self.state.incomingCall } incomingCall={ self.state.incomingCall }
collapsed={ self.props.collapsed } collapsed={ self.props.collapsed }
onShowMoreRooms={ this.onShowMoreRooms } /> searchFilter={ self.props.searchFilter }
onShowMoreRooms={ self.onShowMoreRooms } />
<RoomSubList list={ self.state.lists['im.vector.fake.recent'] } <RoomSubList list={ self.state.lists['im.vector.fake.recent'] }
label="Rooms" label="Rooms"
@ -365,7 +356,8 @@ module.exports = React.createClass({
selectedRoom={ self.props.selectedRoom } selectedRoom={ self.props.selectedRoom }
incomingCall={ self.state.incomingCall } incomingCall={ self.state.incomingCall }
collapsed={ self.props.collapsed } collapsed={ self.props.collapsed }
onShowMoreRooms={ this.onShowMoreRooms } /> searchFilter={ self.props.searchFilter }
onShowMoreRooms={ self.onShowMoreRooms } />
{ Object.keys(self.state.lists).map(function(tagName) { { Object.keys(self.state.lists).map(function(tagName) {
if (!tagName.match(/^(m\.(favourite|lowpriority)|im\.vector\.fake\.(invite|recent|archived))$/)) { if (!tagName.match(/^(m\.(favourite|lowpriority)|im\.vector\.fake\.(invite|recent|archived))$/)) {
@ -379,6 +371,7 @@ module.exports = React.createClass({
selectedRoom={ self.props.selectedRoom } selectedRoom={ self.props.selectedRoom }
incomingCall={ self.state.incomingCall } incomingCall={ self.state.incomingCall }
collapsed={ self.props.collapsed } collapsed={ self.props.collapsed }
searchFilter={ self.props.searchFilter }
onShowMoreRooms={ self.onShowMoreRooms } /> onShowMoreRooms={ self.onShowMoreRooms } />
} }
@ -393,7 +386,8 @@ module.exports = React.createClass({
selectedRoom={ self.props.selectedRoom } selectedRoom={ self.props.selectedRoom }
incomingCall={ self.state.incomingCall } incomingCall={ self.state.incomingCall }
collapsed={ self.props.collapsed } collapsed={ self.props.collapsed }
onShowMoreRooms={ this.onShowMoreRooms } /> searchFilter={ self.props.searchFilter }
onShowMoreRooms={ self.onShowMoreRooms } />
<RoomSubList list={ self.state.lists['im.vector.fake.archived'] } <RoomSubList list={ self.state.lists['im.vector.fake.archived'] }
label="Historical" label="Historical"
@ -406,7 +400,8 @@ module.exports = React.createClass({
showSpinner={ self.state.isLoadingLeftRooms } showSpinner={ self.state.isLoadingLeftRooms }
onHeaderClick= { self.onArchivedHeaderClick } onHeaderClick= { self.onArchivedHeaderClick }
incomingCall={ self.state.incomingCall } incomingCall={ self.state.incomingCall }
onShowMoreRooms={ this.onShowMoreRooms } /> searchFilter={ self.props.searchFilter }
onShowMoreRooms={ self.onShowMoreRooms } />
</div> </div>
</GeminiScrollbar> </GeminiScrollbar>
); );