Add block display mode toggle button
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
</ng-container>
|
||||
</div>
|
||||
<div id="divider" [hidden]="pageIndex > 0">
|
||||
<button class="block-display-toggle" (click)="toggleBlockDisplayMode()"><fa-icon [icon]="['fas', 'exchange-alt']" [fixedWidth]="true"></fa-icon></button>
|
||||
<button class="time-toggle" (click)="toggleTimeDirection()"><fa-icon [icon]="['fas', 'exchange-alt']" [fixedWidth]="true"></fa-icon></button>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
@@ -67,9 +67,24 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.block-display-toggle {
|
||||
color: white;
|
||||
font-size: 0.8rem;
|
||||
position: absolute;
|
||||
bottom: 15.8em;
|
||||
left: 1px;
|
||||
transform: translateX(-50%) rotate(90deg);
|
||||
background: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.blockchain-wrapper.ltr-transition .blocks-wrapper,
|
||||
.blockchain-wrapper.ltr-transition .position-container,
|
||||
.blockchain-wrapper.ltr-transition .time-toggle {
|
||||
.blockchain-wrapper.ltr-transition .time-toggle,
|
||||
.blockchain-wrapper.ltr-transition .block-display-toggle {
|
||||
transition: transform 1s;
|
||||
}
|
||||
|
||||
@@ -81,6 +96,10 @@
|
||||
.time-toggle {
|
||||
transform: translateX(-50%) scaleX(-1);
|
||||
}
|
||||
|
||||
.block-display-toggle {
|
||||
transform: translateX(-50%) scaleX(-1) rotate(90deg);
|
||||
}
|
||||
}
|
||||
|
||||
:host-context(.ltr-layout) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, Input, Output, EventEmitter, ChangeDetectorRef, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { firstValueFrom, Subscription } from 'rxjs';
|
||||
import { StateService } from '../../services/state.service';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-blockchain',
|
||||
@@ -26,15 +27,18 @@ export class BlockchainComponent implements OnInit, OnDestroy, OnChanges {
|
||||
connectionStateSubscription: Subscription;
|
||||
loadingTip: boolean = true;
|
||||
connected: boolean = true;
|
||||
blockDisplayMode: 'size' | 'fees';
|
||||
|
||||
dividerOffset: number | null = null;
|
||||
mempoolOffset: number | null = null;
|
||||
positionStyle = {
|
||||
transform: "translateX(1280px)",
|
||||
};
|
||||
blockDisplayToggleStyle = {};
|
||||
|
||||
constructor(
|
||||
public stateService: StateService,
|
||||
public StorageService: StorageService,
|
||||
private cd: ChangeDetectorRef,
|
||||
) {}
|
||||
|
||||
@@ -51,6 +55,7 @@ export class BlockchainComponent implements OnInit, OnDestroy, OnChanges {
|
||||
firstValueFrom(this.stateService.chainTip$).then(() => {
|
||||
this.loadingTip = false;
|
||||
});
|
||||
this.blockDisplayMode = this.StorageService.getValue('block-display-mode-preference') as 'size' | 'fees' || 'size';
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
@@ -84,6 +89,13 @@ export class BlockchainComponent implements OnInit, OnDestroy, OnChanges {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
toggleBlockDisplayMode(): void {
|
||||
if (this.blockDisplayMode === 'size') this.blockDisplayMode = 'fees';
|
||||
else this.blockDisplayMode = 'size';
|
||||
this.StorageService.setValue('block-display-mode-preference', this.blockDisplayMode);
|
||||
this.stateService.blockDisplayMode$.next(this.blockDisplayMode);
|
||||
}
|
||||
|
||||
onMempoolWidthChange(width): void {
|
||||
if (this.flipping) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user