Bugfix: Dashboard preloading skeleton. (#668)

* Change green color.

* Fix dashboard preloading components.
This commit is contained in:
Miguel Medeiros 2021-07-26 20:47:08 -03:00 committed by GitHub
parent be1ef43cd1
commit 735c2ba587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 31 deletions

View File

@ -73,11 +73,12 @@
.skeleton-loader { .skeleton-loader {
width: 100%; width: 100%;
display: block; display: block;
margin: 9px auto;
&:first-child { &:first-child {
max-width: 90px; max-width: 90px;
margin: 15px auto 3px;
} }
&:last-child { &:last-child {
margin: 10px auto 3px;
max-width: 55px; max-width: 55px;
} }
} }

View File

@ -142,12 +142,16 @@
</div> </div>
<ng-template #loadingTransactions>
<div class="skeleton-loader skeleton-loader-transactions"></div>
</ng-template>
<ng-template #loading> <ng-template #loading>
<div class="skeleton-loader"></div> <div class="skeleton-loader"></div>
</ng-template> </ng-template>
<ng-template #loadingsmall> <ng-template #loadingbig>
<span class="skeleton-loader" style="width: 80%;"></span> <span class="skeleton-loader skeleton-loader-big" ></span>
</ng-template> </ng-template>
<ng-template #emptyBlock> <ng-template #emptyBlock>
@ -161,19 +165,19 @@
<div class="item"> <div class="item">
<h5 *ngIf="!mempoolInfoData.value || mempoolInfoData.value.memPoolInfo.mempoolminfee === 0.00001 else purgingText" class="card-title" i18n="dashboard.minimum-fee|Minimum mempool fee">Minimum fee</h5> <h5 *ngIf="!mempoolInfoData.value || mempoolInfoData.value.memPoolInfo.mempoolminfee === 0.00001 else purgingText" class="card-title" i18n="dashboard.minimum-fee|Minimum mempool fee">Minimum fee</h5>
<ng-template #purgingText><h5 class="card-title" i18n="dashboard.purging|Purgin below fee">Purging</h5></ng-template> <ng-template #purgingText><h5 class="card-title" i18n="dashboard.purging|Purgin below fee">Purging</h5></ng-template>
<p class="card-text" *ngIf="mempoolInfoData.value; else loading"> <p class="card-text" *ngIf="(isLoadingWebSocket$ | async) === false && mempoolInfoData.value; else loading">
<ng-template [ngIf]="mempoolInfoData.value.memPoolInfo.mempoolminfee > 0.00001">&lt; </ng-template>{{ mempoolInfoData.value.memPoolInfo.mempoolminfee * 100000 | number : '1.1-1' }} <span><ng-container i18n="shared.sat-vbyte|sat/vB">sat/vB</ng-container></span> <ng-template [ngIf]="mempoolInfoData.value.memPoolInfo.mempoolminfee > 0.00001">&lt; </ng-template>{{ mempoolInfoData.value.memPoolInfo.mempoolminfee * 100000 | number : '1.1-1' }} <span><ng-container i18n="shared.sat-vbyte|sat/vB">sat/vB</ng-container></span>
</p> </p>
</div> </div>
<div class="item"> <div class="item">
<h5 class="card-title" i18n="dashboard.unconfirmed|Unconfirmed count">Unconfirmed</h5> <h5 class="card-title" i18n="dashboard.unconfirmed|Unconfirmed count">Unconfirmed</h5>
<p class="card-text" *ngIf="mempoolInfoData.value; else loading"> <p class="card-text" *ngIf="(isLoadingWebSocket$ | async) === false && mempoolInfoData.value; else loading">
{{ mempoolInfoData.value.memPoolInfo.size | number }} <span i18n="dashboard.txs">TXs</span> {{ mempoolInfoData.value.memPoolInfo.size | number }} <span i18n="dashboard.txs">TXs</span>
</p> </p>
</div> </div>
<div class="item bar"> <div class="item bar">
<h5 class="card-title" i18n="dashboard.memory-usage|Memory usage">Memory usage</h5> <h5 class="card-title" i18n="dashboard.memory-usage|Memory usage">Memory usage</h5>
<div class="card-text" *ngIf="mempoolInfoData.value; else loadingsmall"> <div class="card-text" *ngIf="(isLoadingWebSocket$ | async) === false && mempoolInfoData.value; else loadingbig">
<div class="progress"> <div class="progress">
<div class="progress-bar {{ mempoolInfoData.value.mempoolSizeProgress }}" role="progressbar" [ngStyle]="{'width': (mempoolInfoData.value.memPoolInfo.usage / mempoolInfoData.value.memPoolInfo.maxmempool * 100) + '%' }">&nbsp;</div> <div class="progress-bar {{ mempoolInfoData.value.mempoolSizeProgress }}" role="progressbar" [ngStyle]="{'width': (mempoolInfoData.value.memPoolInfo.usage / mempoolInfoData.value.memPoolInfo.maxmempool * 100) + '%' }">&nbsp;</div>
<div class="progress-text"><span [innerHTML]="mempoolInfoData.value.memPoolInfo.usage | bytes"></span> / <span [innerHTML]="mempoolInfoData.value.memPoolInfo.maxmempool | bytes"></span></div> <div class="progress-text"><span [innerHTML]="mempoolInfoData.value.memPoolInfo.usage | bytes"></span> / <span [innerHTML]="mempoolInfoData.value.memPoolInfo.maxmempool | bytes"></span></div>
@ -185,7 +189,7 @@
<ng-template #txPerSecond let-mempoolInfoData> <ng-template #txPerSecond let-mempoolInfoData>
<h5 class="card-title" i18n="dashboard.incoming-transactions">Incoming transactions</h5> <h5 class="card-title" i18n="dashboard.incoming-transactions">Incoming transactions</h5>
<ng-template [ngIf]="mempoolInfoData.value" [ngIfElse]="loading"> <ng-template [ngIf]="(isLoadingWebSocket$ | async) === false && mempoolInfoData.value" [ngIfElse]="loadingTransactions">
<span *ngIf="(mempoolLoadingStatus$ | async) !== 100; else inSync"> <span *ngIf="(mempoolLoadingStatus$ | async) !== 100; else inSync">
&nbsp;<span class="badge badge-pill badge-warning"><ng-container i18n="dashboard.backend-is-synchronizing">Backend is synchronizing</ng-container> ({{ mempoolLoadingStatus$ | async }}%)</span> &nbsp;<span class="badge badge-pill badge-warning"><ng-container i18n="dashboard.backend-is-synchronizing">Backend is synchronizing</ng-container> ({{ mempoolLoadingStatus$ | async }}%)</span>
</span> </span>
@ -203,7 +207,7 @@
<div class="card-wrapper"> <div class="card-wrapper">
<div class="card"> <div class="card">
<div class="card-body more-padding"> <div class="card-body more-padding">
<div class="difficulty-adjustment-container" *ngIf="(difficultyEpoch$ | async) as epochData; else loadingDifficulty"> <div class="difficulty-adjustment-container" *ngIf="(isLoadingWebSocket$ | async) === false && (difficultyEpoch$ | async) as epochData; else loadingDifficulty">
<div class="item"> <div class="item">
<h5 class="card-title" i18n="difficulty-box.remaining">Remaining</h5> <h5 class="card-title" i18n="difficulty-box.remaining">Remaining</h5>
<div class="card-text"> <div class="card-text">
@ -222,7 +226,8 @@
<ng-template #arrowDownDifficulty > <ng-template #arrowDownDifficulty >
<fa-icon class="retarget-sign" [icon]="['fas', 'caret-down']" [fixedWidth]="true"></fa-icon> <fa-icon class="retarget-sign" [icon]="['fas', 'caret-down']" [fixedWidth]="true"></fa-icon>
</ng-template> </ng-template>
{{ epochData.change | absolute | number: '1.2-2' }} <span class="symbol">%</span> {{ epochData.change | absolute | number: '1.2-2' }}
<span class="symbol">%</span>
</div> </div>
<div class="symbol"> <div class="symbol">
<span i18n="difficulty-box.previous">Previous</span>: <span i18n="difficulty-box.previous">Previous</span>:
@ -233,7 +238,8 @@
<ng-template #arrowDownPreviousDifficulty > <ng-template #arrowDownPreviousDifficulty >
<fa-icon class="previous-retarget-sign" [icon]="['fas', 'caret-down']" [fixedWidth]="true"></fa-icon> <fa-icon class="previous-retarget-sign" [icon]="['fas', 'caret-down']" [fixedWidth]="true"></fa-icon>
</ng-template> </ng-template>
{{ epochData.previousRetarget | absolute | number: '1.2-2' }} </span> %</div> {{ epochData.previousRetarget | absolute | number: '1.2-2' }} </span> %
</div>
</div> </div>
<div class="item"> <div class="item">
<h5 class="card-title" i18n="difficulty-box.current-period">Current Period</h5> <h5 class="card-title" i18n="difficulty-box.current-period">Current Period</h5>

View File

@ -31,7 +31,7 @@
width: 100%; width: 100%;
background-color: #2d3348; background-color: #2d3348;
height: 1.1rem; height: 1.1rem;
max-width: 130px; max-width: 180px;
} }
.bg-warning { .bg-warning {
@ -117,6 +117,15 @@
margin: 0px auto 0px; margin: 0px auto 0px;
} }
} }
.skeleton-loader {
width: 100%;
max-width: 100px;
display: block;
margin: 18px auto 0;
}
.skeleton-loader-big {
max-width: 180px;
}
} }
.latest-transactions { .latest-transactions {
@ -160,6 +169,13 @@
text-align: right; text-align: right;
} }
} }
.skeleton-loader-transactions {
max-width: 250px;
position: relative;
top: 2px;
margin-bottom: -3px;
height: 18px;
}
.lastest-blocks-table { .lastest-blocks-table {
width: 100%; width: 100%;
@ -219,6 +235,7 @@
.small-bar { .small-bar {
height: 8px; height: 8px;
top: -4px; top: -4px;
max-width: 120px;
} }
.difficulty-adjustment-container { .difficulty-adjustment-container {
@ -233,7 +250,7 @@
.item { .item {
padding: 0 5px; padding: 0 5px;
width: 100%; width: 100%;
&:nth-child(1){ &:nth-child(1) {
display: none; display: none;
@media (min-width: 485px) { @media (min-width: 485px) {
display: table-cell; display: table-cell;
@ -283,24 +300,24 @@
margin-bottom: 0; margin-bottom: 0;
} }
} }
} .card-text {
.loading-container{
min-height: 76px;
}
.card-text {
.skeleton-loader { .skeleton-loader {
width: 100%; width: 100%;
display: block; display: block;
margin: 7px auto;
&:first-child { &:first-child {
margin: 14px auto 0;
max-width: 80px; max-width: 80px;
} }
&:last-child { &:last-child {
max-width: 110px; margin: 10px auto 0;
max-width: 120px;
} }
} }
}
}
.loading-container {
min-height: 76px;
} }
.main-title { .main-title {
@ -313,6 +330,7 @@
text-align: center; text-align: center;
padding-bottom: 3px; padding-bottom: 3px;
} }
.card-wrapper { .card-wrapper {
.card { .card {
height: auto !important; height: auto !important;

View File

@ -62,6 +62,7 @@ export class DashboardComponent implements OnInit {
mempoolTransactionsWeightPerSecondData: any; mempoolTransactionsWeightPerSecondData: any;
mempoolStats$: Observable<MempoolStatsData>; mempoolStats$: Observable<MempoolStatsData>;
transactionsWeightPerSecondOptions: any; transactionsWeightPerSecondOptions: any;
isLoadingWebSocket$: Observable<boolean>;
constructor( constructor(
@Inject(LOCALE_ID) private locale: string, @Inject(LOCALE_ID) private locale: string,
@ -73,6 +74,8 @@ export class DashboardComponent implements OnInit {
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
this.isLoadingWebSocket$ = this.stateService.isLoadingWebSocket$;
this.seoService.resetTitle(); this.seoService.resetTitle();
this.websocketService.want(['blocks', 'stats', 'mempool-blocks', 'live-2h-chart']); this.websocketService.want(['blocks', 'stats', 'mempool-blocks', 'live-2h-chart']);
this.network$ = merge(of(''), this.stateService.networkChanged$); this.network$ = merge(of(''), this.stateService.networkChanged$);
@ -141,13 +144,13 @@ export class DashboardComponent implements OnInit {
let colorAdjustments = '#dc3545'; let colorAdjustments = '#dc3545';
if (difficultyChange >= 0) { if (difficultyChange >= 0) {
colorAdjustments = '#299435'; colorAdjustments = '#3bcc49';
} }
let colorPreviousAdjustments = '#dc3545'; let colorPreviousAdjustments = '#dc3545';
if(previousRetarget){ if(previousRetarget){
if (previousRetarget >= 0) { if (previousRetarget >= 0) {
colorPreviousAdjustments = '#299435'; colorPreviousAdjustments = '#3bcc49';
} }
if (previousRetarget === 0) { if (previousRetarget === 0) {
colorPreviousAdjustments = '#ffffff66'; colorPreviousAdjustments = '#ffffff66';