Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add tooltip to likes/dislikes bar

Chocobozzze91890011e10
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html
index e9ca336dd4..d9b5724303 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.html
+++ b/client/src/app/videos/+video-watch/video-watch.component.html
@@ -65,7 +65,9 @@
{{ video.createdAt | myFromNow }} - {{ video.views | myNumberFormatter }} views
</div>
- <div *ngIf="video.likes !== 0 || video.dislikes !== 0" class="video-info-likes-dislikes-bar">
+ <div
+ class="video-info-likes-dislikes-bar"
+ *ngIf="video.likes !== 0 || video.dislikes !== 0" [tooltip]="likesBarTooltipText">
<div class="likes-bar" [ngStyle]="{ 'width.%': video.likesPercent }"></div>
</div>
</div>
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 df4cfa6668..c388b138b3 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -44,6 +44,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
completeVideoDescription: string
shortVideoDescription: string
videoHTMLDescription = ''
+ likesBarTooltipText = ''
private paramsSub: Subscription
@@ -228,23 +229,24 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
removeVideo (event: Event) {
event.preventDefault()
- this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe(
- res => {
- if (res === false) return
+ this.confirmService.confirm('Do you really want to delete this video?', 'Delete')
+ .subscribe(
+ res => {
+ if (res === false) return
- this.videoService.removeVideo(this.video.id)
- .subscribe(
- status => {
- this.notificationsService.success('Success', `Video ${this.video.name} deleted.`)
+ this.videoService.removeVideo(this.video.id)
+ .subscribe(
+ status => {
+ this.notificationsService.success('Success', `Video ${this.video.name} deleted.`)
- // Go back to the video-list.
- this.router.navigate([ '/videos/list' ])
- },
+ // Go back to the video-list.
+ this.router.navigate([ '/videos/list' ])
+ },
- error => this.notificationsService.error('Error', error.text)
- )
- }
- )
+ error => this.notificationsService.error('Error', error.text)
+ )
+ }
+ )
}
private updateVideoDescription (description: string) {
@@ -261,6 +263,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.videoHTMLDescription = this.markdownService.markdownToHTML(this.video.description)
}
+ private setVideoLikesBarTooltipText () {
+ this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes`
+ }
+
private handleError (err: any) {
const errorMessage: string = typeof err === 'string' ? err : err.message
let message = ''
@@ -346,6 +352,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
}
this.setVideoDescriptionHTML()
+ this.setVideoLikesBarTooltipText()
this.setOpenGraphTags()
this.checkUserRating()
diff --git a/client/src/app/videos/+video-watch/video-watch.module.ts b/client/src/app/videos/+video-watch/video-watch.module.ts
index 18319de1a7..d0ed29d063 100644
--- a/client/src/app/videos/+video-watch/video-watch.module.ts
+++ b/client/src/app/videos/+video-watch/video-watch.module.ts
@@ -4,6 +4,7 @@ import { VideoWatchRoutingModule } from './video-watch-routing.module'
import { MarkdownService } from '../shared'
import { SharedModule } from '../../shared'
import { ClipboardModule } from 'ngx-clipboard'
+import { TooltipModule } from 'ngx-bootstrap/tooltip';
import { VideoWatchComponent } from './video-watch.component'
import { VideoReportComponent } from './video-report.component'
@@ -14,7 +15,8 @@ import { VideoDownloadComponent } from './video-download.component'
imports: [
VideoWatchRoutingModule,
SharedModule,
- ClipboardModule
+ ClipboardModule,
+ TooltipModule.forRoot()
],
declarations: [
diff --git a/client/src/sass/include/_bootstrap.scss b/client/src/sass/include/_bootstrap.scss
index 4f0e2893e9..bbf0fda226 100644
--- a/client/src/sass/include/_bootstrap.scss
+++ b/client/src/sass/include/_bootstrap.scss
@@ -41,7 +41,7 @@
// Components w/ JavaScript
@import "~bootstrap-sass/assets/stylesheets/bootstrap/modals";
-//@import "~bootstrap-sass/assets/stylesheets/bootstrap/tooltip";
+@import "~bootstrap-sass/assets/stylesheets/bootstrap/tooltip";
//@import "~bootstrap-sass/assets/stylesheets/bootstrap/popovers";
//@import "~bootstrap-sass/assets/stylesheets/bootstrap/carousel";
diff --git a/client/src/sass/video-js-custom.scss b/client/src/sass/video-js-custom.scss
index 7248749958..715464ce89 100644
--- a/client/src/sass/video-js-custom.scss
+++ b/client/src/sass/video-js-custom.scss
@@ -50,12 +50,14 @@ $control-bar-height: 34px;
display: block;
visibility: hidden;
opacity: 0;
+ transition-delay: 0.5s;
+ transition: visibility 0.5s, opacity 0.5s;
}
&.vjs-waiting .vjs-loading-spinner {
visibility: visible;
opacity: 1;
- transition: visibility 0.5s, opacity 0.5s;
+
}
.vjs-control-bar,