Merge pull request #1380 from mempool/nymkappa/bugfix/disable-mining-non-bitcoin

Force disable mining dashboard if base_module not mempool
This commit is contained in:
softsimon 2022-03-16 18:11:25 +01:00 committed by GitHub
commit 226b345c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 10 deletions

View File

@ -4,7 +4,7 @@
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"> <div class="card-header">
<i class="fa fa-area-chart"></i> <span i18n="statistics.memory-by-vBytes">Mempool by vBytes (sat/vByte)</span> <i class="fa fa-area-chart"></i> <span i18n="statistics.memory-by-vBytes">Mempool by vBytes (sat/vByte)</span>
<form [formGroup]="radioGroupForm" class="formRadioGroup" (click)="saveGraphPreference()"> <form [formGroup]="radioGroupForm" class="formRadioGroup" [class]="stateService.env.MINING_DASHBOARD ? 'mining' : ''" (click)="saveGraphPreference()">
<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"> <label ngbButtonLabel class="btn-primary btn-sm">
<input ngbButton type="radio" [value]="'2h'" [routerLink]="['/graphs' | relativeUrl]" fragment="2h"> 2H (LIVE) <input ngbButton type="radio" [value]="'2h'" [routerLink]="['/graphs' | relativeUrl]" fragment="2h"> 2H (LIVE)

View File

@ -40,14 +40,6 @@
margin-top: 6px; margin-top: 6px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@media (min-width: 1130px) {
position: relative;
top: -65px;
}
@media (min-width: 830px) and (max-width: 1130px) {
position: relative;
top: 0px;
}
@media (min-width: 830px) { @media (min-width: 830px) {
flex-direction: row; flex-direction: row;
float: right; float: right;
@ -60,6 +52,16 @@
} }
} }
} }
.formRadioGroup.mining {
@media (min-width: 1130px) {
position: relative;
top: -65px;
}
@media (min-width: 830px) and (max-width: 1130px) {
position: relative;
top: 0px;
}
}
.loading{ .loading{
display: flex; display: flex;

View File

@ -45,7 +45,7 @@ export class StatisticsComponent implements OnInit {
private route: ActivatedRoute, private route: ActivatedRoute,
private websocketService: WebsocketService, private websocketService: WebsocketService,
private apiService: ApiService, private apiService: ApiService,
private stateService: StateService, public stateService: StateService,
private seoService: SeoService, private seoService: SeoService,
private storageService: StorageService, private storageService: StorageService,
) { } ) { }

View File

@ -111,6 +111,10 @@ export class StateService {
const browserWindowEnv = browserWindow.__env || {}; const browserWindowEnv = browserWindow.__env || {};
this.env = Object.assign(defaultEnv, browserWindowEnv); this.env = Object.assign(defaultEnv, browserWindowEnv);
if (defaultEnv.BASE_MODULE !== 'mempool') {
this.env.MINING_DASHBOARD = false;
}
if (this.isBrowser) { if (this.isBrowser) {
this.setNetworkBasedonUrl(window.location.pathname); this.setNetworkBasedonUrl(window.location.pathname);
this.isTabHidden$ = fromEvent(document, 'visibilitychange').pipe(map(() => this.isHidden()), shareReplay()); this.isTabHidden$ = fromEvent(document, 'visibilitychange').pipe(map(() => this.isHidden()), shareReplay());