aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-14 11:25:49 +0200
committerChocobozzz <me@florianbigard.com>2018-06-14 11:43:19 +0200
commitbf079b7bfd7f0fb75ceb28e333bb4b74d8840dd4 (patch)
treeb6d9c153eff0485f154311870a10dddc7f0fe14f /client/src
parent4dae00e68b71ee3725a94eef891f3c43e10040b0 (diff)
downloadPeerTube-bf079b7bfd7f0fb75ceb28e333bb4b74d8840dd4.tar.gz
PeerTube-bf079b7bfd7f0fb75ceb28e333bb4b74d8840dd4.tar.zst
PeerTube-bf079b7bfd7f0fb75ceb28e333bb4b74d8840dd4.zip
Automatically jump to the highlighted thread
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-add.component.scss2
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.html5
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts15
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts12
4 files changed, 24 insertions, 10 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss
index e586880fc..dbce744bf 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss
@@ -28,7 +28,7 @@ form {
28 28
29.submit-comment { 29.submit-comment {
30 display: flex; 30 display: flex;
31 justify-content: end; 31 justify-content: flex-end;
32 32
33 button { 33 button {
34 @include peertube-button; 34 @include peertube-button;
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html
index 7278f7e57..8871980e9 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.html
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html
@@ -3,7 +3,7 @@
3 <div i18n class="title-page title-page-single"> 3 <div i18n class="title-page title-page-single">
4 Comments 4 Comments
5 </div> 5 </div>
6 <my-help 6 <my-help
7 *ngIf="video.commentsEnabled === true" helpType="custom" i18n-customHtml 7 *ngIf="video.commentsEnabled === true" helpType="custom" i18n-customHtml
8 customHtml="You can either comment on the page of your instance where this video is federated with your PeerTube account, or via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type in the search box <strong>@{{video.account.name}}@{{video.account.host}}</strong> and find back the video. Direct commenting capabilities are being worked on in <a href='https://github.com/Chocobozzz/PeerTube/issues/224'>#224</a>."></my-help> 8 customHtml="You can either comment on the page of your instance where this video is federated with your PeerTube account, or via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type in the search box <strong>@{{video.account.name}}@{{video.account.host}}</strong> and find back the video. Direct commenting capabilities are being worked on in <a href='https://github.com/Chocobozzz/PeerTube/issues/224'>#224</a>."></my-help>
9 </div> 9 </div>
@@ -24,8 +24,9 @@
24 [autoLoading]="true" 24 [autoLoading]="true"
25 (nearOfBottom)="onNearOfBottom()" 25 (nearOfBottom)="onNearOfBottom()"
26 > 26 >
27 <div *ngIf="highlightedThread" id="highlighted-comment"> 27 <div #commentHighlightBlock id="highlighted-comment">
28 <my-video-comment 28 <my-video-comment
29 *ngIf="highlightedThread"
29 [comment]="highlightedThread" 30 [comment]="highlightedThread"
30 [video]="video" 31 [video]="video"
31 [inReplyToCommentId]="inReplyToCommentId" 32 [inReplyToCommentId]="inReplyToCommentId"
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index 72f66ff09..274c32d31 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
@@ -1,4 +1,4 @@
1import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core' 1import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild, ElementRef } from '@angular/core'
2import { ActivatedRoute } from '@angular/router' 2import { ActivatedRoute } from '@angular/router'
3import { ConfirmService } from '@app/core' 3import { ConfirmService } from '@app/core'
4import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
@@ -19,6 +19,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
19 styleUrls: ['./video-comments.component.scss'] 19 styleUrls: ['./video-comments.component.scss']
20}) 20})
21export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { 21export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
22 @ViewChild('commentHighlightBlock') commentHighlightBlock: ElementRef
22 @Input() video: VideoDetails 23 @Input() video: VideoDetails
23 @Input() user: User 24 @Input() user: User
24 25
@@ -76,7 +77,17 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
76 this.threadComments[commentId] = res 77 this.threadComments[commentId] = res
77 this.threadLoading[commentId] = false 78 this.threadLoading[commentId] = false
78 79
79 if (highlightThread) this.highlightedThread = new VideoComment(res.comment) 80 if (highlightThread) {
81 this.highlightedThread = new VideoComment(res.comment)
82
83 // Scroll to the highlighted thread
84 setTimeout(() => {
85 // -60 because of the fixed header
86 console.log(this.commentHighlightBlock.nativeElement.offsetTop)
87 const scrollY = this.commentHighlightBlock.nativeElement.offsetTop - 60
88 window.scroll(0, scrollY)
89 }, 500)
90 }
80 }, 91 },
81 92
82 err => this.notificationsService.error(this.i18n('Error'), err.message) 93 err => this.notificationsService.error(this.i18n('Error'), err.message)
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 498542fff..a760c03e8 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -101,14 +101,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
101 ) 101 )
102 102
103 this.paramsSub = this.route.params.subscribe(routeParams => { 103 this.paramsSub = this.route.params.subscribe(routeParams => {
104 if (this.player) {
105 this.player.pause()
106 }
107
108 const uuid = routeParams[ 'uuid' ] 104 const uuid = routeParams[ 'uuid' ]
109 105
110 // Video did not change 106 // Video did not change
111 if (this.video && this.video.uuid === uuid) return 107 if (this.video && this.video.uuid === uuid) return
108
109 if (this.player) this.player.pause()
110
112 // Video did change 111 // Video did change
113 this.videoService 112 this.videoService
114 .getVideo(uuid) 113 .getVideo(uuid)
@@ -469,7 +468,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
469 } 468 }
470 469
471 private isAutoplay () { 470 private isAutoplay () {
472 // True by default 471 // We'll jump to the thread id, so do not play the video
472 if (this.route.snapshot.params['threadId']) return false
473
474 // Otherwise true by default
473 if (!this.user) return true 475 if (!this.user) return true
474 476
475 // Be sure the autoPlay is set to false 477 // Be sure the autoPlay is set to false