Clean up timeline code

This commit is contained in:
natsoni 2024-10-09 17:50:24 +09:00
parent 15b7e75b69
commit c4004ba301
No known key found for this signature in database
GPG Key ID: C65917583181743B
2 changed files with 1 additions and 23 deletions

View File

@ -9,7 +9,7 @@
<div class="interval">
<div class="interval-time">
@if (eta) {
~<app-time [time]="eta?.wait / 1000"></app-time> <!-- <span *ngIf="accelerateRatio > 1" class="compare"> ({{ accelerateRatio }}x faster)</span> -->
~<app-time [time]="eta?.wait / 1000"></app-time>
}
</div>
</div>
@ -48,8 +48,6 @@
<div class="interval-time">
<app-time [time]="acceleratedToMined"></app-time>
</div>
} @else if (standardETA && !tx.status.confirmed) {
<!-- ~<app-time [time]="standardETA / 1000 - now"></app-time> -->
}
</div>
</div>

View File

@ -14,16 +14,11 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
@Input() tx: Transaction;
@Input() accelerationInfo: Acceleration;
@Input() eta: ETA;
// A mined transaction has standard ETA and accelerated ETA undefined
// A transaction in mempool has either standardETA defined (if accelerated) or acceleratedETA defined (if not accelerated yet)
@Input() standardETA: number;
@Input() acceleratedETA: number;
acceleratedAt: number;
now: number;
accelerateRatio: number;
useAbsoluteTime: boolean = false;
interval: number;
firstSeenToAccelerated: number;
acceleratedToMined: number;
@ -47,17 +42,6 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
ngOnChanges(changes): void {
this.updateTimes();
// Hide standard ETA while we don't have a proper standard ETA calculation, see https://github.com/mempool/mempool/issues/65
// if (changes?.eta?.currentValue || changes?.standardETA?.currentValue || changes?.acceleratedETA?.currentValue) {
// if (changes?.eta?.currentValue) {
// if (changes?.acceleratedETA?.currentValue) {
// this.accelerateRatio = Math.floor((Math.floor(changes.eta.currentValue.time / 1000) - this.now) / (Math.floor(changes.acceleratedETA.currentValue / 1000) - this.now));
// } else if (changes?.standardETA?.currentValue) {
// this.accelerateRatio = Math.floor((Math.floor(changes.standardETA.currentValue / 1000) - this.now) / (Math.floor(changes.eta.currentValue.time / 1000) - this.now));
// }
// }
// }
}
updateTimes(): void {
@ -67,10 +51,6 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
this.acceleratedToMined = Math.max(0, this.tx.status.block_time - this.acceleratedAt);
}
ngOnDestroy(): void {
clearInterval(this.interval);
}
onHover(event, status: string): void {
if (status === 'seen') {
this.hoverInfo = {