Confirmation badge component, fix negative confirmations
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user