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 +++++++++++---------- 2 files changed, 55 insertions(+), 50 deletions(-) (limited to 'client/src/app/+my-library/+my-video-channels') 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 + } + } + } } -- cgit v1.2.3