aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-06 11:07:30 +0100
committerChocobozzz <me@florianbigard.com>2019-12-06 11:07:30 +0100
commit3d216ea0f74cfa47312b97bae0e24885b563dd6d (patch)
tree9082c1a14f66039d5516f48521de02cdd2365dd0 /client/src
parent941c5eac1751ef93500d6afa58c4575f777dbff9 (diff)
downloadPeerTube-3d216ea0f74cfa47312b97bae0e24885b563dd6d.tar.gz
PeerTube-3d216ea0f74cfa47312b97bae0e24885b563dd6d.tar.zst
PeerTube-3d216ea0f74cfa47312b97bae0e24885b563dd6d.zip
Fix dropdown on video miniature for unlogged users
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+about/about-peertube/about-peertube.component.html5
-rw-r--r--client/src/app/shared/buttons/action-dropdown.component.html2
-rw-r--r--client/src/app/shared/buttons/action-dropdown.component.ts8
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts41
4 files changed, 35 insertions, 21 deletions
diff --git a/client/src/app/+about/about-peertube/about-peertube.component.html b/client/src/app/+about/about-peertube/about-peertube.component.html
index 5c63052d8..c6f21d35a 100644
--- a/client/src/app/+about/about-peertube/about-peertube.component.html
+++ b/client/src/app/+about/about-peertube/about-peertube.component.html
@@ -18,6 +18,11 @@
18 </p> 18 </p>
19</div> 19</div>
20 20
21<div class="documentation">
22
23
24</div>
25
21<div class="privacy-contributors"> 26<div class="privacy-contributors">
22 <my-about-peertube-contributors></my-about-peertube-contributors> 27 <my-about-peertube-contributors></my-about-peertube-contributors>
23 28
diff --git a/client/src/app/shared/buttons/action-dropdown.component.html b/client/src/app/shared/buttons/action-dropdown.component.html
index cc244dc76..99e8b7ec1 100644
--- a/client/src/app/shared/buttons/action-dropdown.component.html
+++ b/client/src/app/shared/buttons/action-dropdown.component.html
@@ -1,4 +1,4 @@
1<div class="dropdown-root" ngbDropdown [placement]="placement"> 1<div class="dropdown-root" ngbDropdown [placement]="placement" *ngIf="areActionsDisplayed(actions, entry)">
2 <div 2 <div
3 class="action-button" [ngClass]="{ small: buttonSize === 'small', grey: theme === 'grey', orange: theme === 'orange', 'button-styled': buttonStyled }" 3 class="action-button" [ngClass]="{ small: buttonSize === 'small', grey: theme === 'grey', orange: theme === 'orange', 'button-styled': buttonStyled }"
4 ngbDropdownToggle role="button" 4 ngbDropdownToggle role="button"
diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts
index c9dbbfda2..a4200f70f 100644
--- a/client/src/app/shared/buttons/action-dropdown.component.ts
+++ b/client/src/app/shared/buttons/action-dropdown.component.ts
@@ -38,7 +38,11 @@ export class ActionDropdownComponent<T> {
38 return [ this.actions ] 38 return [ this.actions ]
39 } 39 }
40 40
41 areActionsDisplayed (actions: DropdownAction<T>[], entry: T) { 41 areActionsDisplayed (actions: Array<DropdownAction<T> | DropdownAction<T>[]>, entry: T): boolean {
42 return actions.some(a => a.isDisplayed === undefined || a.isDisplayed(entry)) 42 return actions.some(a => {
43 if (Array.isArray(a)) return this.areActionsDisplayed(a, entry)
44
45 return a.isDisplayed === undefined || a.isDisplayed(entry)
46 })
43 } 47 }
44} 48}
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 eee7adfd8..0de621aca 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -69,7 +69,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
69 likesBarTooltipText = '' 69 likesBarTooltipText = ''
70 hasAlreadyAcceptedPrivacyConcern = false 70 hasAlreadyAcceptedPrivacyConcern = false
71 remoteServerDown = false 71 remoteServerDown = false
72 hotkeys: Hotkey[] 72 hotkeys: Hotkey[] = []
73 73
74 private nextVideoUuid = '' 74 private nextVideoUuid = ''
75 private currentTime: number 75 private currentTime: number
@@ -147,7 +147,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
147 if (this.queryParamsSub) this.queryParamsSub.unsubscribe() 147 if (this.queryParamsSub) this.queryParamsSub.unsubscribe()
148 148
149 // Unbind hotkeys 149 // Unbind hotkeys
150 if (this.isUserLoggedIn()) this.hotkeysService.remove(this.hotkeys) 150 this.hotkeysService.remove(this.hotkeys)
151 } 151 }
152 152
153 setLike () { 153 setLike () {
@@ -650,21 +650,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
650 650
651 private initHotkeys () { 651 private initHotkeys () {
652 this.hotkeys = [ 652 this.hotkeys = [
653 new Hotkey('shift+l', () => {
654 this.setLike()
655 return false
656 }, undefined, this.i18n('Like the video')),
657
658 new Hotkey('shift+d', () => {
659 this.setDislike()
660 return false
661 }, undefined, this.i18n('Dislike the video')),
662
663 new Hotkey('shift+s', () => {
664 this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe()
665 return false
666 }, undefined, this.i18n('Subscribe to the account')),
667
668 // These hotkeys are managed by the player 653 // These hotkeys are managed by the player
669 new Hotkey('f', e => e, undefined, this.i18n('Enter/exit fullscreen (requires player focus)')), 654 new Hotkey('f', e => e, undefined, this.i18n('Enter/exit fullscreen (requires player focus)')),
670 new Hotkey('space', e => e, undefined, this.i18n('Play/Pause the video (requires player focus)')), 655 new Hotkey('space', e => e, undefined, this.i18n('Play/Pause the video (requires player focus)')),
@@ -683,6 +668,26 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
683 668
684 new Hotkey('.', e => e, undefined, this.i18n('Navigate in the video frame by frame (requires player focus)')) 669 new Hotkey('.', e => e, undefined, this.i18n('Navigate in the video frame by frame (requires player focus)'))
685 ] 670 ]
686 if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys) 671
672 if (this.isUserLoggedIn()) {
673 this.hotkeys = this.hotkeys.concat([
674 new Hotkey('shift+l', () => {
675 this.setLike()
676 return false
677 }, undefined, this.i18n('Like the video')),
678
679 new Hotkey('shift+d', () => {
680 this.setDislike()
681 return false
682 }, undefined, this.i18n('Dislike the video')),
683
684 new Hotkey('shift+s', () => {
685 this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe()
686 return false
687 }, undefined, this.i18n('Subscribe to the account'))
688 ])
689 }
690
691 this.hotkeysService.add(this.hotkeys)
687 } 692 }
688} 693}