From b1ee8526d35eb7df4fb70ae755eae08e7497042c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Sep 2018 16:58:21 +0200 Subject: [PATCH] Fix search results on mobile --- client/src/app/search/search.component.html | 2 +- client/src/app/search/search.component.scss | 3 ++- client/src/app/search/search.component.ts | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client/src/app/search/search.component.html b/client/src/app/search/search.component.html index b35a46ec9..a258d4edd 100644 --- a/client/src/app/search/search.component.html +++ b/client/src/app/search/search.component.html @@ -50,7 +50,7 @@
{{ result.name }} {{ result.publishedAt | myFromNow }} - {{ result.views | myNumberFormatter }} views - +
diff --git a/client/src/app/search/search.component.scss b/client/src/app/search/search.component.scss index f394099e2..3be8f5311 100644 --- a/client/src/app/search/search.component.scss +++ b/client/src/app/search/search.component.scss @@ -23,6 +23,7 @@ } .results-filter-button { + cursor: pointer; .icon.icon-filter { @include icon(20px); @@ -133,7 +134,7 @@ @media screen and (max-width: 800px) { .search-result { - margin: 20px 10px; + padding: 20px 10px; } .results-header { diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts index 4c540ca72..475fdd277 100644 --- a/client/src/app/search/search.component.ts +++ b/client/src/app/search/search.component.ts @@ -31,6 +31,7 @@ export class SearchComponent implements OnInit, OnDestroy { private subActivatedRoute: Subscription private isInitialLoad = true + private firstSearch = true private channelsPerPage = 2 @@ -103,13 +104,16 @@ export class SearchComponent implements OnInit, OnDestroy { .concat(videosResult.videos) this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total - // Focus on channels - if (this.channelsPerPage !== 10 && videosResult.videos.length < this.pagination.itemsPerPage) { + // Focus on channels if there are no enough videos + if (this.firstSearch === true && videosResult.videos.length < this.pagination.itemsPerPage) { this.resetPagination() + this.firstSearch = false this.channelsPerPage = 10 this.search() } + + this.firstSearch = false }, error => { -- 2.41.0