Add difficulty adjustment table in mining dashboard
This commit is contained in:
		
							parent
							
								
									b2dec5e20a
								
							
						
					
					
						commit
						6cdd41a8f7
					
				| @ -1,6 +1,6 @@ | |||||||
| <div [class]="widget === false ? 'full-container' : ''"> | <div [class]="widget === false ? 'full-container' : ''"> | ||||||
| 
 | 
 | ||||||
|   <div class="card-header mb-0 mb-md-4" [style]="widget ? 'display:none' : ''"> |   <div *ngIf="!tableOnly" class="card-header mb-0 mb-md-4" [style]="widget ? 'display:none' : ''"> | ||||||
|     <form [formGroup]="radioGroupForm" class="formRadioGroup" *ngIf="(hashrateObservable$ | async) as hashrates"> |     <form [formGroup]="radioGroupForm" class="formRadioGroup" *ngIf="(hashrateObservable$ | async) as hashrates"> | ||||||
|       <div class="btn-group btn-group-toggle" ngbRadioGroup name="radioBasic" formControlName="dateSpan"> |       <div class="btn-group btn-group-toggle" ngbRadioGroup name="radioBasic" formControlName="dateSpan"> | ||||||
|         <label ngbButtonLabel class="btn-primary btn-sm" *ngIf="hashrates.availableTimespanDay >= 90"> |         <label ngbButtonLabel class="btn-primary btn-sm" *ngIf="hashrates.availableTimespanDay >= 90"> | ||||||
| @ -25,17 +25,16 @@ | |||||||
|     </form> |     </form> | ||||||
|   </div> |   </div> | ||||||
| 
 | 
 | ||||||
|   <div *ngIf="hashrateObservable$ | async" [class]="!widget ? 'chart' : 'chart-widget'" |   <div *ngIf="(hashrateObservable$ | async) && !tableOnly" [class]="!widget ? 'chart' : 'chart-widget'" | ||||||
|     echarts [initOpts]="chartInitOptions" [options]="chartOptions"></div> |     echarts [initOpts]="chartInitOptions" [options]="chartOptions"></div> | ||||||
|   <div class="text-center loadingGraphs" *ngIf="isLoading"> |   <div class="text-center loadingGraphs" *ngIf="isLoading"> | ||||||
|     <div class="spinner-border text-light"></div> |     <div class="spinner-border text-light"></div> | ||||||
|   </div> |   </div> | ||||||
|    |    | ||||||
|   <!-- <div class="mt-3" *ngIf="!widget"> |   <div class="mt-3" *ngIf="tableOnly || !widget"> | ||||||
|     <table class="table table-borderless table-sm text-center"> |     <table class="table table-borderless table-sm text-center"> | ||||||
|       <thead> |       <thead> | ||||||
|         <tr> |         <tr> | ||||||
|           <th i18n="mining.rank">Block</th> |  | ||||||
|           <th class="d-none d-md-block" i18n="block.timestamp">Timestamp</th> |           <th class="d-none d-md-block" i18n="block.timestamp">Timestamp</th> | ||||||
|           <th i18n="mining.adjusted">Adjusted</th> |           <th i18n="mining.adjusted">Adjusted</th> | ||||||
|           <th i18n="mining.difficulty">Difficulty</th> |           <th i18n="mining.difficulty">Difficulty</th> | ||||||
| @ -44,15 +43,13 @@ | |||||||
|       </thead> |       </thead> | ||||||
|       <tbody *ngIf="(hashrateObservable$ | async) as data"> |       <tbody *ngIf="(hashrateObservable$ | async) as data"> | ||||||
|         <tr *ngFor="let diffChange of data.difficulty"> |         <tr *ngFor="let diffChange of data.difficulty"> | ||||||
|           <td><a [routerLink]="['/block' | relativeUrl, diffChange.height]">{{ diffChange.height }}</a></td> |  | ||||||
|           <td class="d-none d-md-block">‎{{ diffChange.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }}</td> |           <td class="d-none d-md-block">‎{{ diffChange.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }}</td> | ||||||
|           <td><app-time-since [time]="diffChange.timestamp" [fastRender]="true"></app-time-since></td> |           <td><app-time-since [time]="diffChange.timestamp" [fastRender]="true"></app-time-since></td> | ||||||
|           <td class="d-none d-md-block">{{ formatNumber(diffChange.difficulty, locale, '1.2-2') }}</td> |           <td>{{ diffChange.difficultyShorten }}</td> | ||||||
|           <td class="d-block d-md-none">{{ diffChange.difficultyShorten }}</td> |  | ||||||
|           <td [style]="diffChange.change >= 0 ? 'color: #42B747' : 'color: #B74242'">{{ formatNumber(diffChange.change, locale, '1.2-2') }}%</td> |           <td [style]="diffChange.change >= 0 ? 'color: #42B747' : 'color: #B74242'">{{ formatNumber(diffChange.change, locale, '1.2-2') }}%</td> | ||||||
|         </tr> |         </tr> | ||||||
|       </tbody> |       </tbody> | ||||||
|     </table> |     </table> | ||||||
|   </div> --> |   </div> | ||||||
| 
 | 
 | ||||||
