mirror of https://github.com/Chocobozzz/PeerTube
Add tooltip to likes/dislikes bar
parent
604abfbef5
commit
e91890011e
|
@ -65,7 +65,9 @@
|
||||||
{{ video.createdAt | myFromNow }} - {{ video.views | myNumberFormatter }} views
|
{{ video.createdAt | myFromNow }} - {{ video.views | myNumberFormatter }} views
|
||||||
</div>
|
</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 class="likes-bar" [ngStyle]="{ 'width.%': video.likesPercent }"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -44,6 +44,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
completeVideoDescription: string
|
completeVideoDescription: string
|
||||||
shortVideoDescription: string
|
shortVideoDescription: string
|
||||||
videoHTMLDescription = ''
|
videoHTMLDescription = ''
|
||||||
|
likesBarTooltipText = ''
|
||||||
|
|
||||||
private paramsSub: Subscription
|
private paramsSub: Subscription
|
||||||
|
|
||||||
|
@ -228,7 +229,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
removeVideo (event: Event) {
|
removeVideo (event: Event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe(
|
this.confirmService.confirm('Do you really want to delete this video?', 'Delete')
|
||||||
|
.subscribe(
|
||||||
res => {
|
res => {
|
||||||
if (res === false) return
|
if (res === false) return
|
||||||
|
|
||||||
|
@ -261,6 +263,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
this.videoHTMLDescription = this.markdownService.markdownToHTML(this.video.description)
|
this.videoHTMLDescription = this.markdownService.markdownToHTML(this.video.description)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private setVideoLikesBarTooltipText () {
|
||||||
|
this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes`
|
||||||
|
}
|
||||||
|
|
||||||
private handleError (err: any) {
|
private handleError (err: any) {
|
||||||
const errorMessage: string = typeof err === 'string' ? err : err.message
|
const errorMessage: string = typeof err === 'string' ? err : err.message
|
||||||
let message = ''
|
let message = ''
|
||||||
|
@ -346,6 +352,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setVideoDescriptionHTML()
|
this.setVideoDescriptionHTML()
|
||||||
|
this.setVideoLikesBarTooltipText()
|
||||||
|
|
||||||
this.setOpenGraphTags()
|
this.setOpenGraphTags()
|
||||||
this.checkUserRating()
|
this.checkUserRating()
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { VideoWatchRoutingModule } from './video-watch-routing.module'
|
||||||
import { MarkdownService } from '../shared'
|
import { MarkdownService } from '../shared'
|
||||||
import { SharedModule } from '../../shared'
|
import { SharedModule } from '../../shared'
|
||||||
import { ClipboardModule } from 'ngx-clipboard'
|
import { ClipboardModule } from 'ngx-clipboard'
|
||||||
|
import { TooltipModule } from 'ngx-bootstrap/tooltip';
|
||||||
|
|
||||||
import { VideoWatchComponent } from './video-watch.component'
|
import { VideoWatchComponent } from './video-watch.component'
|
||||||
import { VideoReportComponent } from './video-report.component'
|
import { VideoReportComponent } from './video-report.component'
|
||||||
|
@ -14,7 +15,8 @@ import { VideoDownloadComponent } from './video-download.component'
|
||||||
imports: [
|
imports: [
|
||||||
VideoWatchRoutingModule,
|
VideoWatchRoutingModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
ClipboardModule
|
ClipboardModule,
|
||||||
|
TooltipModule.forRoot()
|
||||||
],
|
],
|
||||||
|
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
// Components w/ JavaScript
|
// Components w/ JavaScript
|
||||||
@import "~bootstrap-sass/assets/stylesheets/bootstrap/modals";
|
@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/popovers";
|
||||||
//@import "~bootstrap-sass/assets/stylesheets/bootstrap/carousel";
|
//@import "~bootstrap-sass/assets/stylesheets/bootstrap/carousel";
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,14 @@ $control-bar-height: 34px;
|
||||||
display: block;
|
display: block;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
transition-delay: 0.5s;
|
||||||
|
transition: visibility 0.5s, opacity 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.vjs-waiting .vjs-loading-spinner {
|
&.vjs-waiting .vjs-loading-spinner {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: visibility 0.5s, opacity 0.5s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.vjs-control-bar,
|
.vjs-control-bar,
|
||||||
|
|
Loading…
Reference in New Issue