]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
Merge branch 'master' into release/3.3.0
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / peertube-custom-tags / playlist-miniature-markup.component.ts
1 import { finalize } from 'rxjs/operators'
2 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
3 import { Notifier } from '@app/core'
4 import { MiniatureDisplayOptions } from '../../shared-video-miniature'
5 import { VideoPlaylist, VideoPlaylistService } from '../../shared-video-playlist'
6 import { CustomMarkupComponent } from './shared'
7
8 /*
9 * Markup component that creates a playlist miniature only
10 */
11
12 @Component({
13 selector: 'my-playlist-miniature-markup',
14 templateUrl: 'playlist-miniature-markup.component.html',
15 styleUrls: [ 'playlist-miniature-markup.component.scss' ]
16 })
17 export class PlaylistMiniatureMarkupComponent implements CustomMarkupComponent, OnInit {
18 @Input() uuid: string
19
20 @Output() loaded = new EventEmitter<boolean>()
21
22 playlist: VideoPlaylist
23
24 displayOptions: MiniatureDisplayOptions = {
25 date: true,
26 views: true,
27 by: true,
28 avatar: false,
29 privacyLabel: false,
30 privacyText: false,
31 state: false,
32 blacklistInfo: false
33 }
34
35 constructor (
36 private playlistService: VideoPlaylistService,
37 private notifier: Notifier
38 ) { }
39
40 ngOnInit () {
41 this.playlistService.getVideoPlaylist(this.uuid)
42 .pipe(finalize(() => this.loaded.emit(true)))
43 .subscribe(
44 playlist => this.playlist = playlist,
45
46 err => this.notifier.error('Error in playlist miniature component: ' + err.message)
47 )
48 }
49 }