Fix pool detail page layout - add loading skeleton
This commit is contained in:
		
							parent
							
								
									f23f7f1cfa
								
							
						
					
					
						commit
						71d500d750
					
				@ -1,7 +1,7 @@
 | 
				
			|||||||
<div class="container">
 | 
					<div class="container">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <div *ngIf="poolStats$ | async as poolStats">
 | 
					  <div *ngIf="poolStats$ | async as poolStats; else loadingMain">
 | 
				
			||||||
    <h1 class="m-0">
 | 
					    <h1 class="m-0 mb-2">
 | 
				
			||||||
      <img width="50" src="{{ poolStats['logo'] }}" onError="this.src = './resources/mining-pools/default.svg'"
 | 
					      <img width="50" src="{{ poolStats['logo'] }}" onError="this.src = './resources/mining-pools/default.svg'"
 | 
				
			||||||
        class="mr-3">
 | 
					        class="mr-3">
 | 
				
			||||||
      {{ poolStats.pool.name }}
 | 
					      {{ poolStats.pool.name }}
 | 
				
			||||||
@ -54,27 +54,27 @@
 | 
				
			|||||||
    <div class="spinner-border text-light"></div>
 | 
					    <div class="spinner-border text-light"></div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <table class="table table-borderless" [alwaysCallback]="true" infiniteScroll [infiniteScrollDistance]="1.5"
 | 
					  <table *ngIf="blocks$ | async as blocks" class="table table-borderless" [alwaysCallback]="true" infiniteScroll [infiniteScrollDistance]="1.5"
 | 
				
			||||||
    [infiniteScrollUpDistance]="1.5" [infiniteScrollThrottle]="50" (scrolled)="loadMore()">
 | 
					    [infiniteScrollUpDistance]="1.5" [infiniteScrollThrottle]="50" (scrolled)="loadMore()">
 | 
				
			||||||
    <thead>
 | 
					    <thead>
 | 
				
			||||||
      <th style="width: 15%;" i18n="latest-blocks.height">Height</th>
 | 
					      <th style="width: 15%;" i18n="latest-blocks.height">Height</th>
 | 
				
			||||||
      <th class="d-none d-md-block" style="width: 20%;" i18n="latest-blocks.timestamp">Timestamp</th>
 | 
					      <th class="d-none d-md-block" style="width: 20%;" i18n="latest-blocks.timestamp">Timestamp</th>
 | 
				
			||||||
      <th style="width: 20%;" i18n="latest-blocks.mined">Mined</th>
 | 
					      <th style="width: 20%;" i18n="latest-blocks.mined">Mined</th>
 | 
				
			||||||
      <th style="width: 10%;" i18n="latest-blocks.reward">Reward</th>
 | 
					      <th class="text-right" style="width: 10%; padding-right: 30px" i18n="latest-blocks.reward">Reward</th>
 | 
				
			||||||
      <th class="d-none d-lg-block" style="width: 15%;" i18n="latest-blocks.transactions">Transactions</th>
 | 
					      <th class="d-none d-lg-block text-right" style="width: 15%; padding-right: 40px" i18n="latest-blocks.transactions">Transactions</th>
 | 
				
			||||||
      <th style="width: 20%;" i18n="latest-blocks.size">Size</th>
 | 
					      <th style="width: 20%;" i18n="latest-blocks.size">Size</th>
 | 
				
			||||||
    </thead>
 | 
					    </thead>
 | 
				
			||||||
    <tbody *ngIf="blocks$ | async as blocks">
 | 
					    <tbody>
 | 
				
			||||||
      <tr *ngFor="let block of blocks">
 | 
					      <tr *ngFor="let block of blocks">
 | 
				
			||||||
        <td><a [routerLink]="['/block' | relativeUrl, block.id]">{{ block.height }}</a></td>
 | 
					        <td><a [routerLink]="['/block' | relativeUrl, block.id]">{{ block.height }}</a></td>
 | 
				
			||||||
        <td class="d-none d-md-block">‎{{ block.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }}</td>
 | 
					        <td class="d-none d-md-block">‎{{ block.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }}</td>
 | 
				
			||||||
        <td>
 | 
					        <td>
 | 
				
			||||||
          <app-time-since [time]="block.timestamp" [fastRender]="true"></app-time-since>
 | 
					          <app-time-since [time]="block.timestamp" [fastRender]="true"></app-time-since>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
        <td class="">
 | 
					        <td class="text-right" style="padding-right: 30px">
 | 
				
			||||||
          <app-amount [satoshis]="block['reward']" digitsInfo="1.2-2" [noFiat]="true"></app-amount>
 | 
					          <app-amount [satoshis]="block['reward']" digitsInfo="1.2-2" [noFiat]="true"></app-amount>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
        <td class="d-none d-lg-block">{{ block.tx_count | number }}</td>
 | 
					        <td class="d-none d-lg-block text-right" style="padding-right: 40px">{{ block.tx_count | number }}</td>
 | 
				
			||||||
        <td>
 | 
					        <td>
 | 
				
			||||||
          <div class="progress">
 | 
					          <div class="progress">
 | 
				
			||||||
            <div class="progress-bar progress-mempool" role="progressbar"
 | 
					            <div class="progress-bar progress-mempool" role="progressbar"
 | 
				
			||||||
