aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts4
-rw-r--r--client/src/app/shared/video-playlist/video-add-to-playlist.component.ts26
-rw-r--r--client/src/app/shared/video/video-actions-dropdown.component.ts5
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.scss1
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts38
5 files changed, 52 insertions, 22 deletions
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts
index 25d51d2cb..03f34412c 100644
--- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts
+++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts
@@ -67,7 +67,9 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro
67 if (previousIndex === newIndex) return 67 if (previousIndex === newIndex) return
68 68
69 const oldPosition = this.videos[previousIndex].playlistElement.position 69 const oldPosition = this.videos[previousIndex].playlistElement.position
70 const insertAfter = newIndex === 0 ? 0 : this.videos[newIndex].playlistElement.position 70 let insertAfter = this.videos[newIndex].playlistElement.position
71
72 if (oldPosition > insertAfter) insertAfter--
71 73
72 this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter) 74 this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter)
73 .subscribe( 75 .subscribe(
diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts
index 7dcdf7a9e..be15f2352 100644
--- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts
+++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts
@@ -1,4 +1,4 @@
1import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core' 1import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'
2import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' 2import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service'
3import { AuthService, Notifier } from '@app/core' 3import { AuthService, Notifier } from '@app/core'
4import { forkJoin } from 'rxjs' 4import { forkJoin } from 'rxjs'
@@ -22,7 +22,7 @@ type PlaylistSummary = {
22 templateUrl: './video-add-to-playlist.component.html', 22 templateUrl: './video-add-to-playlist.component.html',
23 changeDetection: ChangeDetectionStrategy.OnPush 23 changeDetection: ChangeDetectionStrategy.OnPush
24}) 24})
25export class VideoAddToPlaylistComponent extends FormReactive implements OnInit { 25export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, OnChanges {
26 @Input() video: Video 26 @Input() video: Video
27 @Input() currentVideoTimestamp: number 27 @Input() currentVideoTimestamp: number
28 @Input() lazyLoad = false 28 @Input() lazyLoad = false
@@ -54,15 +54,33 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit
54 } 54 }
55 55
56 ngOnInit () { 56 ngOnInit () {
57 this.resetOptions(true)
58
59 this.buildForm({ 57 this.buildForm({
60 displayName: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DISPLAY_NAME 58 displayName: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DISPLAY_NAME
61 }) 59 })
62 60
61 this.init()
62 }
63
64 ngOnChanges (simpleChanges: SimpleChanges) {
65 if (simpleChanges['video']) {
66 this.unload()
67 }
68 }
69
70 init () {
71 this.resetOptions(true)
72
63 if (this.lazyLoad !== true) this.load() 73 if (this.lazyLoad !== true) this.load()
64 } 74 }
65 75
76 unload () {
77 this.videoPlaylists = []
78
79 this.init()
80
81 this.cd.markForCheck()
82 }
83
66 load () { 84 load () {
67 forkJoin([ 85 forkJoin([
68 this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'), 86 this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'),
diff --git a/client/src/app/shared/video/video-actions-dropdown.component.ts b/client/src/app/shared/video/video-actions-dropdown.component.ts
index ee2f44f9e..df799499e 100644
--- a/client/src/app/shared/video/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/video/video-actions-dropdown.component.ts
@@ -79,6 +79,11 @@ export class VideoActionsDropdownComponent implements OnChanges {
79 } 79 }
80 80
81 ngOnChanges () { 81 ngOnChanges () {
82 if (this.loaded) {
83 this.loaded = false
84 this.playlistAdd.unload()
85 }
86
82 this.buildActions() 87 this.buildActions()
83 } 88 }
84 89
diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss
index 8ca5c4118..bada9bae8 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.scss
+++ b/client/src/app/videos/+video-watch/video-watch.component.scss
@@ -18,6 +18,7 @@ $player-factor: 1.7; // 16/9
18 width: 100% !important; 18 width: 100% !important;
19 height: auto !important; 19 height: auto !important;
20 max-height: 300px !important; 20 max-height: 300px !important;
21 max-width: initial;
21 border-bottom: 1px solid $separator-border-color !important; 22 border-bottom: 1px solid $separator-border-color !important;
22} 23}
23 24
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index b147b75b0..631504eab 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -119,23 +119,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
119 if (videoId) this.loadVideo(videoId) 119 if (videoId) this.loadVideo(videoId)
120 }) 120 })
121 121
122 this.hotkeys = [ 122 this.initHotkeys()
123 new Hotkey('shift+l', (event: KeyboardEvent): boolean => {
124 this.setLike()
125 return false
126 }, undefined, this.i18n('Like the video')),
127 new Hotkey('shift+d', (event: KeyboardEvent): boolean => {
128 this.setDislike()
129 return false
130 }, undefined, this.i18n('Dislike the video')),
131 new Hotkey('shift+s', (event: KeyboardEvent): boolean => {
132 this.subscribeButton.subscribed ?
133 this.subscribeButton.unsubscribe() :
134 this.subscribeButton.subscribe()
135 return false
136 }, undefined, this.i18n('Subscribe to the account'))
137 ]
138 if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
139 } 123 }
140 124
141 ngOnDestroy () { 125 ngOnDestroy () {
@@ -565,4 +549,24 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
565 this.player = undefined 549 this.player = undefined
566 } 550 }
567 } 551 }
552
553 private initHotkeys () {
554 this.hotkeys = [
555 new Hotkey('shift+l', (event: KeyboardEvent): boolean => {
556 this.setLike()
557 return false
558 }, undefined, this.i18n('Like the video')),
559 new Hotkey('shift+d', (event: KeyboardEvent): boolean => {
560 this.setDislike()
561 return false
562 }, undefined, this.i18n('Dislike the video')),
563 new Hotkey('shift+s', (event: KeyboardEvent): boolean => {
564 this.subscribeButton.subscribed ?
565 this.subscribeButton.unsubscribe() :
566 this.subscribeButton.subscribe()
567 return false
568 }, undefined, this.i18n('Subscribe to the account'))
569 ]
570 if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
571 }
568} 572}