| </div> | </div> | ||||||
|  | |||||||
| @ -22,7 +22,8 @@ import { selectPowerOfTen } from 'src/app/bitcoin.utils'; | |||||||
|   `],
 |   `],
 | ||||||
| }) | }) | ||||||
| export class HashrateChartComponent implements OnInit { | export class HashrateChartComponent implements OnInit { | ||||||
|   @Input() widget: boolean = false; |   @Input() tableOnly = false; | ||||||
|  |   @Input() widget = false; | ||||||
|   @Input() right: number | string = 45; |   @Input() right: number | string = 45; | ||||||
|   @Input() left: number | string = 75; |   @Input() left: number | string = 75; | ||||||
| 
 | 
 | ||||||
| @ -114,7 +115,7 @@ export class HashrateChartComponent implements OnInit { | |||||||
|                 } |                 } | ||||||
|                 return { |                 return { | ||||||
|                   availableTimespanDay: availableTimespanDay, |                   availableTimespanDay: availableTimespanDay, | ||||||
|                   difficulty: tableData |                   difficulty: this.tableOnly ? tableData.slice(0, 8) : tableData | ||||||
|                 }; |                 }; | ||||||
|               }), |               }), | ||||||
|             ); |             ); | ||||||
|  | |||||||
| @ -44,11 +44,10 @@ | |||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|     <!-- pools hashrate --> |     <!-- pool dominance --> | ||||||
|     <div class="col"> |     <div class="col"> | ||||||
|       <div class="card" style="height: 385px"> |       <div class="card" style="height: 385px"> | ||||||
|         <div class="card-body"> |         <div class="card-body"> | ||||||
|           <!-- pool dominance --> |  | ||||||
|           <h5 class="card-title"> |           <h5 class="card-title"> | ||||||
|             <a href="" [routerLink]="['/mining/hashrate/pools' | relativeUrl]" i18n="mining.pool-historical-dominance"> |             <a href="" [routerLink]="['/mining/hashrate/pools' | relativeUrl]" i18n="mining.pool-historical-dominance"> | ||||||
|               Mining Pools Dominance (1y) |               Mining Pools Dominance (1y) | ||||||
| @ -59,5 +58,18 @@ | |||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|  |     <div class="col"> | ||||||
|  |       <div class="card" style="height: 385px"> | ||||||
|  |         <div class="card-body"> | ||||||
|  |           <h5 class="card-title"> | ||||||
|  |             <a href="" [routerLink]="['/mining/hashrate' | relativeUrl]" i18n="mining.pool-historical-dominance"> | ||||||
|  |               Adjusments | ||||||
|  |             </a> | ||||||
|  |           </h5> | ||||||
|  |           <app-hashrate-chart [tableOnly]=true [widget]=true></app-hashrate-chart> | ||||||
|  |         </div> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
|   </div> |   </div> | ||||||
| </div> | </div> | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user