Add FAQ link for block child earlier than parent

This commit is contained in:
natsoni 2025-08-29 16:32:50 +02:00
parent fa51c74636
commit 3d325edc8a
No known key found for this signature in database
GPG key ID: C65917583181743B
3 changed files with 28 additions and 2 deletions

View file

@ -56,7 +56,11 @@
<ng-template #transactionsPlural let-i i18n="shared.transaction-count.plural">{{ i }} transactions</ng-template>
</div>
<div [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + '-time'" class="time-difference">
<app-time kind="since" [time]="block.timestamp" [fastRender]="true" [precision]="1" minUnit="minute"></app-time></div>
<app-time kind="since" [time]="block.timestamp" [fastRender]="true" [precision]="1" minUnit="minute"></app-time>
<a [routerLink]="['/docs/faq' | relativeUrl ]" class="timestamp-info" fragment="why-block-timestamps-dont-always-increase">
<fa-icon *ngIf="!minimal && isEarlierThanParent(i)" [icon]="['fas', 'info-circle']" [fixedWidth]="true"></fa-icon>
</a>
</div>
</ng-container>
</div>
<div class="animated" *ngIf="block.extras?.pool != undefined && showPools">

View file

@ -25,6 +25,17 @@
font-weight: normal;
}
.timestamp-info {
color: #fff;
position: relative;
z-index: 11;
font-size: 14px;
margin-left: 4px;
transition: color 0.15s ease-in-out;
&:hover {
color: var(--info);
}
}
.on-pool {
align-items: center;

View file

@ -431,4 +431,15 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
}
return 0;
}
}
isEarlierThanParent(index: number): boolean {
const block = this.blocks[index];
const parent = this.blocks[index + 1];
if (!block || !parent) {
return false;
}
return block.timestamp < parent.timestamp;
}
}