mempool/frontend/src/app/shared/components/confirmations/confirmations.component.ts

26 lines
684 B
TypeScript
Raw Normal View History

import { Component, Input, OnChanges } from '@angular/core';
@Component({
selector: 'app-confirmations',
templateUrl: './confirmations.component.html',
styleUrls: ['./confirmations.component.scss'],
})
export class ConfirmationsComponent implements OnChanges {
@Input() chainTip: number;
@Input() height: number;
@Input() replaced: boolean = false;
@Input() hideUnconfirmed: boolean = false;
@Input() buttonClass: string = '';
confirmations: number = 0;
ngOnChanges(): void {
if (this.chainTip != null && this.height != null) {
this.confirmations = Math.max(1, this.chainTip - this.height + 1);
} else {
this.confirmations = 0;
}
}
}