Don't show negative timespans on timeline
This commit is contained in:
parent
05e88a25be
commit
2a9346f695
@ -38,7 +38,7 @@
|
|||||||
<div class="node-spacer"></div>
|
<div class="node-spacer"></div>
|
||||||
<div class="interval">
|
<div class="interval">
|
||||||
<div class="interval-time">
|
<div class="interval-time">
|
||||||
<app-time [time]="acceleratedAt - transactionTime"></app-time>
|
<app-time [time]="firstSeenToAccelerated"></app-time>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="node-spacer"></div>
|
<div class="node-spacer"></div>
|
||||||
@ -46,7 +46,7 @@
|
|||||||
<div class="interval-time">
|
<div class="interval-time">
|
||||||
@if (tx.status.confirmed) {
|
@if (tx.status.confirmed) {
|
||||||
<div class="interval-time">
|
<div class="interval-time">
|
||||||
<app-time [time]="tx.status.block_time - acceleratedAt"></app-time>
|
<app-time [time]="acceleratedToMined"></app-time>
|
||||||
</div>
|
</div>
|
||||||
} @else if (standardETA && !tx.status.confirmed) {
|
} @else if (standardETA && !tx.status.confirmed) {
|
||||||
<!-- ~<app-time [time]="standardETA / 1000 - now"></app-time> -->
|
<!-- ~<app-time [time]="standardETA / 1000 - now"></app-time> -->
|
||||||
|
@ -24,6 +24,8 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
|
|||||||
accelerateRatio: number;
|
accelerateRatio: number;
|
||||||
useAbsoluteTime: boolean = false;
|
useAbsoluteTime: boolean = false;
|
||||||
interval: number;
|
interval: number;
|
||||||
|
firstSeenToAccelerated: number;
|
||||||
|
acceleratedToMined: number;
|
||||||
|
|
||||||
tooltipPosition = null;
|
tooltipPosition = null;
|
||||||
hoverInfo: any = null;
|
hoverInfo: any = null;
|
||||||
@ -35,8 +37,6 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.acceleratedAt = this.tx.acceleratedAt ?? new Date().getTime() / 1000;
|
this.acceleratedAt = this.tx.acceleratedAt ?? new Date().getTime() / 1000;
|
||||||
this.now = Math.floor(new Date().getTime() / 1000);
|
|
||||||
this.useAbsoluteTime = this.tx.status.block_time < this.now - 7 * 24 * 3600;
|
|
||||||
|
|
||||||
this.miningService.getPools().subscribe(pools => {
|
this.miningService.getPools().subscribe(pools => {
|
||||||
for (const pool of pools) {
|
for (const pool of pools) {
|
||||||
@ -44,10 +44,8 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.interval = window.setInterval(() => {
|
this.updateTimes();
|
||||||
this.now = Math.floor(new Date().getTime() / 1000);
|
this.interval = window.setInterval(this.updateTimes.bind(this), 60000);
|
||||||
this.useAbsoluteTime = this.tx.status.block_time < this.now - 7 * 24 * 3600;
|
|
||||||
}, 60000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes): void {
|
ngOnChanges(changes): void {
|
||||||
@ -64,6 +62,13 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateTimes(): void {
|
||||||
|
this.now = Math.floor(new Date().getTime() / 1000);
|
||||||
|
this.useAbsoluteTime = this.tx.status.block_time < this.now - 7 * 24 * 3600;
|
||||||
|
this.firstSeenToAccelerated = Math.max(0, this.acceleratedAt - this.transactionTime);
|
||||||
|
this.acceleratedToMined = Math.max(0, this.tx.status.block_time - this.acceleratedAt);
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
clearInterval(this.interval);
|
clearInterval(this.interval);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user