diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-04 16:58:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-04 17:31:28 +0200 |
commit | b1ee8526d35eb7df4fb70ae755eae08e7497042c (patch) | |
tree | 0cf4ea1faeef2294dd4001708e917fb5f9699fc9 | |
parent | 8cd7faaa331f83903f0bbaead288661218e38bdb (diff) | |
download | PeerTube-b1ee8526d35eb7df4fb70ae755eae08e7497042c.tar.gz PeerTube-b1ee8526d35eb7df4fb70ae755eae08e7497042c.tar.zst PeerTube-b1ee8526d35eb7df4fb70ae755eae08e7497042c.zip |
Fix search results on mobile
-rw-r--r-- | client/src/app/search/search.component.html | 2 | ||||
-rw-r--r-- | client/src/app/search/search.component.scss | 3 | ||||
-rw-r--r-- | 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 @@ | |||
50 | <div class="video-info"> | 50 | <div class="video-info"> |
51 | <a class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a> | 51 | <a class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a> |
52 | <span i18n class="video-info-date-views">{{ result.publishedAt | myFromNow }} - {{ result.views | myNumberFormatter }} views</span> | 52 | <span i18n class="video-info-date-views">{{ result.publishedAt | myFromNow }} - {{ result.views | myNumberFormatter }} views</span> |
53 | <a class="video-info-account" [routerLink]="[ '/accounts', result.by ]">{{ result.by }}</a> | 53 | <a class="video-info-account" [routerLink]="[ '/accounts', result.byAccount ]">{{ result.byAccount }}</a> |
54 | </div> | 54 | </div> |
55 | </div> | 55 | </div> |
56 | </ng-container> | 56 | </ng-container> |
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 @@ | |||
23 | } | 23 | } |
24 | 24 | ||
25 | .results-filter-button { | 25 | .results-filter-button { |
26 | cursor: pointer; | ||
26 | 27 | ||
27 | .icon.icon-filter { | 28 | .icon.icon-filter { |
28 | @include icon(20px); | 29 | @include icon(20px); |
@@ -133,7 +134,7 @@ | |||
133 | 134 | ||
134 | @media screen and (max-width: 800px) { | 135 | @media screen and (max-width: 800px) { |
135 | .search-result { | 136 | .search-result { |
136 | margin: 20px 10px; | 137 | padding: 20px 10px; |
137 | } | 138 | } |
138 | 139 | ||
139 | .results-header { | 140 | .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 { | |||
31 | 31 | ||
32 | private subActivatedRoute: Subscription | 32 | private subActivatedRoute: Subscription |
33 | private isInitialLoad = true | 33 | private isInitialLoad = true |
34 | private firstSearch = true | ||
34 | 35 | ||
35 | private channelsPerPage = 2 | 36 | private channelsPerPage = 2 |
36 | 37 | ||
@@ -103,13 +104,16 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
103 | .concat(videosResult.videos) | 104 | .concat(videosResult.videos) |
104 | this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total | 105 | this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total |
105 | 106 | ||
106 | // Focus on channels | 107 | // Focus on channels if there are no enough videos |
107 | if (this.channelsPerPage !== 10 && videosResult.videos.length < this.pagination.itemsPerPage) { | 108 | if (this.firstSearch === true && videosResult.videos.length < this.pagination.itemsPerPage) { |
108 | this.resetPagination() | 109 | this.resetPagination() |
110 | this.firstSearch = false | ||
109 | 111 | ||
110 | this.channelsPerPage = 10 | 112 | this.channelsPerPage = 10 |
111 | this.search() | 113 | this.search() |
112 | } | 114 | } |
115 | |||
116 | this.firstSearch = false | ||
113 | }, | 117 | }, |
114 | 118 | ||
115 | error => { | 119 | error => { |