Refactor first seen tooltip labels

This commit is contained in:
Mononaut
2024-04-01 07:00:46 +00:00
parent 9b456954b1
commit 93956d0ed4
3 changed files with 62 additions and 9 deletions

View File

@@ -29,6 +29,7 @@ export class BlockOverviewTooltipComponent implements OnChanges {
effectiveRate;
acceleration;
hasEffectiveRate: boolean = false;
timeMode: 'mempool' | 'mined' | 'missed' | 'after' = 'mempool';
filters: Filter[] = [];
activeFilters: { [key: string]: boolean } = {};
@@ -76,6 +77,22 @@ export class BlockOverviewTooltipComponent implements OnChanges {
this.activeFilters[filter.key] = true;
}
}
if (!this.relativeTime) {
this.timeMode = 'mempool';
} else {
if (this.tx?.context === 'actual' || this.tx?.status === 'found') {
this.timeMode = 'mined';
} else {
const time = this.relativeTime || Date.now();
if (this.time <= time) {
this.timeMode = 'missed';
} else {
this.timeMode = 'after';
}
}
}
this.cd.markForCheck();
}
}