[mining] use .slug to load pool logo

This commit is contained in:
nymkappa 2023-07-28 13:45:04 +09:00
parent 395f47516a
commit 3f3f0db2f2
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
6 changed files with 7 additions and 6 deletions

View File

@ -68,7 +68,7 @@ export class BlocksList implements OnInit {
for (const block of blocks) { for (const block of blocks) {
// @ts-ignore: Need to add an extra field for the template // @ts-ignore: Need to add an extra field for the template
block.extras.pool.logo = `/resources/mining-pools/` + block.extras.pool.logo = `/resources/mining-pools/` +
block.extras.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg'; block.extras.pool.slug + '.svg';
} }
} }
if (this.widget) { if (this.widget) {
@ -102,7 +102,7 @@ export class BlocksList implements OnInit {
if (this.stateService.env.MINING_DASHBOARD) { if (this.stateService.env.MINING_DASHBOARD) {
// @ts-ignore: Need to add an extra field for the template // @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.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.unshift(blocks[1][0]);
acc = acc.slice(0, this.widget ? 6 : 15); acc = acc.slice(0, this.widget ? 6 : 15);

View File

@ -89,7 +89,7 @@ export class PoolPreviewComponent implements OnInit {
this.openGraphService.waitOver('pool-stats-' + this.slug); 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) { if (logoSrc === this.lastImgSrc) {
this.openGraphService.waitOver('pool-img-' + this.slug); this.openGraphService.waitOver('pool-img-' + this.slug);
} }

View File

@ -79,7 +79,7 @@ export class PoolComponent implements OnInit {
poolStats.pool.regexes = regexes.slice(0, -3); poolStats.pool.regexes = regexes.slice(0, -3);
return Object.assign({ return Object.assign({
logo: `/resources/mining-pools/` + poolStats.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg' logo: `/resources/mining-pools/` + poolStats.pool.slug + '.svg'
}, poolStats); }, poolStats);
}) })
); );

View File

@ -159,7 +159,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
for (const block of blocks) { for (const block of blocks) {
// @ts-ignore: Need to add an extra field for the template // @ts-ignore: Need to add an extra field for the template
block.extras.pool.logo = `/resources/mining-pools/` + 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)); return of(blocks.slice(0, 6));

View File

@ -110,6 +110,7 @@ export interface PoolInfo {
regexes: string; // JSON array regexes: string; // JSON array
addresses: string; // JSON array addresses: string; // JSON array
emptyBlocks: number; emptyBlocks: number;
slug: string;
} }
export interface PoolStat { export interface PoolStat {
pool: PoolInfo; pool: PoolInfo;

View File

@ -96,7 +96,7 @@ export class MiningService {
share: parseFloat((poolStat.blockCount / stats.blockCount * 100).toFixed(2)), share: parseFloat((poolStat.blockCount / stats.blockCount * 100).toFixed(2)),
lastEstimatedHashrate: (poolStat.blockCount / stats.blockCount * stats.lastEstimatedHashrate / hashrateDivider).toFixed(2), lastEstimatedHashrate: (poolStat.blockCount / stats.blockCount * stats.lastEstimatedHashrate / hashrateDivider).toFixed(2),
emptyBlockRatio: (poolStat.emptyBlocks / poolStat.blockCount * 100).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 ...poolStat
}; };
}); });