]>
Commit | Line | Data |
---|---|---|
1 | import { finalize } from 'rxjs/operators' | |
2 | import { 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 | }) | |
18 | export class PlaylistMiniatureMarkupComponent implements CustomMarkupComponent, OnInit { | |
19 | @Input() uuid: string | |
20 | ||
21 | @Output() loaded = new EventEmitter<boolean>() | |
22 | ||
23 | playlist: VideoPlaylist | |
24 | ||
25 | displayOptions: MiniatureDisplayOptions = { | |
26 | date: true, | |
27 | views: true, | |
28 | by: true, | |
29 | avatar: false, | |
30 | privacyLabel: false, | |
31 | privacyText: false, | |
32 | state: false, | |
33 | blacklistInfo: false | |
34 | } | |
35 | ||
36 | constructor ( | |
37 | private findInBulkService: FindInBulkService, | |
38 | private notifier: Notifier | |
39 | ) { } | |
40 | ||
41 | ngOnInit () { | |
42 | this.findInBulkService.getPlaylist(this.uuid) | |
43 | .pipe(finalize(() => this.loaded.emit(true))) | |
44 | .subscribe({ | |
45 | next: playlist => this.playlist = playlist, | |
46 | ||
47 | error: err => this.notifier.error($localize`Error in playlist miniature component: ${err.message}`) | |
48 | }) | |
49 | } | |
50 | } |