From 138c63313465c0a77b495a1406d6982e037a04c4 Mon Sep 17 00:00:00 2001 From: f0x Date: Wed, 23 Jan 2019 16:13:53 +0100 Subject: [PATCH] fix room selecting --- components/filterList.js | 6 +++--- components/sidebar.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/filterList.js b/components/filterList.js index 3aa2e05..fe3ba77 100644 --- a/components/filterList.js +++ b/components/filterList.js @@ -10,14 +10,14 @@ let FilterList = create({ getInitialState: function() { return { - selection: -1, + selection: 0, filter: "" } }, select: function(id) { this.setState({selection: id}) - this.props.callback(id) + //this.props.callback(id) }, inputRef: function(ref) { @@ -39,7 +39,7 @@ let FilterList = create({ render: function() { let items = this.props.items.map((item, id) => { let props = { - active: this.state.selection == id, + selected: this.state.selection == id, filter: this.state.filter, content: item, key: id, diff --git a/components/sidebar.js b/components/sidebar.js index 3dec2db..ca0cc28 100644 --- a/components/sidebar.js +++ b/components/sidebar.js @@ -22,7 +22,7 @@ let RoomListItem = create({ return } this.setState({ref: ref}) - ref.addEventListener("click", () => {this.props.select(this.props.roomId)}) + ref.addEventListener("click", () => {this.props.select(this.props.listId)}) }, render: function() { @@ -30,7 +30,7 @@ let RoomListItem = create({ return null } let className = "roomListItem" - if (this.props.active) { + if (this.props.selected) { className += " active" } if (this.state.unread) {