Fit mempool block skeleton loaders to screen
This commit is contained in:
		
							parent
							
								
									32cd8bb3cb
								
							
						
					
					
						commit
						6602bddb2b
					
				@ -97,7 +97,7 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
    this.mempoolEmptyBlocks.forEach((b) => {
 | 
					    this.mempoolEmptyBlocks.forEach((b) => {
 | 
				
			||||||
      this.mempoolEmptyBlockStyles.push(this.getStyleForMempoolEmptyBlock(b.index));
 | 
					      this.mempoolEmptyBlockStyles.push(this.getStyleForMempoolEmptyBlock(b.index));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.reduceMempoolBlocksToFitScreen(this.mempoolEmptyBlocks);
 | 
					    this.reduceEmptyBlocksToFitScreen(this.mempoolEmptyBlocks);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.mempoolBlocks.map(() => {
 | 
					    this.mempoolBlocks.map(() => {
 | 
				
			||||||
      this.updateMempoolBlockStyles();
 | 
					      this.updateMempoolBlockStyles();
 | 
				
			||||||
@ -225,12 +225,33 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
  @HostListener('window:resize', ['$event'])
 | 
					  @HostListener('window:resize', ['$event'])
 | 
				
			||||||
  onResize(): void {
 | 
					  onResize(): void {
 | 
				
			||||||
    this.animateEntry = false;
 | 
					    this.animateEntry = false;
 | 
				
			||||||
 | 
					    this.reduceEmptyBlocksToFitScreen(this.mempoolEmptyBlocks);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  trackByFn(index: number, block: MempoolBlock) {
 | 
					  trackByFn(index: number, block: MempoolBlock) {
 | 
				
			||||||
    return (block.isStack) ? `stack-${block.index}` : block.index;
 | 
					    return (block.isStack) ? `stack-${block.index}` : block.index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  reduceEmptyBlocksToFitScreen(blocks: MempoolBlock[]): MempoolBlock[] {
 | 
				
			||||||
 | 
					    const innerWidth = this.stateService.env.BASE_MODULE !== 'liquid' && window.innerWidth <= 767.98 ? window.innerWidth : window.innerWidth / 2;
 | 
				
			||||||
 | 
					    const blocksAmount = Math.min(this.stateService.env.MEMPOOL_BLOCKS_AMOUNT, Math.floor(innerWidth / (this.blockWidth + this.blockPadding)));
 | 
				
			||||||
 | 
					    while (blocks.length < blocksAmount) {
 | 
				
			||||||
 | 
					      blocks.push({
 | 
				
			||||||
 | 
					        blockSize: 0,
 | 
				
			||||||
 | 
					        blockVSize: 0,
 | 
				
			||||||
 | 
					        feeRange: [],
 | 
				
			||||||
 | 
					        index: blocks.length,
 | 
				
			||||||
 | 
					        medianFee: 0,
 | 
				
			||||||
 | 
					        nTx: 0,
 | 
				
			||||||
 | 
					        totalFees: 0
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    while (blocks.length > blocksAmount) {
 | 
				
			||||||
 | 
					      blocks.pop();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return blocks;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  reduceMempoolBlocksToFitScreen(blocks: MempoolBlock[]): MempoolBlock[] {
 | 
					  reduceMempoolBlocksToFitScreen(blocks: MempoolBlock[]): MempoolBlock[] {
 | 
				
			||||||
    const innerWidth = this.stateService.env.BASE_MODULE !== 'liquid' && window.innerWidth <= 767.98 ? window.innerWidth : window.innerWidth / 2;
 | 
					    const innerWidth = this.stateService.env.BASE_MODULE !== 'liquid' && window.innerWidth <= 767.98 ? window.innerWidth : window.innerWidth / 2;
 | 
				
			||||||
    const blocksAmount = Math.min(this.stateService.env.MEMPOOL_BLOCKS_AMOUNT, Math.floor(innerWidth / (this.blockWidth + this.blockPadding)));
 | 
					    const blocksAmount = Math.min(this.stateService.env.MEMPOOL_BLOCKS_AMOUNT, Math.floor(innerWidth / (this.blockWidth + this.blockPadding)));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user