more misc changes

This commit is contained in:
Mononaut 2025-04-01 08:51:05 +00:00
parent 9269e872f4
commit a0946ab046
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
4 changed files with 27 additions and 5 deletions

View File

@ -1,4 +1,4 @@
<div class="text-center" class="blockchain-wrapper" [class.time-ltr]="timeLtr" [class.ltr-transition]="ltrTransitionEnabled" [class.flipped]="flipped && isA1()" #container> <div class="text-center" class="blockchain-wrapper" [class.time-ltr]="timeLtr" [class.ltr-transition]="ltrTransitionEnabled" [class.flipped]="flipped" [class.ready-to-flip]="readyToFlip" #container>
<div #positionContainer class="position-container" [ngClass]="network ? network : ''" [style]="positionStyle"> <div #positionContainer class="position-container" [ngClass]="network ? network : ''" [style]="positionStyle">
<span> <span>
<div class="blocks-wrapper"> <div class="blocks-wrapper">

View File

@ -21,11 +21,12 @@
user-select: none; /* Standard */ user-select: none; /* Standard */
transition: transform 2s;
&.flipped { &.flipped {
transform: rotate(180deg); transform: rotate(180deg);
} }
&.ready-to-flip {
transition: transform 2s;
}
} }
.position-container { .position-container {

View File

@ -29,7 +29,8 @@ export class BlockchainComponent implements OnInit, OnDestroy, OnChanges {
connected: boolean = true; connected: boolean = true;
blockDisplayMode: 'size' | 'fees'; blockDisplayMode: 'size' | 'fees';
flipped: boolean = false; flipped: boolean = true;
readyToFlip: boolean = false;
dividerOffset: number | null = null; dividerOffset: number | null = null;
mempoolOffset: number | null = null; mempoolOffset: number | null = null;
@ -42,7 +43,22 @@ export class BlockchainComponent implements OnInit, OnDestroy, OnChanges {
public stateService: StateService, public stateService: StateService,
public StorageService: StorageService, public StorageService: StorageService,
private cd: ChangeDetectorRef, private cd: ChangeDetectorRef,
) {} ) {
if (this.StorageService.getValue('ap-flipped') !== null) {
this.flipped = false;
} else {
this.flipped = this.stateService.apFlipped;
if (this.flipped) {
setTimeout(() => {
this.flipped = false;
this.stateService.apFlipped = false;
}, 5000);
}
setTimeout(() => {
this.readyToFlip = true;
}, 500);
}
}
ngOnInit(): void { ngOnInit(): void {
this.onResize(); this.onResize();
@ -94,6 +110,7 @@ export class BlockchainComponent implements OnInit, OnDestroy, OnChanges {
toggleBlockDisplayMode(): void { toggleBlockDisplayMode(): void {
if (this.isA1()) { if (this.isA1()) {
this.flipped = !this.flipped; this.flipped = !this.flipped;
this.StorageService.setValue('ap-flipped', this.flipped ? 'true' : 'false');
} else { } else {
if (this.blockDisplayMode === 'size') this.blockDisplayMode = 'fees'; if (this.blockDisplayMode === 'size') this.blockDisplayMode = 'fees';
else this.blockDisplayMode = 'size'; else this.blockDisplayMode = 'size';

View File

@ -147,6 +147,8 @@ export class StateService {
mempoolSequence: number; mempoolSequence: number;
mempoolBlockState: { block: number, transactions: { [txid: string]: TransactionStripped} }; mempoolBlockState: { block: number, transactions: { [txid: string]: TransactionStripped} };
apFlipped = false;
backend$ = new BehaviorSubject<'esplora' | 'electrum' | 'none'>('esplora'); backend$ = new BehaviorSubject<'esplora' | 'electrum' | 'none'>('esplora');
networkChanged$ = new ReplaySubject<string>(1); networkChanged$ = new ReplaySubject<string>(1);
lightningChanged$ = new ReplaySubject<boolean>(1); lightningChanged$ = new ReplaySubject<boolean>(1);
@ -254,6 +256,8 @@ export class StateService {
} }
}); });
this.apFlipped = true;
this.liveMempoolBlockTransactions$ = this.mempoolBlockUpdate$.pipe(scan((acc: { block: number, transactions: { [txid: string]: TransactionStripped } }, change: MempoolBlockUpdate): { block: number, transactions: { [txid: string]: TransactionStripped } } => { this.liveMempoolBlockTransactions$ = this.mempoolBlockUpdate$.pipe(scan((acc: { block: number, transactions: { [txid: string]: TransactionStripped } }, change: MempoolBlockUpdate): { block: number, transactions: { [txid: string]: TransactionStripped } } => {
if (isMempoolState(change)) { if (isMempoolState(change)) {
const txMap = {}; const txMap = {};