diff --git a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.scss b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.scss
index 886608573..a19cd47aa 100644
--- a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.scss
+++ b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.scss
@@ -58,7 +58,6 @@
.chart-widget {
width: 100%;
height: 100%;
- height: 240px;
}
.pool-distribution {
diff --git a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts
index 9858807a6..2bda9a35a 100644
--- a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts
+++ b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts
@@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, Component, Inject, Input, LOCALE_ID, OnInit, HostBinding } from '@angular/core';
import { echarts, EChartsOption } from '../../graphs/echarts';
-import { merge, Observable, of } from 'rxjs';
+import { combineLatest, fromEvent, merge, Observable, of } from 'rxjs';
import { map, mergeMap, share, startWith, switchMap, tap } from 'rxjs/operators';
import { ApiService } from '../../services/api.service';
import { SeoService } from '../../services/seo.service';
@@ -31,6 +31,7 @@ import { seoDescriptionNetwork } from '../../shared/common.utils';
export class HashrateChartComponent implements OnInit {
@Input() tableOnly = false;
@Input() widget = false;
+ @Input() height: number = 300;
@Input() right: number | string = 45;
@Input() left: number | string = 75;
@@ -86,28 +87,32 @@ export class HashrateChartComponent implements OnInit {
}
});
- this.hashrateObservable$ = merge(
- this.radioGroupForm.get('dateSpan').valueChanges
- .pipe(
- startWith(this.radioGroupForm.controls.dateSpan.value),
- switchMap((timespan) => {
- if (!this.widget && !firstRun) {
- this.storageService.setValue('miningWindowPreference', timespan);
- }
- this.timespan = timespan;
- firstRun = false;
- this.miningWindowPreference = timespan;
- this.isLoading = true;
- return this.apiService.getHistoricalHashrate$(this.timespan);
- })
- ),
- this.stateService.chainTip$
+ this.hashrateObservable$ = combineLatest(
+ merge(
+ this.radioGroupForm.get('dateSpan').valueChanges
.pipe(
- switchMap(() => {
+ startWith(this.radioGroupForm.controls.dateSpan.value),
+ switchMap((timespan) => {
+ if (!this.widget && !firstRun) {
+ this.storageService.setValue('miningWindowPreference', timespan);
+ }
+ this.timespan = timespan;
+ firstRun = false;
+ this.miningWindowPreference = timespan;
+ this.isLoading = true;
return this.apiService.getHistoricalHashrate$(this.timespan);
})
- )
+ ),
+ this.stateService.chainTip$
+ .pipe(
+ switchMap(() => {
+ return this.apiService.getHistoricalHashrate$(this.timespan);
+ })
+ )
+ ),
+ fromEvent(window, 'resize').pipe(startWith(null)),
).pipe(
+ map(([response, _]) => response),
tap((response: any) => {
const data = response.body;
@@ -221,6 +226,7 @@ export class HashrateChartComponent implements OnInit {
]),
],
grid: {
+ height: (this.widget && this.height) ? this.height - 30 : undefined,
top: this.widget ? 20 : 40,
bottom: this.widget ? 30 : 70,
right: this.right,
diff --git a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.html b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.html
index fd6e045dc..c4fca72eb 100644
--- a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.html
+++ b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.html
@@ -26,9 +26,11 @@
-
+
@@ -38,7 +40,9 @@
diff --git a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.scss b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.scss
index 4f01f7cad..c93a952f1 100644
--- a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.scss
+++ b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.scss
@@ -17,6 +17,19 @@
}
}
+.fixed-mempool-graph {
+ height: 330px;
+}
+
+.mempool-graph, .fixed-mempool-graph {
+ @media (min-width: 768px) {
+ height: 345px;
+ }
+ @media (min-width: 992px) {
+ height: 432px;
+ }
+}
+
.card-title {
font-size: 1rem;
color: #4a68b9;
diff --git a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.ts b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.ts
index b3b2093ce..dce9b9f13 100644
--- a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.ts
+++ b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.ts
@@ -1,4 +1,4 @@
-import { AfterViewInit, ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
+import { AfterViewInit, ChangeDetectionStrategy, Component, HostListener, OnInit } from '@angular/core';
import { SeoService } from '../../services/seo.service';
import { WebsocketService } from '../../services/websocket.service';
import { StateService } from '../../services/state.service';
@@ -11,6 +11,8 @@ import { EventType, NavigationStart, Router } from '@angular/router';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MiningDashboardComponent implements OnInit, AfterViewInit {
+ graphHeight = 300;
+
constructor(
private seoService: SeoService,
private websocketService: WebsocketService,
@@ -22,6 +24,7 @@ export class MiningDashboardComponent implements OnInit, AfterViewInit {
}
ngOnInit(): void {
+ this.onResize();
this.websocketService.want(['blocks', 'mempool-blocks', 'stats']);
}
@@ -35,4 +38,15 @@ export class MiningDashboardComponent implements OnInit, AfterViewInit {
}
});
}
+
+ @HostListener('window:resize', ['$event'])
+ onResize(): void {
+ if (window.innerWidth >= 992) {
+ this.graphHeight = 330;
+ } else if (window.innerWidth >= 768) {
+ this.graphHeight = 245;
+ } else {
+ this.graphHeight = 240;
+ }
+ }
}
diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.html b/frontend/src/app/components/pool-ranking/pool-ranking.component.html
index 19ccaccdd..85dd16152 100644
--- a/frontend/src/app/components/pool-ranking/pool-ranking.component.html
+++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.html
@@ -76,7 +76,7 @@
-
diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.scss b/frontend/src/app/components/pool-ranking/pool-ranking.component.scss
index 970b3a8ea..f5a49678b 100644
--- a/frontend/src/app/components/pool-ranking/pool-ranking.component.scss
+++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.scss
@@ -28,7 +28,9 @@
.chart-widget {
width: 100%;
height: 100%;
- height: 240px;
+ @media (max-width: 767px) {
+ max-height: 240px;
+ }
@media (max-width: 485px) {
max-height: 200px;
}
diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts
index 392cdf8c5..f7b91e151 100644
--- a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts
+++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts
@@ -20,6 +20,7 @@ import { isMobile } from '../../shared/common.utils';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class PoolRankingComponent implements OnInit {
+ @Input() height: number = 300;
@Input() widget = false;
miningWindowPreference: string;