1 import { Component, Input, OnInit } from '@angular/core'
2 import { AuthService } from '@app/core'
3 import { VideoFilter, VideoSortField } from '@shared/models'
4 import { Video, VideoService } from '../../shared-main'
5 import { MiniatureDisplayOptions } from '../../shared-video-miniature'
8 * Markup component list videos depending on criterias
12 selector: 'my-videos-list-markup',
13 templateUrl: 'videos-list-markup.component.html',
14 styleUrls: [ 'videos-list-markup.component.scss' ]
16 export class VideosListMarkupComponent implements OnInit {
18 @Input() categoryOneOf: number[]
19 @Input() languageOneOf: string[]
20 @Input() count: number
21 @Input() onlyDisplayTitle: boolean
22 @Input() filter: VideoFilter
26 displayOptions: MiniatureDisplayOptions = {
38 private auth: AuthService,
39 private videoService: VideoService
43 return this.auth.getUser()
47 if (this.onlyDisplayTitle) {
48 for (const key of Object.keys(this.displayOptions)) {
49 this.displayOptions[key] = false
56 itemsPerPage: this.count
58 categoryOneOf: this.categoryOneOf,
59 languageOneOf: this.languageOneOf,
61 sort: this.sort as VideoSortField
64 this.videoService.getVideos(options)
65 .subscribe(({ data }) => this.videos = data)