Merge pull request #4829 from mempool/natsoni/allow-show-block-fees-only
Add an option to always show the block fees on infinite blockchain
This commit is contained in:
commit
52a33d5a51
@ -40,12 +40,14 @@
|
|||||||
<app-fee-rate unitClass=""></app-fee-rate>
|
<app-fee-rate unitClass=""></app-fee-rate>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<div [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + '-total-fees'" *ngIf="showMiningInfo"
|
<div [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + '-total-fees'" *ngIf="showMiningInfo$ | async; else noMiningInfo"
|
||||||
class="block-size">
|
class="block-size">
|
||||||
<app-amount [satoshis]="block.extras?.totalFees ?? 0" digitsInfo="1.2-3" [noFiat]="true"></app-amount>
|
<app-amount [satoshis]="block.extras?.totalFees ?? 0" digitsInfo="1.2-3" [noFiat]="true"></app-amount>
|
||||||
</div>
|
</div>
|
||||||
<div [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + 'block-size'" *ngIf="!showMiningInfo"
|
<ng-template #noMiningInfo>
|
||||||
|
<div [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + 'block-size'"
|
||||||
class="block-size" [innerHTML]="'‎' + (block.size | bytes: 2)"></div>
|
class="block-size" [innerHTML]="'‎' + (block.size | bytes: 2)"></div>
|
||||||
|
</ng-template>
|
||||||
<div [attr.data-cy]="'bitcoin-block-' + i + '-transactions'" class="transaction-count">
|
<div [attr.data-cy]="'bitcoin-block-' + i + '-transactions'" class="transaction-count">
|
||||||
<ng-container
|
<ng-container
|
||||||
*ngTemplateOutlet="block.tx_count === 1 ? transactionsSingular : transactionsPlural; context: {$implicit: block.tx_count | number}"></ng-container>
|
*ngTemplateOutlet="block.tx_count === 1 ? transactionsSingular : transactionsPlural; context: {$implicit: block.tx_count | number}"></ng-container>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef, Input, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { Observable, Subscription } from 'rxjs';
|
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
||||||
import { StateService } from '../../services/state.service';
|
import { StateService } from '../../services/state.service';
|
||||||
import { specialBlocks } from '../../app.constants';
|
import { specialBlocks } from '../../app.constants';
|
||||||
import { BlockExtended } from '../../interfaces/node-api.interface';
|
import { BlockExtended } from '../../interfaces/node-api.interface';
|
||||||
@ -45,6 +45,7 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
markBlockSubscription: Subscription;
|
markBlockSubscription: Subscription;
|
||||||
txConfirmedSubscription: Subscription;
|
txConfirmedSubscription: Subscription;
|
||||||
loadingBlocks$: Observable<boolean>;
|
loadingBlocks$: Observable<boolean>;
|
||||||
|
showMiningInfo$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||||
blockStyles = [];
|
blockStyles = [];
|
||||||
emptyBlockStyles = [];
|
emptyBlockStyles = [];
|
||||||
interval: any;
|
interval: any;
|
||||||
@ -54,7 +55,6 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
arrowLeftPx = 30;
|
arrowLeftPx = 30;
|
||||||
blocksFilled = false;
|
blocksFilled = false;
|
||||||
arrowTransition = '1s';
|
arrowTransition = '1s';
|
||||||
showMiningInfo = false;
|
|
||||||
timeLtrSubscription: Subscription;
|
timeLtrSubscription: Subscription;
|
||||||
timeLtr: boolean;
|
timeLtr: boolean;
|
||||||
|
|
||||||
@ -80,8 +80,11 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enabledMiningInfoIfNeeded(url) {
|
enabledMiningInfoIfNeeded(url) {
|
||||||
this.showMiningInfo = url.includes('/mining') || url.includes('/acceleration');
|
const urlParts = url.split('/');
|
||||||
this.cd.markForCheck(); // Need to update the view asap
|
const onDashboard = ['','testnet','signet','mining','acceleration'].includes(urlParts[urlParts.length - 1]);
|
||||||
|
if (onDashboard) { // Only update showMiningInfo if we are on the main, mining or acceleration dashboards
|
||||||
|
this.stateService.showMiningInfo$.next(url.includes('/mining') || url.includes('/acceleration'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -90,6 +93,7 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
if (['', 'testnet', 'signet'].includes(this.stateService.network)) {
|
if (['', 'testnet', 'signet'].includes(this.stateService.network)) {
|
||||||
this.enabledMiningInfoIfNeeded(this.location.path());
|
this.enabledMiningInfoIfNeeded(this.location.path());
|
||||||
this.location.onUrlChange((url) => this.enabledMiningInfoIfNeeded(url));
|
this.location.onUrlChange((url) => this.enabledMiningInfoIfNeeded(url));
|
||||||
|
this.showMiningInfo$ = this.stateService.showMiningInfo$;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.timeLtrSubscription = this.stateService.timeLtr.subscribe((ltr) => {
|
this.timeLtrSubscription = this.stateService.timeLtr.subscribe((ltr) => {
|
||||||
|
@ -60,6 +60,7 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
showMiningInfo = false;
|
showMiningInfo = false;
|
||||||
timeLtrSubscription: Subscription;
|
timeLtrSubscription: Subscription;
|
||||||
timeLtr: boolean;
|
timeLtr: boolean;
|
||||||
|
showMiningInfoSubscription: Subscription;
|
||||||
animateEntry: boolean = false;
|
animateEntry: boolean = false;
|
||||||
|
|
||||||
blockOffset: number = 155;
|
blockOffset: number = 155;
|
||||||
@ -89,11 +90,6 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
private location: Location,
|
private location: Location,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
enabledMiningInfoIfNeeded(url) {
|
|
||||||
this.showMiningInfo = url.includes('/mining') || url.includes('/acceleration');
|
|
||||||
this.cd.markForCheck(); // Need to update the view asap
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.chainTip = this.stateService.latestBlockHeight;
|
this.chainTip = this.stateService.latestBlockHeight;
|
||||||
|
|
||||||
@ -102,8 +98,10 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.widthChange.emit(this.mempoolWidth);
|
this.widthChange.emit(this.mempoolWidth);
|
||||||
|
|
||||||
if (['', 'testnet', 'signet'].includes(this.stateService.network)) {
|
if (['', 'testnet', 'signet'].includes(this.stateService.network)) {
|
||||||
this.enabledMiningInfoIfNeeded(this.location.path());
|
this.showMiningInfoSubscription = this.stateService.showMiningInfo$.subscribe((showMiningInfo) => {
|
||||||
this.location.onUrlChange((url) => this.enabledMiningInfoIfNeeded(url));
|
this.showMiningInfo = showMiningInfo;
|
||||||
|
this.cd.markForCheck();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.timeLtrSubscription = this.stateService.timeLtr.subscribe((ltr) => {
|
this.timeLtrSubscription = this.stateService.timeLtr.subscribe((ltr) => {
|
||||||
@ -269,6 +267,7 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.chainTipSubscription.unsubscribe();
|
this.chainTipSubscription.unsubscribe();
|
||||||
this.keySubscription.unsubscribe();
|
this.keySubscription.unsubscribe();
|
||||||
this.isTabHiddenSubscription.unsubscribe();
|
this.isTabHiddenSubscription.unsubscribe();
|
||||||
|
this.showMiningInfoSubscription.unsubscribe();
|
||||||
clearTimeout(this.resetTransitionTimeout);
|
clearTimeout(this.resetTransitionTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +151,7 @@ export class StateService {
|
|||||||
hideAudit: BehaviorSubject<boolean>;
|
hideAudit: BehaviorSubject<boolean>;
|
||||||
fiatCurrency$: BehaviorSubject<string>;
|
fiatCurrency$: BehaviorSubject<string>;
|
||||||
rateUnits$: BehaviorSubject<string>;
|
rateUnits$: BehaviorSubject<string>;
|
||||||
|
showMiningInfo$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
searchFocus$: Subject<boolean> = new Subject<boolean>();
|
searchFocus$: Subject<boolean> = new Subject<boolean>();
|
||||||
menuOpen$: BehaviorSubject<boolean> = new BehaviorSubject(false);
|
menuOpen$: BehaviorSubject<boolean> = new BehaviorSubject(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user