Renaming Mempool blocks to "next block" + ux fixes

This commit is contained in:
softsimon 2020-03-25 03:59:30 +07:00
parent 9aaa021d08
commit 7abf978795
6 changed files with 27 additions and 15 deletions

View File

@ -1,4 +1,4 @@
<div style="height: 350px;" *ngIf="mempoolVsizeFeesData; else loadingFees"> <div style="height: 225px;" *ngIf="mempoolVsizeFeesData; else loadingFees">
<app-chartist <app-chartist
[data]="mempoolVsizeFeesData" [data]="mempoolVsizeFeesData"
[type]="'Line'" [type]="'Line'"

View File

@ -28,6 +28,7 @@ export class FeeDistributionGraphComponent implements OnChanges {
low: 0, low: 0,
axisY: { axisY: {
showLabel: false, showLabel: false,
offset: 0
}, },
axisX: { axisX: {
showGrid: true, showGrid: true,

View File

@ -1,11 +1,9 @@
<div class="container-xl" *ngIf="mempoolBlock$ | async as mempoolBlock"> <div class="container-xl" *ngIf="mempoolBlock$ | async as mempoolBlock">
<div class="title-block"> <div class="title-block">
<h1>Mempool block</h1> <h1>{{ getGetOrdinal() }}</h1>
</div> </div>
<br>
<div class="box"> <div class="box">
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">

View File

@ -22,7 +22,6 @@ export class MempoolBlockComponent implements OnInit, OnDestroy {
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
this.seoService.setTitle('Mempool block');
this.mempoolBlock$ = this.route.paramMap this.mempoolBlock$ = this.route.paramMap
.pipe( .pipe(
switchMap((params: ParamMap) => { switchMap((params: ParamMap) => {
@ -33,6 +32,7 @@ export class MempoolBlockComponent implements OnInit, OnDestroy {
while (!mempoolBlocks[this.mempoolBlockIndex]) { while (!mempoolBlocks[this.mempoolBlockIndex]) {
this.mempoolBlockIndex--; this.mempoolBlockIndex--;
} }
this.seoService.setTitle(this.getGetOrdinal());
return mempoolBlocks[this.mempoolBlockIndex]; return mempoolBlocks[this.mempoolBlockIndex];
}) })
); );
@ -47,4 +47,14 @@ export class MempoolBlockComponent implements OnInit, OnDestroy {
this.stateService.markBlock$.next({}); this.stateService.markBlock$.next({});
} }
getGetOrdinal() {
if (this.mempoolBlockIndex === 0) {
return 'Next block';
}
const s = ['th', 'st', 'nd', 'rd'];
const v = this.mempoolBlockIndex + 1 % 100;
return this.mempoolBlockIndex + 1 + (s[(v - 20) % 10] || s[v] || s[0]) + ' next block';
}
} }

View File

@ -25,6 +25,8 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
markIndex: number; markIndex: number;
txFeePerVSize: number; txFeePerVSize: number;
resetTransitionTimeout: number;
constructor( constructor(
private router: Router, private router: Router,
private stateService: StateService, private stateService: StateService,
@ -133,10 +135,11 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
this.arrowVisible = false; this.arrowVisible = false;
return; return;
} else if (this.markIndex > -1) { } else if (this.markIndex > -1) {
clearTimeout(this.resetTransitionTimeout);
this.transition = 'inherit'; this.transition = 'inherit';
this.rightPosition = this.markIndex * (this.blockWidth + this.blockPadding) + 0.5 * this.blockWidth; this.rightPosition = this.markIndex * (this.blockWidth + this.blockPadding) + 0.5 * this.blockWidth;
this.arrowVisible = true; this.arrowVisible = true;
setTimeout(() => this.transition = '1s'); this.resetTransitionTimeout = window.setTimeout(() => this.transition = '1s', 100);
return; return;
} }

View File

@ -636,7 +636,7 @@ Chartist.plugins.ctPointLabels = (options) => {
labelClass: 'ct-point-label', labelClass: 'ct-point-label',
labelOffset: { labelOffset: {
x: 0, x: 0,
y: -10 y: -7
}, },
textAnchor: 'middle' textAnchor: 'middle'
}; };