1 import { LinkType } from 'src/types/link.type'
2 import { Component, Input, OnInit } from '@angular/core'
3 import { VideoPlaylist } from './video-playlist.model'
4 import { MarkdownService } from '@app/core'
7 selector: 'my-video-playlist-miniature',
8 styleUrls: [ './video-playlist-miniature.component.scss' ],
9 templateUrl: './video-playlist-miniature.component.html'
11 export class VideoPlaylistMiniatureComponent implements OnInit {
12 @Input() playlist: VideoPlaylist
14 @Input() toManage = false
16 @Input() displayChannel = false
17 @Input() displayDescription = false
18 @Input() displayPrivacy = false
19 @Input() displayAsRow = false
21 @Input() linkType: LinkType = 'internal'
25 playlistTarget: string
26 playlistDescription: string
29 private markdownService: MarkdownService
33 this.buildPlaylistUrl()
34 if (this.displayDescription) {
35 this.playlistDescription = await this.markdownService.textMarkdownToHTML(this.playlist.description)
41 this.routerLink = [ '/my-library/video-playlists', this.playlist.uuid ]
45 if (this.playlist.videosLength === 0) {
46 this.routerLink = null
50 if (this.linkType === 'internal' || !this.playlist.url) {
51 this.routerLink = VideoPlaylist.buildWatchUrl(this.playlist)
55 if (this.linkType === 'external') {
56 this.routerLink = null
57 this.playlistHref = this.playlist.url
58 this.playlistTarget = '_blank'
63 this.routerLink = [ '/search/lazy-load-playlist', { url: this.playlist.url } ]