]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
Fix custom markup
[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 { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
3 import { Notifier } from '@app/core'
4 import { FindInBulkService } from '@app/shared/shared-search'
5 import { MiniatureDisplayOptions } from '../../shared-video-miniature'
6 import { VideoPlaylist } from '../../shared-video-playlist'
7 import { CustomMarkupComponent } from './shared'
8
9 /*
10 * Markup component that creates a playlist miniature only
11 */
12
13 @Component({
14 selector: 'my-playlist-miniature-markup',
15 templateUrl: 'playlist-miniature-markup.component.html',
16 styleUrls: [ 'playlist-miniature-markup.component.scss' ],
17 changeDetection: ChangeDetectionStrategy.OnPush
18 })
19 export class PlaylistMiniatureMarkupComponent implements CustomMarkupComponent, OnInit {
20 @Input() uuid: string
21
22 @Output() loaded = new EventEmitter<boolean>()
23
24 playlist: VideoPlaylist
25
26 displayOptions: MiniatureDisplayOptions = {
27 date: true,
28 views: true,
29 by: true,
30 avatar: false,
31 privacyLabel: false,
32 privacyText: false,
33 state: false,
34 blacklistInfo: false
35 }
36
37 constructor (
38 private findInBulkService: FindInBulkService,
39 private notifier: Notifier,
40 private cd: ChangeDetectorRef
41 ) { }
42
43 ngOnInit () {
44 this.findInBulkService.getPlaylist(this.uuid)
45 .pipe(finalize(() => this.loaded.emit(true)))
46 .subscribe({
47 next: playlist => {
48 this.playlist = playlist
49 this.cd.markForCheck()
50 },
51
52 error: err => this.notifier.error($localize`Error in playlist miniature component: ${err.message}`)
53 })
54 }
55 }