diff --git a/frontend/src/app/components/footer/footer.component.html b/frontend/src/app/components/footer/footer.component.html index c6662e65b..c8d28824f 100644 --- a/frontend/src/app/components/footer/footer.component.html +++ b/frontend/src/app/components/footer/footer.component.html @@ -2,15 +2,18 @@
- Tx vBytes per second: - -  Backend is synchronizing - - -
-
{{ mempoolInfoData.vBytesPerSecond | ceil | number }} vB/s
-
-
+ Incoming transactions  + + +  Backend is synchronizing ({{ mempoolLoadingStatus$ | async }}%) + + +
+
 
+
‎{{ mempoolInfoData.vBytesPerSecond | ceil | number }} vB/s
+
+
+
Unconfirmed: @@ -25,3 +28,7 @@
+ + +
+
\ No newline at end of file diff --git a/frontend/src/app/components/footer/footer.component.ts b/frontend/src/app/components/footer/footer.component.ts index 17ecd78d8..dbaa478d7 100644 --- a/frontend/src/app/components/footer/footer.component.ts +++ b/frontend/src/app/components/footer/footer.component.ts @@ -13,7 +13,7 @@ interface MempoolInfoData { memPoolInfo: MempoolInfo; vBytesPerSecond: number; progressWidth: string; - progressClass: string; + progressColor: string; } @Component({ @@ -26,35 +26,62 @@ export class FooterComponent implements OnInit { mempoolBlocksData$: Observable; mempoolInfoData$: Observable; vBytesPerSecondLimit = 1667; + isLoadingWebSocket$: Observable; + mempoolLoadingStatus$: Observable; constructor( private stateService: StateService, ) { } ngOnInit() { - this.mempoolInfoData$ = combineLatest([ - this.stateService.mempoolInfo$, - this.stateService.vbytesPerSecond$ - ]) - .pipe( - map(([mempoolInfo, vbytesPerSecond]) => { - const percent = Math.round((Math.min(vbytesPerSecond, this.vBytesPerSecondLimit) / this.vBytesPerSecondLimit) * 100); + this.isLoadingWebSocket$ = this.stateService.isLoadingWebSocket$; + this.mempoolLoadingStatus$ = this.stateService.loadingIndicators$ + .pipe( + map((indicators) => indicators.mempool !== undefined ? indicators.mempool : 100) + ); - let progressClass = 'bg-danger'; - if (percent <= 75) { - progressClass = 'bg-success'; - } else if (percent <= 99) { - progressClass = 'bg-warning'; - } - - return { - memPoolInfo: mempoolInfo, - vBytesPerSecond: vbytesPerSecond, - progressWidth: percent + '%', - progressClass: progressClass, - }; - }) - ); + this.mempoolInfoData$ = combineLatest([ + this.stateService.mempoolInfo$, + this.stateService.vbytesPerSecond$ + ]) + .pipe( + map(([mempoolInfo, vbytesPerSecond]) => { + const percent = Math.round((Math.min(vbytesPerSecond, this.vBytesPerSecondLimit) / this.vBytesPerSecondLimit) * 100); + + let progressColor = '#7CB342'; + if (vbytesPerSecond > 1667) { + progressColor = '#FDD835'; + } + if (vbytesPerSecond > 2000) { + progressColor = '#FFB300'; + } + if (vbytesPerSecond > 2500) { + progressColor = '#FB8C00'; + } + if (vbytesPerSecond > 3000) { + progressColor = '#F4511E'; + } + if (vbytesPerSecond > 3500) { + progressColor = '#D81B60'; + } + + const mempoolSizePercentage = (mempoolInfo.usage / mempoolInfo.maxmempool * 100); + let mempoolSizeProgress = 'bg-danger'; + if (mempoolSizePercentage <= 50) { + mempoolSizeProgress = 'bg-success'; + } else if (mempoolSizePercentage <= 75) { + mempoolSizeProgress = 'bg-warning'; + } + + return { + memPoolInfo: mempoolInfo, + vBytesPerSecond: vbytesPerSecond, + progressWidth: percent + '%', + progressColor: progressColor, + mempoolSizeProgress: mempoolSizeProgress, + }; + }) + ); this.mempoolBlocksData$ = this.stateService.mempoolBlocks$ .pipe(