Refactor first seen tooltip labels
This commit is contained in:
@@ -14,13 +14,25 @@
|
||||
<a [routerLink]="['/tx/' | relativeUrl, txid]">{{ txid | shortenString : 16}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngIf="time && !relativeTime">
|
||||
<td class="label" i18n="transaction.first-seen|Transaction first seen">First seen</td>
|
||||
<td class="value"><i><app-time kind="since" [time]="time" [fastRender]="true"></app-time></i></td>
|
||||
</tr>
|
||||
<tr *ngIf="time && relativeTime">
|
||||
<td class="label" i18n="transaction.confirmed-after|Transaction confirmed after">Confirmed</td>
|
||||
<td class="value"><i><app-time kind="span" [time]="relativeTime - time"></app-time></i></td>
|
||||
<tr *ngIf="time">
|
||||
<ng-container [ngSwitch]="timeMode">
|
||||
<ng-container *ngSwitchCase="'mempool'">
|
||||
<td class="label" i18n="transaction.first-seen|Transaction first seen">First seen</td>
|
||||
<td class="value"><i><app-time kind="since" [time]="time" [fastRender]="true"></app-time></i></td>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchCase="'missed'">
|
||||
<td class="label" i18n="transaction.first-seen|Transaction first seen">First seen</td>
|
||||
<td class="value"><i><app-time kind="before" [time]="relativeTime - time"></app-time></i></td>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchCase="'after'">
|
||||
<td class="label" i18n="transaction.first-seen|Transaction first seen">First seen</td>
|
||||
<td class="value"><i><app-time kind="span" [time]="time - relativeTime"></app-time></i></td>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchCase="'mined'">
|
||||
<td class="label" i18n="transaction.confirmed-after|Transaction confirmed after">Confirmed</td>
|
||||
<td class="value"><i><app-time kind="span" [time]="relativeTime - time"></app-time></i></td>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" i18n="dashboard.latest-transactions.amount">Amount</td>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user