2023-06-04 10:32:24 +04:00
|
|
|
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
|
2023-05-30 16:36:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-confirmations',
|
|
|
|
templateUrl: './confirmations.component.html',
|
|
|
|
styleUrls: ['./confirmations.component.scss'],
|
2023-06-04 10:32:24 +04:00
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
2023-05-30 16:36:49 -04:00
|
|
|
})
|
|
|
|
export class ConfirmationsComponent implements OnChanges {
|
|
|
|
@Input() chainTip: number;
|
|
|
|
@Input() height: number;
|
|
|
|
@Input() replaced: boolean = false;
|
2023-06-16 13:47:09 -04:00
|
|
|
@Input() removed: boolean = false;
|
2023-05-30 16:36:49 -04:00
|
|
|
@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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|