diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 6ce39b1d2..974c58e70 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -27,6 +27,7 @@ import { AssetGroupComponent } from './components/assets/asset-group/asset-group import { AssetsFeaturedComponent } from './components/assets/assets-featured/assets-featured.component'; import { AssetsComponent } from './components/assets/assets.component'; import { PoolComponent } from './components/pool/pool.component'; +import { MiningDashboardComponent } from './components/mining-dashboard/mining-dashboard.component'; import { DifficultyChartComponent } from './components/difficulty-chart/difficulty-chart.component'; let routes: Routes = [ @@ -72,6 +73,10 @@ let routes: Routes = [ path: 'mining/pools', component: PoolRankingComponent, }, + { + path: 'mining/dashboard', + component: MiningDashboardComponent, + }, { path: 'mining/pool/:poolId', component: PoolComponent, @@ -168,6 +173,10 @@ let routes: Routes = [ path: 'mining/pools', component: PoolRankingComponent, }, + { + path: 'mining/dashboard', + component: MiningDashboardComponent, + }, { path: 'mining/pool/:poolId', component: PoolComponent, @@ -258,6 +267,10 @@ let routes: Routes = [ path: 'mining/pools', component: PoolRankingComponent, }, + { + path: 'mining/dashboard', + component: MiningDashboardComponent, + }, { path: 'mining/pool/:poolId', component: PoolComponent, diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 15bebd033..677d88d6e 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -68,6 +68,7 @@ import { PushTransactionComponent } from './components/push-transaction/push-tra import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { AssetsFeaturedComponent } from './components/assets/assets-featured/assets-featured.component'; import { AssetGroupComponent } from './components/assets/asset-group/asset-group.component'; +import { MiningDashboardComponent } from './components/mining-dashboard/mining-dashboard.component'; import { DifficultyChartComponent } from './components/difficulty-chart/difficulty-chart.component'; @NgModule({ @@ -119,6 +120,7 @@ import { DifficultyChartComponent } from './components/difficulty-chart/difficul AssetsNavComponent, AssetsFeaturedComponent, AssetGroupComponent, + MiningDashboardComponent, DifficultyChartComponent, ], imports: [ diff --git a/frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.html b/frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.html index 50fd82b09..c8a4aa953 100644 --- a/frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.html +++ b/frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.html @@ -21,9 +21,13 @@
Rank | @@ -64,8 +63,8 @@{{ pool.emptyBlocks }} ({{ pool.emptyBlockRatio }}%) | |||||
---|---|---|---|---|---|---|
- | -+ | + | All miners | {{ miningStats.lastEstimatedHashrate}} {{ miningStats.miningUnits.hashrateUnit }} | {{ miningStats.blockCount }} | 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 17ea83b71..5a5b2390f 100644 --- a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts +++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { Router } from '@angular/router'; import { EChartsOption, PieSeriesOption } from 'echarts'; @@ -25,6 +25,8 @@ import { chartColors } from 'src/app/app.constants'; `], }) export class PoolRankingComponent implements OnInit { + @Input() widget: boolean = false; + poolsWindowPreference: string; radioGroupForm: FormGroup; @@ -46,12 +48,17 @@ export class PoolRankingComponent implements OnInit { private router: Router, ) { this.seoService.setTitle($localize`:@@mining.mining-pools:Mining Pools`); - this.poolsWindowPreference = this.storageService.getValue('poolsWindowPreference') ? this.storageService.getValue('poolsWindowPreference') : '1w'; - this.radioGroupForm = this.formBuilder.group({ dateSpan: this.poolsWindowPreference }); - this.radioGroupForm.controls.dateSpan.setValue(this.poolsWindowPreference); } ngOnInit(): void { + if (this.widget) { + this.poolsWindowPreference = '1w'; + } else { + this.poolsWindowPreference = this.storageService.getValue('poolsWindowPreference') ? this.storageService.getValue('poolsWindowPreference') : '1w'; + } + this.radioGroupForm = this.formBuilder.group({ dateSpan: this.poolsWindowPreference }); + this.radioGroupForm.controls.dateSpan.setValue(this.poolsWindowPreference); + // When... this.miningStatsObservable$ = combineLatest([ // ...a new block is mined @@ -65,7 +72,9 @@ export class PoolRankingComponent implements OnInit { .pipe( startWith(this.poolsWindowPreference), // (trigger when the page loads) tap((value) => { - this.storageService.setValue('poolsWindowPreference', value); + if (!this.widget) { + this.storageService.setValue('poolsWindowPreference', value); + } this.poolsWindowPreference = value; }) ) @@ -147,7 +156,7 @@ export class PoolRankingComponent implements OnInit { this.chartOptions = { title: { text: $localize`:@@mining.pool-chart-title:${network}:NETWORK: mining pools share`, - subtext: $localize`:@@mining.pool-chart-sub-title:Estimated from the # of blocks mined`, + subtext: $localize`:@@mining.pool-chart-sub-title:Estimated from the # of blocks mined (${this.poolsWindowPreference})`, left: 'center', textStyle: { color: '#FFF',