aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-list/video-overview.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-30 14:58:00 +0200
committerChocobozzz <me@florianbigard.com>2018-08-31 09:19:58 +0200
commit2d3741d6d92e9bd1f41694c7442a6d1da434e1f2 (patch)
tree93a1e609e14bc14ca9e77a6661ddc9c0e461d6f3 /client/src/app/videos/video-list/video-overview.component.ts
parentd9eaee3939bf2e93e5d775d32bce77842201faba (diff)
downloadPeerTube-2d3741d6d92e9bd1f41694c7442a6d1da434e1f2.tar.gz
PeerTube-2d3741d6d92e9bd1f41694c7442a6d1da434e1f2.tar.zst
PeerTube-2d3741d6d92e9bd1f41694c7442a6d1da434e1f2.zip
Videos overview page: first version
Diffstat (limited to 'client/src/app/videos/video-list/video-overview.component.ts')
-rw-r--r--client/src/app/videos/video-list/video-overview.component.ts56
1 files changed, 56 insertions, 0 deletions
diff --git a/client/src/app/videos/video-list/video-overview.component.ts b/client/src/app/videos/video-list/video-overview.component.ts
new file mode 100644
index 000000000..c758e115c
--- /dev/null
+++ b/client/src/app/videos/video-list/video-overview.component.ts
@@ -0,0 +1,56 @@
1import { Component, OnInit } from '@angular/core'
2import { AuthService } from '@app/core'
3import { NotificationsService } from 'angular2-notifications'
4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { VideosOverview } from '@app/shared/overview/videos-overview.model'
6import { OverviewService } from '@app/shared/overview'
7import { Video } from '@app/shared/video/video.model'
8
9@Component({
10 selector: 'my-video-overview',
11 templateUrl: './video-overview.component.html',
12 styleUrls: [ './video-overview.component.scss' ]
13})
14export class VideoOverviewComponent implements OnInit {
15 overview: VideosOverview = {
16 categories: [],
17 channels: [],
18 tags: []
19 }
20 notResults = false
21
22 constructor (
23 private i18n: I18n,
24 private notificationsService: NotificationsService,
25 private authService: AuthService,
26 private overviewService: OverviewService
27 ) { }
28
29 get user () {
30 return this.authService.getUser()
31 }
32
33 ngOnInit () {
34 this.overviewService.getVideosOverview()
35 .subscribe(
36 overview => {
37 this.overview = overview
38
39 if (
40 this.overview.categories.length === 0 &&
41 this.overview.channels.length === 0 &&
42 this.overview.tags.length === 0
43 ) this.notResults = true
44 },
45
46 err => {
47 console.log(err)
48 this.notificationsService.error('Error', err.text)
49 }
50 )
51 }
52
53 buildVideoChannelBy (object: { videos: Video[] }) {
54 return object.videos[0].byVideoChannel
55 }
56}