From 2d3741d6d92e9bd1f41694c7442a6d1da434e1f2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 Aug 2018 14:58:00 +0200 Subject: Videos overview page: first version --- .../videos/video-list/video-overview.component.ts | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 client/src/app/videos/video-list/video-overview.component.ts (limited to 'client/src/app/videos/video-list/video-overview.component.ts') 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 @@ +import { Component, OnInit } from '@angular/core' +import { AuthService } from '@app/core' +import { NotificationsService } from 'angular2-notifications' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideosOverview } from '@app/shared/overview/videos-overview.model' +import { OverviewService } from '@app/shared/overview' +import { Video } from '@app/shared/video/video.model' + +@Component({ + selector: 'my-video-overview', + templateUrl: './video-overview.component.html', + styleUrls: [ './video-overview.component.scss' ] +}) +export class VideoOverviewComponent implements OnInit { + overview: VideosOverview = { + categories: [], + channels: [], + tags: [] + } + notResults = false + + constructor ( + private i18n: I18n, + private notificationsService: NotificationsService, + private authService: AuthService, + private overviewService: OverviewService + ) { } + + get user () { + return this.authService.getUser() + } + + ngOnInit () { + this.overviewService.getVideosOverview() + .subscribe( + overview => { + this.overview = overview + + if ( + this.overview.categories.length === 0 && + this.overview.channels.length === 0 && + this.overview.tags.length === 0 + ) this.notResults = true + }, + + err => { + console.log(err) + this.notificationsService.error('Error', err.text) + } + ) + } + + buildVideoChannelBy (object: { videos: Video[] }) { + return object.videos[0].byVideoChannel + } +} -- cgit v1.2.3