From 765e5bdeb163b2be848b03a7112fa7c479e6cd8b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 21 Dec 2015 12:39:10 +0000 Subject: [PATCH 1/2] Add a 'top-of-search' marker Ugly as hell, pending better suggestions. This fixes https://github.com/vector-im/vector-web/issues/547 --- src/components/structures/RoomView.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index e7b97021df..3f79e1afe0 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -521,6 +521,7 @@ module.exports = React.createClass({ searchResults: [], searchHighlights: [], searchCount: null, + searchCanPaginate: null, }); this.savedSearchScrollState = {atBottom: true}; @@ -579,6 +580,7 @@ module.exports = React.createClass({ searchHighlights: highlights, searchResults: events, searchCount: results.count, + searchCanPaginate: !!(results.next_batch), }); self.nextSearchBatch = results.next_batch; }, function(error) { @@ -639,6 +641,13 @@ module.exports = React.createClass({ var lastRoomId; + if (this.state.searchCanPaginate === false) { + ret.push(
  • +

    End of search results

    +
  • + ); + } + for (var i = this.state.searchResults.length - 1; i >= 0; i--) { var result = this.state.searchResults[i]; var mxEv = new Matrix.MatrixEvent(result.result); From 7c285f9ad0ea62f629bb49cc378bbea277341a94 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 21 Dec 2015 13:46:27 +0000 Subject: [PATCH 2/2] Add a 'No results' marker when there are no search results at all. Also reword the 'no more results' marker. --- src/components/structures/RoomView.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 3f79e1afe0..d7d3d5988c 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -642,10 +642,17 @@ module.exports = React.createClass({ var lastRoomId; if (this.state.searchCanPaginate === false) { - ret.push(
  • -

    End of search results

    -
  • - ); + if (this.state.searchResults.length == 0) { + ret.push(
  • +

    No results

    +
  • + ); + } else { + ret.push(
  • +

    No more results

    +
  • + ); + } } for (var i = this.state.searchResults.length - 1; i >= 0; i--) {