@ -86,4 +86,53 @@
 | 
				
			|||||||
    </tbody>
 | 
					    </tbody>
 | 
				
			||||||
  </table>
 | 
					  </table>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<ng-template #loadingMain>
 | 
				
			||||||
 | 
					  <div>
 | 
				
			||||||
 | 
					    <h1 class="m-0 mb-2">
 | 
				
			||||||
 | 
					      <img width="50" src="./resources/mining-pools/default.svg" class="mr-3">
 | 
				
			||||||
 | 
					      <div class="skeleton-loader"></div>
 | 
				
			||||||
 | 
					    </h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <div class="box">
 | 
				
			||||||
 | 
					      <div class="row">
 | 
				
			||||||
 | 
					        <div class="col-lg-9">
 | 
				
			||||||
 | 
					          <table class="table table-borderless table-striped" style="table-layout: fixed;">
 | 
				
			||||||
 | 
					            <tbody>
 | 
				
			||||||
 | 
					              <tr>
 | 
				
			||||||
 | 
					                <td class="col-4 col-lg-3">Addresses</td>
 | 
				
			||||||
 | 
					                <td class="text-truncate">
 | 
				
			||||||
 | 
					                  <div class="scrollable">
 | 
				
			||||||
 | 
					                    <div class="skeleton-loader"></div>
 | 
				
			||||||
 | 
					                  </div>
 | 
				
			||||||
 | 
					                </td>
 | 
				
			||||||
 | 
					                <ng-template #noaddress>
 | 
				
			||||||
 | 
					                  <td>~</td>
 | 
				
			||||||
 | 
					                </ng-template>
 | 
				
			||||||
 | 
					              </tr>
 | 
				
			||||||
 | 
					              <tr>
 | 
				
			||||||
 | 
					                <td class="col-4 col-lg-3">Coinbase Tags</td>
 | 
				
			||||||
 | 
					                <td class="text-truncate"><div class="skeleton-loader"></div></td>
 | 
				
			||||||
 | 
					              </tr>
 | 
				
			||||||
 | 
					            </tbody>
 | 
				
			||||||
 | 
					          </table>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					        <div class="col-lg-3">
 | 
				
			||||||
 | 
					          <table class="table table-borderless table-striped">
 | 
				
			||||||
 | 
					            <tbody>
 | 
				
			||||||
 | 
					              <tr>
 | 
				
			||||||
 | 
					                <td class="col-4 col-lg-8">Mined Blocks</td>
 | 
				
			||||||
 | 
					                <td class="text-left"><div class="skeleton-loader"></div></td>
 | 
				
			||||||
 | 
					              </tr>
 | 
				
			||||||
 | 
					              <tr>
 | 
				
			||||||
 | 
					                <td class="col-4 col-lg-8">Empty Blocks</td>
 | 
				
			||||||
 | 
					                <td class="text-left"><div class="skeleton-loader"></div></td>
 | 
				
			||||||
 | 
					              </tr>
 | 
				
			||||||
 | 
					            </tbody>
 | 
				
			||||||
 | 
					          </table>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					</ng-template>
 | 
				
			||||||
@ -37,4 +37,15 @@ div.scrollable {
 | 
				
			|||||||
  padding: 0;
 | 
					  padding: 0;
 | 
				
			||||||
  overflow: auto;
 | 
					  overflow: auto;
 | 
				
			||||||
  max-height: 100px;
 | 
					  max-height: 100px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.skeleton-loader {
 | 
				
			||||||
 | 
					  width: 100%;
 | 
				
			||||||
 | 
					  max-width: 90px;
 | 
				
			||||||
 | 
					  margin: 15px auto 3px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.table {
 | 
				
			||||||
 | 
					  margin: 0px auto;
 | 
				
			||||||
 | 
					  max-width: 900px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -13,6 +13,14 @@ import { formatNumber } from '@angular/common';
 | 
				
			|||||||
  selector: 'app-pool',
 | 
					  selector: 'app-pool',
 | 
				
			||||||
  templateUrl: './pool.component.html',
 | 
					  templateUrl: './pool.component.html',
 | 
				
			||||||
  styleUrls: ['./pool.component.scss'],
 | 
					  styleUrls: ['./pool.component.scss'],
 | 
				
			||||||
 | 
					  styles: [`
 | 
				
			||||||
 | 
					    .loadingGraphs {
 | 
				
			||||||
 | 
					      position: absolute;
 | 
				
			||||||
 | 
					      top: 50%;
 | 
				
			||||||
 | 
					      left: calc(50% - 15px);
 | 
				
			||||||
 | 
					      z-index: 100;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  `],
 | 
				
			||||||
  changeDetection: ChangeDetectionStrategy.OnPush
 | 
					  changeDetection: ChangeDetectionStrategy.OnPush
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
export class PoolComponent implements OnInit {
 | 
					export class PoolComponent implements OnInit {
 | 
				
			||||||
@ -48,6 +56,7 @@ export class PoolComponent implements OnInit {
 | 
				
			|||||||
    this.poolStats$ = this.route.params.pipe(map((params) => params.poolId))
 | 
					    this.poolStats$ = this.route.params.pipe(map((params) => params.poolId))
 | 
				
			||||||
      .pipe(
 | 
					      .pipe(
 | 
				
			||||||
        switchMap((poolId: any) => {
 | 
					        switchMap((poolId: any) => {
 | 
				
			||||||
 | 
					          this.isLoading = true;
 | 
				
			||||||
          this.poolId = poolId;
 | 
					          this.poolId = poolId;
 | 
				
			||||||
          return this.apiService.getPoolHashrate$(this.poolId)
 | 
					          return this.apiService.getPoolHashrate$(this.poolId)
 | 
				
			||||||
            .pipe(
 | 
					            .pipe(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user