Merge pull request #4053 from mempool/nymkappa/pool-logo
[mining] use .slug to load pool logo
This commit is contained in:
		
						commit
						8172ec9245
					
				@ -68,7 +68,7 @@ export class BlocksList implements OnInit {
 | 
			
		||||
                  for (const block of blocks) {
 | 
			
		||||
                    // @ts-ignore: Need to add an extra field for the template
 | 
			
		||||
                    block.extras.pool.logo = `/resources/mining-pools/` +
 | 
			
		||||
                      block.extras.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg';
 | 
			
		||||
                      block.extras.pool.slug + '.svg';
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
                if (this.widget) {
 | 
			
		||||
@ -102,7 +102,7 @@ export class BlocksList implements OnInit {
 | 
			
		||||
            if (this.stateService.env.MINING_DASHBOARD) {
 | 
			
		||||
              // @ts-ignore: Need to add an extra field for the template
 | 
			
		||||
              blocks[1][0].extras.pool.logo = `/resources/mining-pools/` +
 | 
			
		||||
                blocks[1][0].extras.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg';
 | 
			
		||||
                blocks[1][0].extras.pool.slug + '.svg';
 | 
			
		||||
            }
 | 
			
		||||
            acc.unshift(blocks[1][0]);
 | 
			
		||||
            acc = acc.slice(0, this.widget ? 6 : 15);
 | 
			
		||||
 | 
			
		||||
@ -89,7 +89,7 @@ export class PoolPreviewComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
          this.openGraphService.waitOver('pool-stats-' + this.slug);
 | 
			
		||||
 | 
			
		||||
          const logoSrc = `/resources/mining-pools/` + poolStats.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg';
 | 
			
		||||
          const logoSrc = `/resources/mining-pools/` + poolStats.pool.slug + '.svg';
 | 
			
		||||
          if (logoSrc === this.lastImgSrc) {
 | 
			
		||||
            this.openGraphService.waitOver('pool-img-' + this.slug);
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
@ -79,7 +79,7 @@ export class PoolComponent implements OnInit {
 | 
			
		||||
          poolStats.pool.regexes = regexes.slice(0, -3);
 | 
			
		||||
 | 
			
		||||
          return Object.assign({
 | 
			
		||||
            logo: `/resources/mining-pools/` + poolStats.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg'
 | 
			
		||||
            logo: `/resources/mining-pools/` + poolStats.pool.slug + '.svg'
 | 
			
		||||
          }, poolStats);
 | 
			
		||||
        })
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
@ -159,7 +159,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
 | 
			
		||||
            for (const block of blocks) {
 | 
			
		||||
              // @ts-ignore: Need to add an extra field for the template
 | 
			
		||||
              block.extras.pool.logo = `/resources/mining-pools/` +
 | 
			
		||||
                block.extras.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg';
 | 
			
		||||
                block.extras.pool.slug + '.svg';
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          return of(blocks.slice(0, 6));
 | 
			
		||||
 | 
			
		||||
@ -110,6 +110,7 @@ export interface PoolInfo {
 | 
			
		||||
  regexes: string; // JSON array
 | 
			
		||||
  addresses: string; // JSON array
 | 
			
		||||
  emptyBlocks: number;
 | 
			
		||||
  slug: string;
 | 
			
		||||
}
 | 
			
		||||
export interface PoolStat {
 | 
			
		||||
  pool: PoolInfo;
 | 
			
		||||
 | 
			
		||||
@ -96,7 +96,7 @@ export class MiningService {
 | 
			
		||||
        share: parseFloat((poolStat.blockCount / stats.blockCount * 100).toFixed(2)),
 | 
			
		||||
        lastEstimatedHashrate: (poolStat.blockCount / stats.blockCount * stats.lastEstimatedHashrate / hashrateDivider).toFixed(2),
 | 
			
		||||
        emptyBlockRatio: (poolStat.emptyBlocks / poolStat.blockCount * 100).toFixed(2),
 | 
			
		||||
        logo: `/resources/mining-pools/` + poolStat.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg',
 | 
			
		||||
        logo: `/resources/mining-pools/` + poolStat.slug + '.svg',
 | 
			
		||||
        ...poolStat
 | 
			
		||||
      };
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user