aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts')
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts47
1 files changed, 41 insertions, 6 deletions
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
index 9bbec6038..8de5092a9 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
@@ -1,4 +1,5 @@
1import { Component, Input } from '@angular/core' 1import { LinkType } from 'src/types/link.type'
2import { Component, Input, OnInit } from '@angular/core'
2import { VideoPlaylist } from './video-playlist.model' 3import { VideoPlaylist } from './video-playlist.model'
3 4
4@Component({ 5@Component({
@@ -6,18 +7,52 @@ import { VideoPlaylist } from './video-playlist.model'
6 styleUrls: [ './video-playlist-miniature.component.scss' ], 7 styleUrls: [ './video-playlist-miniature.component.scss' ],
7 templateUrl: './video-playlist-miniature.component.html' 8 templateUrl: './video-playlist-miniature.component.html'
8}) 9})
9export class VideoPlaylistMiniatureComponent { 10export class VideoPlaylistMiniatureComponent implements OnInit {
10 @Input() playlist: VideoPlaylist 11 @Input() playlist: VideoPlaylist
12
11 @Input() toManage = false 13 @Input() toManage = false
14
12 @Input() displayChannel = false 15 @Input() displayChannel = false
13 @Input() displayDescription = false 16 @Input() displayDescription = false
14 @Input() displayPrivacy = false 17 @Input() displayPrivacy = false
15 @Input() displayAsRow = false 18 @Input() displayAsRow = false
16 19
17 getPlaylistUrl () { 20 @Input() linkType: LinkType = 'internal'
18 if (this.toManage) return [ '/my-library/video-playlists', this.playlist.uuid ] 21
19 if (this.playlist.videosLength === 0) return null 22 routerLink: any
23 playlistHref: string
24 playlistTarget: string
25
26 ngOnInit () {
27 this.buildPlaylistUrl()
28 }
29
30 buildPlaylistUrl () {
31 if (this.toManage) {
32 this.routerLink = [ '/my-library/video-playlists', this.playlist.uuid ]
33 return
34 }
35
36 if (this.playlist.videosLength === 0) {
37 this.routerLink = null
38 return
39 }
40
41 if (this.linkType === 'internal' || !this.playlist.url) {
42 this.routerLink = [ '/w/p', this.playlist.uuid ]
43 return
44 }
45
46 if (this.linkType === 'external') {
47 this.routerLink = null
48 this.playlistHref = this.playlist.url
49 this.playlistTarget = '_blank'
50 return
51 }
52
53 // Lazy load
54 this.routerLink = [ '/search/lazy-load-playlist', { url: this.playlist.url } ]
20 55
21 return [ '/w/p', this.playlist.uuid ] 56 return
22 } 57 }
23} 58}