]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
Merge branch 'release/3.3.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / peertube-custom-tags / playlist-miniature-markup.component.ts
CommitLineData
8b61dcaf 1import { finalize } from 'rxjs/operators'
0ca454e3 2import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
8b61dcaf 3import { Notifier } from '@app/core'
8ee25e17
C
4import { MiniatureDisplayOptions } from '../../shared-video-miniature'
5import { VideoPlaylist, VideoPlaylistService } from '../../shared-video-playlist'
0ca454e3 6import { CustomMarkupComponent } from './shared'
2539932e
C
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})
0ca454e3 17export class PlaylistMiniatureMarkupComponent implements CustomMarkupComponent, OnInit {
2539932e
C
18 @Input() uuid: string
19
0ca454e3
C
20 @Output() loaded = new EventEmitter<boolean>()
21
2539932e
C
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 (
8b61dcaf
C
36 private playlistService: VideoPlaylistService,
37 private notifier: Notifier
2539932e
C
38 ) { }
39
40 ngOnInit () {
41 this.playlistService.getVideoPlaylist(this.uuid)
8b61dcaf
C
42 .pipe(finalize(() => this.loaded.emit(true)))
43 .subscribe(
44 playlist => this.playlist = playlist,
0ca454e3 45
8b61dcaf
C
46 err => this.notifier.error('Error in playlist miniature component: ' + err.message)
47 )
2539932e
C
48 }
49}