Merge pull request #2517 from mempool/nymkappa/bugfix/missing-loaders
Add skeleton loader in node per isp/country lists
This commit is contained in:
		
						commit
						b5f6fdecbf
					
				| @ -6,6 +6,7 @@ | ||||
| 
 | ||||
|   <div style="min-height: 295px"> | ||||
|     <table class="table table-borderless"> | ||||
|        | ||||
|       <thead> | ||||
|         <th class="alias text-left" i18n="lightning.alias">Alias</th> | ||||
|         <th class="timestamp-first text-left" i18n="lightning.first_seen">First seen</th> | ||||
| @ -14,7 +15,8 @@ | ||||
|         <th class="channels text-right" i18n="lightning.channels">Channels</th> | ||||
|         <th class="city text-right" i18n="lightning.location">Location</th> | ||||
|       </thead> | ||||
|       <tbody *ngIf="nodes$ | async as nodes"> | ||||
|        | ||||
|       <tbody *ngIf="nodes$ | async as nodes; else skeleton"> | ||||
|         <tr *ngFor="let node of nodes; let i= index; trackBy: trackByPublicKey"> | ||||
|           <td class="alias text-left text-truncate"> | ||||
|             <a [routerLink]="['/lightning/node/' | relativeUrl, node.public_key]">{{ node.alias }}</a> | ||||
| @ -39,6 +41,32 @@ | ||||
|             <app-geolocation [data]="node.geolocation" [type]="'list-country'"></app-geolocation> | ||||
|           </td> | ||||
|       </tbody> | ||||
| 
 | ||||
|       <ng-template #skeleton> | ||||
|         <tbody> | ||||
|           <tr *ngFor="let item of skeletonLines"> | ||||
|             <td class="alias text-left text-truncate"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="timestamp-first text-left"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="timestamp-update text-left"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="capacity text-right"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="channels text-right"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="city text-right text-truncate"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|           </tr> | ||||
|         </tbody> | ||||
|       </ng-template> | ||||
| 
 | ||||
|     </table> | ||||
|   </div> | ||||
| 
 | ||||
|  | ||||
| @ -16,11 +16,17 @@ export class NodesPerCountry implements OnInit { | ||||
|   nodes$: Observable<any>; | ||||
|   country: {name: string, flag: string}; | ||||
| 
 | ||||
|   skeletonLines: number[] = []; | ||||
| 
 | ||||
|   constructor( | ||||
|     private apiService: ApiService, | ||||
|     private seoService: SeoService, | ||||
|     private route: ActivatedRoute, | ||||
|   ) { } | ||||
|   ) { | ||||
|     for (let i = 0; i < 20; ++i) { | ||||
|       this.skeletonLines.push(i); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   ngOnInit(): void { | ||||
|     this.nodes$ = this.apiService.getNodeForCountry$(this.route.snapshot.params.country) | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| 
 | ||||
|   <div style="min-height: 295px"> | ||||
|     <table class="table table-borderless"> | ||||
| 
 | ||||
|       <thead> | ||||
|         <th class="alias text-left" i18n="lightning.alias">Alias</th> | ||||
|         <th class="timestamp-first text-left" i18n="lightning.first_seen">First seen</th> | ||||
| @ -11,7 +12,8 @@ | ||||
|         <th class="channels text-right" i18n="lightning.channels">Channels</th> | ||||
|         <th class="city text-right" i18n="lightning.location">Location</th> | ||||
|       </thead> | ||||
|       <tbody *ngIf="nodes$ | async as nodes"> | ||||
| 
 | ||||
|       <tbody *ngIf="nodes$ | async as nodes; else skeleton"> | ||||
|         <tr *ngFor="let node of nodes; let i= index; trackBy: trackByPublicKey"> | ||||
|           <td class="alias text-left text-truncate"> | ||||
|             <a [routerLink]="['/lightning/node/' | relativeUrl, node.public_key]">{{ node.alias }}</a> | ||||
| @ -36,6 +38,32 @@ | ||||
|             <app-geolocation [data]="node.geolocation" [type]="'list-isp'"></app-geolocation> | ||||
|           </td> | ||||
|       </tbody> | ||||
|      | ||||
|       <ng-template #skeleton> | ||||
|         <tbody> | ||||
|           <tr *ngFor="let item of skeletonLines"> | ||||
|             <td class="alias text-left text-truncate"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="timestamp-first text-left"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="timestamp-update text-left"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="capacity text-right"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="channels text-right"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|             <td class="city text-right text-truncate"> | ||||
|               <span class="skeleton-loader"></span> | ||||
|             </td> | ||||
|           </tr> | ||||
|         </tbody> | ||||
|       </ng-template> | ||||
|    | ||||
|     </table> | ||||
|   </div> | ||||
| 
 | ||||
|  | ||||
| @ -15,11 +15,17 @@ export class NodesPerISP implements OnInit { | ||||
|   nodes$: Observable<any>; | ||||
|   isp: {name: string, id: number}; | ||||
| 
 | ||||
|   skeletonLines: number[] = []; | ||||
| 
 | ||||
|   constructor( | ||||
|     private apiService: ApiService, | ||||
|     private seoService: SeoService, | ||||
|     private route: ActivatedRoute, | ||||
|   ) { } | ||||
|   ) { | ||||
|     for (let i = 0; i < 20; ++i) { | ||||
|       this.skeletonLines.push(i); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   ngOnInit(): void { | ||||
|     this.nodes$ = this.apiService.getNodeForISP$(this.route.snapshot.params.isp) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user