aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/components/list
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-26 20:40:03 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-26 20:40:03 +0200
commit157cb9c9713e08ff70078660a32dd77ecb87eabc (patch)
tree4a9066f820be014fcbddf582fd6b92bdb006dccf /client/angular/videos/components/list
parenta99593ed9f3244e75f7db793ba6716754d664573 (diff)
downloadPeerTube-157cb9c9713e08ff70078660a32dd77ecb87eabc.tar.gz
PeerTube-157cb9c9713e08ff70078660a32dd77ecb87eabc.tar.zst
PeerTube-157cb9c9713e08ff70078660a32dd77ecb87eabc.zip
Add a loader animation when loading the videos list
Diffstat (limited to 'client/angular/videos/components/list')
-rw-r--r--client/angular/videos/components/list/videos-list.component.html4
-rw-r--r--client/angular/videos/components/list/videos-list.component.scss31
-rw-r--r--client/angular/videos/components/list/videos-list.component.ts8
3 files changed, 28 insertions, 15 deletions
diff --git a/client/angular/videos/components/list/videos-list.component.html b/client/angular/videos/components/list/videos-list.component.html
index 3e30b39b0..edbbaf3ae 100644
--- a/client/angular/videos/components/list/videos-list.component.html
+++ b/client/angular/videos/components/list/videos-list.component.html
@@ -4,7 +4,9 @@
4</div> 4</div>
5 5
6<div class="videos-miniatures"> 6<div class="videos-miniatures">
7 <div *ngIf="videos.length === 0">There is no video.</div> 7 <my-loader [loading]="loading"></my-loader>
8
9 <div class="col-md-12 no-video" *ngIf="!loading && videos.length === 0">There is no video.</div>
8 10
9 <my-video-miniature *ngFor="let video of videos" [video]="video" [user]="user" (removed)="onRemoved(video)"> 11 <my-video-miniature *ngFor="let video of videos" [video]="video" [user]="user" (removed)="onRemoved(video)">
10 </my-video-miniature> 12 </my-video-miniature>
diff --git a/client/angular/videos/components/list/videos-list.component.scss b/client/angular/videos/components/list/videos-list.component.scss
index 2abc47b1b..9441d80c3 100644
--- a/client/angular/videos/components/list/videos-list.component.scss
+++ b/client/angular/videos/components/list/videos-list.component.scss
@@ -1,16 +1,3 @@
1.videos-miniatures {
2 min-height: 600px;
3}
4
5my-videos-miniature {
6 display: inline-block;
7}
8
9pagination {
10 display: block;
11 text-align: center;
12}
13
14.videos-info { 1.videos-info {
15 2
16 padding-bottom: 20px; 3 padding-bottom: 20px;
@@ -30,3 +17,21 @@ pagination {
30 padding-left: 0; 17 padding-left: 0;
31 } 18 }
32} 19}
20
21.videos-miniatures {
22 min-height: 600px;
23
24 my-videos-miniature {
25 display: inline-block;
26 }
27
28 .no-video {
29 margin-top: 50px;
30 text-align: center;
31 }
32}
33
34pagination {
35 display: block;
36 text-align: center;
37}
diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.ts
index 94b064e16..56230e331 100644
--- a/client/angular/videos/components/list/videos-list.component.ts
+++ b/client/angular/videos/components/list/videos-list.component.ts
@@ -12,12 +12,13 @@ import { VideoMiniatureComponent } from './video-miniature.component';
12import { Search, SearchField } from '../../../app/search'; 12import { Search, SearchField } from '../../../app/search';
13import { VideoSortComponent } from './video-sort.component'; 13import { VideoSortComponent } from './video-sort.component';
14import { SortField } from './sort'; 14import { SortField } from './sort';
15import { LoaderComponent } from '../../loader.component';
15 16
16@Component({ 17@Component({
17 selector: 'my-videos-list', 18 selector: 'my-videos-list',
18 styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ], 19 styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ],
19 templateUrl: 'app/angular/videos/components/list/videos-list.component.html', 20 templateUrl: 'app/angular/videos/components/list/videos-list.component.html',
20 directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent ] 21 directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent, LoaderComponent ]
21}) 22})
22 23
23export class VideosListComponent implements OnInit { 24export class VideosListComponent implements OnInit {
@@ -29,6 +30,7 @@ export class VideosListComponent implements OnInit {
29 total: 0 30 total: 0
30 }; 31 };
31 sort: SortField; 32 sort: SortField;
33 loading: boolean = false;
32 34
33 private search: Search; 35 private search: Search;
34 36
@@ -55,6 +57,9 @@ export class VideosListComponent implements OnInit {
55 } 57 }
56 58
57 getVideos() { 59 getVideos() {
60 this.loading = true;
61 this.videos = [];
62
58 let observable = null; 63 let observable = null;
59 64
60 if (this.search.value !== null) { 65 if (this.search.value !== null) {
@@ -67,6 +72,7 @@ export class VideosListComponent implements OnInit {
67 ({ videos, totalVideos }) => { 72 ({ videos, totalVideos }) => {
68 this.videos = videos; 73 this.videos = videos;
69 this.pagination.total = totalVideos; 74 this.pagination.total = totalVideos;
75 this.loading = false;
70 }, 76 },
71 error => alert(error) 77 error => alert(error)
72 ); 78 );