]>
Commit | Line | Data |
---|---|---|
8b61dcaf | 1 | import { finalize } from 'rxjs/operators' |
0ca454e3 | 2 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' |
8b61dcaf | 3 | import { Notifier } from '@app/core' |
8ee25e17 C |
4 | import { MiniatureDisplayOptions } from '../../shared-video-miniature' |
5 | import { VideoPlaylist, VideoPlaylistService } from '../../shared-video-playlist' | |
0ca454e3 | 6 | import { 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 | 17 | export 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 | } |