- getPlaylistUrl () {
- if (this.toManage) return [ '/my-library/video-playlists', this.playlist.uuid ]
- if (this.playlist.videosLength === 0) return null
+ @Input() linkType: LinkType = 'internal'
+
+ routerLink: any
+ playlistHref: string
+ playlistTarget: string
+ playlistDescription: string
+
+ constructor (
+ private markdownService: MarkdownService
+ ) {}
+
+ async ngOnInit () {
+ this.buildPlaylistUrl()
+ if (this.displayDescription) {
+ this.playlistDescription = await this.markdownService.textMarkdownToHTML({ markdown: this.playlist.description })
+ }
+ }
+
+ buildPlaylistUrl () {
+ if (this.toManage) {
+ this.routerLink = [ '/my-library/video-playlists', this.playlist.uuid ]
+ return
+ }
+
+ if (this.playlist.videosLength === 0) {
+ this.routerLink = null
+ return
+ }
+
+ if (this.linkType === 'internal' || !this.playlist.url) {
+ this.routerLink = VideoPlaylist.buildWatchUrl(this.playlist)
+ return
+ }
+
+ if (this.linkType === 'external') {
+ this.routerLink = null
+ this.playlistHref = this.playlist.url
+ this.playlistTarget = '_blank'
+ return
+ }
+
+ // Lazy load
+ this.routerLink = [ '/search/lazy-load-playlist', { url: this.playlist.url } ]