From 4f926722ea6784ea389013378fd233f59077ec8a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Nov 2020 11:12:01 +0100 Subject: Upgrade client dependencies Migrate removed primeng theme to custom CSS --- .../my-video-channels.component.html | 2 +- .../my-video-channels.component.ts | 103 +++++++++++---------- .../my-history/my-history.component.html | 2 +- .../+my-library/my-history/my-history.component.ts | 6 +- client/src/app/+my-library/my-library.module.ts | 2 - 5 files changed, 61 insertions(+), 54 deletions(-) (limited to 'client/src/app/+my-library') diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html index 205d23cd5..b704a1cc6 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html +++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html @@ -42,7 +42,7 @@
- +
diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts index a63e98a51..f6ba50a48 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts @@ -21,6 +21,8 @@ export class MyVideoChannelsComponent implements OnInit { channelsSearch: string channelsSearchChanged = new Subject() + chartOptions: any + private user: User constructor ( @@ -47,55 +49,6 @@ export class MyVideoChannelsComponent implements OnInit { return this.screenService.isInSmallView() } - get chartOptions () { - return { - legend: { - display: false - }, - scales: { - xAxes: [{ - display: false - }], - yAxes: [{ - display: false, - ticks: { - min: Math.max(0, this.videoChannelsMinimumDailyViews - (3 * this.videoChannelsMaximumDailyViews / 100)), - max: Math.max(1, this.videoChannelsMaximumDailyViews) - } - }] - }, - layout: { - padding: { - left: 15, - right: 15, - top: 10, - bottom: 0 - } - }, - elements: { - point: { - radius: 0 - } - }, - tooltips: { - mode: 'index', - intersect: false, - custom: function (tooltip: any) { - if (!tooltip) return - // disable displaying the color box - tooltip.displayColors = false - }, - callbacks: { - label: (tooltip: any, data: any) => `${tooltip.value} views` - } - }, - hover: { - mode: 'index', - intersect: false - } - } - } - resetSearch () { this.channelsSearch = '' this.onChannelsSearchChanged() @@ -159,6 +112,7 @@ channel with the same name (${videoChannel.name})!`, day => day.views ).views) // the object returned is a ViewPerDate, so we still need to get the views attribute ) + this.videoChannelsMaximumDailyViews = max( // compute local maximum daily views for each channel, by their "views" attribute this.videoChannels.map(v => maxBy( @@ -166,6 +120,57 @@ channel with the same name (${videoChannel.name})!`, day => day.views ).views) // the object returned is a ViewPerDate, so we still need to get the views attribute ) + + this.buildChartOptions() }) } + + private buildChartOptions () { + this.chartOptions = { + legend: { + display: false + }, + scales: { + xAxes: [{ + display: false + }], + yAxes: [{ + display: false, + ticks: { + min: Math.max(0, this.videoChannelsMinimumDailyViews - (3 * this.videoChannelsMaximumDailyViews / 100)), + max: Math.max(1, this.videoChannelsMaximumDailyViews) + } + }] + }, + layout: { + padding: { + left: 15, + right: 15, + top: 10, + bottom: 0 + } + }, + elements: { + point: { + radius: 0 + } + }, + tooltips: { + mode: 'index', + intersect: false, + custom: function (tooltip: any) { + if (!tooltip) return + // disable displaying the color box + tooltip.displayColors = false + }, + callbacks: { + label: (tooltip: any, data: any) => `${tooltip.value} views` + } + }, + hover: { + mode: 'index', + intersect: false + } + } + } } diff --git a/client/src/app/+my-library/my-history/my-history.component.html b/client/src/app/+my-library/my-history/my-history.component.html index cff46a41d..05e016e55 100644 --- a/client/src/app/+my-library/my-history/my-history.component.html +++ b/client/src/app/+my-library/my-history/my-history.component.html @@ -5,7 +5,7 @@
- +
diff --git a/client/src/app/+my-library/my-history/my-history.component.ts b/client/src/app/+my-library/my-history/my-history.component.ts index e11f05c47..4ba95124d 100644 --- a/client/src/app/+my-library/my-history/my-history.component.ts +++ b/client/src/app/+my-library/my-history/my-history.component.ts @@ -47,7 +47,11 @@ export class MyHistoryComponent extends AbstractVideoList implements OnInit, OnD ngOnInit () { super.ngOnInit() - this.videosHistoryEnabled = this.authService.getUser().videosHistoryEnabled + this.authService.userInformationLoaded + .subscribe(() => { + this.videosHistoryEnabled = this.authService.getUser().videosHistoryEnabled + }) + } ngOnDestroy () { diff --git a/client/src/app/+my-library/my-library.module.ts b/client/src/app/+my-library/my-library.module.ts index bf791952c..5518cfd98 100644 --- a/client/src/app/+my-library/my-library.module.ts +++ b/client/src/app/+my-library/my-library.module.ts @@ -1,5 +1,4 @@ import { AutoCompleteModule } from 'primeng/autocomplete' -import { InputSwitchModule } from 'primeng/inputswitch' import { TableModule } from 'primeng/table' import { DragDropModule } from '@angular/cdk/drag-drop' import { NgModule } from '@angular/core' @@ -34,7 +33,6 @@ import { MyVideosComponent } from './my-videos/my-videos.component' AutoCompleteModule, TableModule, - InputSwitchModule, DragDropModule, SharedMainModule, -- cgit v1.2.3