diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts index 5428f931d..7243eb023 100644 --- a/backend/src/api/pools-parser.ts +++ b/backend/src/api/pools-parser.ts @@ -12,6 +12,8 @@ interface Pool { } class PoolsParser { + slugWarnFlag = false; + /** * Parse the pools.json file, consolidate the data and dump it into the database */ @@ -93,7 +95,22 @@ class PoolsParser { } const finalPoolName = poolNames[i].replace(`'`, `''`); // To support single quote in names when doing db queries - const slug = poolsJson['slugs'][poolNames[i]]; + + let slug: string | undefined; + try { + slug = poolsJson['slugs'][poolNames[i]]; + } catch (e) { + if (this.slugWarnFlag === false) { + logger.warn(`pools.json does not seem to contain the 'slugs' object`); + this.slugWarnFlag = true; + } + } + + if (slug === undefined) { + // Only keep alphanumerical + slug = poolNames[i].replace(/[^a-z0-9]/gi,'').toLowerCase(); + logger.debug(`No slug found for '${poolNames[i]}', generating it => '${slug}'`); + } if (existingPools.find((pool) => pool.name === poolNames[i]) !== undefined) { finalPoolDataUpdate.push({ diff --git a/frontend/src/app/components/app/app.component.ts b/frontend/src/app/components/app/app.component.ts index 0cb6ef051..e060fae54 100644 --- a/frontend/src/app/components/app/app.component.ts +++ b/frontend/src/app/components/app/app.component.ts @@ -1,28 +1,33 @@ import { Location } from '@angular/common'; import { Component, HostListener, OnInit, Inject, LOCALE_ID, HostBinding } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; -import { WebsocketService } from '../../services/websocket.service'; import { StateService } from 'src/app/services/state.service'; +import { NgbTooltipConfig } from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], + providers: [NgbTooltipConfig] }) export class AppComponent implements OnInit { link: HTMLElement = document.getElementById('canonical'); constructor( public router: Router, - private websocketService: WebsocketService, private stateService: StateService, private location: Location, + tooltipConfig: NgbTooltipConfig, @Inject(LOCALE_ID) private locale: string, ) { if (this.locale.startsWith('ar') || this.locale.startsWith('fa') || this.locale.startsWith('he')) { this.dir = 'rtl'; this.class = 'rtl-layout'; } + + tooltipConfig.animation = false; + tooltipConfig.container = 'body'; + tooltipConfig.triggers = 'hover'; } @HostBinding('attr.dir') dir = 'ltr'; diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.html b/frontend/src/app/components/blocks-list/blocks-list.component.html index e7c93d3ab..c9017a2f3 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.html +++ b/frontend/src/app/components/blocks-list/blocks-list.component.html @@ -1,4 +1,4 @@ -
+

Blocks

@@ -25,7 +25,7 @@ diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.ts b/frontend/src/app/components/blocks-list/blocks-list.component.ts index c04403446..9da92f158 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.ts +++ b/frontend/src/app/components/blocks-list/blocks-list.component.ts @@ -22,6 +22,7 @@ export class BlocksList implements OnInit { paginationMaxSize: number; page = 1; lastPage = 1; + maxSize = window.innerWidth <= 767.98 ? 3 : 5; blocksCount: number; fromHeightSubject: BehaviorSubject = new BehaviorSubject(this.fromBlockHeight); skeletonLines: number[] = []; diff --git a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts index 521bee3d5..c210017fa 100644 --- a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts +++ b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts @@ -33,8 +33,6 @@ export class HashrateChartComponent implements OnInit { chartOptions: EChartsOption = {}; chartInitOptions = { renderer: 'svg', - width: 'auto', - height: 'auto', }; hashrateObservable$: Observable; diff --git a/frontend/src/app/components/hashrates-chart-pools/hashrate-chart-pools.component.ts b/frontend/src/app/components/hashrates-chart-pools/hashrate-chart-pools.component.ts index 280852d47..264ceb7ea 100644 --- a/frontend/src/app/components/hashrates-chart-pools/hashrate-chart-pools.component.ts +++ b/frontend/src/app/components/hashrates-chart-pools/hashrate-chart-pools.component.ts @@ -31,8 +31,6 @@ export class HashrateChartPoolsComponent implements OnInit { chartOptions: EChartsOption = {}; chartInitOptions = { renderer: 'svg', - width: 'auto', - height: 'auto', }; hashrateObservable$: Observable; diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts index 95156a487..4be0f340d 100644 --- a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts +++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts @@ -10,6 +10,7 @@ import { StorageService } from '../..//services/storage.service'; import { MiningService, MiningStats } from '../../services/mining.service'; import { StateService } from '../../services/state.service'; import { chartColors, poolsColor } from 'src/app/app.constants'; +import { RelativeUrlPipe } from 'src/app/shared/pipes/relative-url/relative-url.pipe'; @Component({ selector: 'app-pool-ranking', @@ -27,8 +28,6 @@ export class PoolRankingComponent implements OnInit { chartOptions: EChartsOption = {}; chartInitOptions = { renderer: 'svg', - width: 'auto', - height: 'auto', }; chartInstance: any = undefined; @@ -284,7 +283,8 @@ export class PoolRankingComponent implements OnInit { return; } this.zone.run(() => { - this.router.navigate(['/mining/pool/', e.data.data]); + const url = new RelativeUrlPipe(this.stateService).transform(`/mining/pool/${e.data.data}`); + this.router.navigate([url]); }); }); } diff --git a/frontend/src/app/components/pool/pool.component.ts b/frontend/src/app/components/pool/pool.component.ts index 82669ad26..023d3dcdb 100644 --- a/frontend/src/app/components/pool/pool.component.ts +++ b/frontend/src/app/components/pool/pool.component.ts @@ -27,8 +27,6 @@ export class PoolComponent implements OnInit { chartOptions: EChartsOption = {}; chartInitOptions = { renderer: 'svg', - width: 'auto', - height: 'auto', }; blocks: BlockExtended[] = []; diff --git a/frontend/src/app/components/reward-stats/reward-stats.component.html b/frontend/src/app/components/reward-stats/reward-stats.component.html index 861921ca6..26c791e1a 100644 --- a/frontend/src/app/components/reward-stats/reward-stats.component.html +++ b/frontend/src/app/components/reward-stats/reward-stats.component.html @@ -2,7 +2,7 @@
Miners Reward
-
@@ -14,10 +14,10 @@
Reward Per Tx
-
- {{ rewardStats.rewardPerTx | amountShortener }} + {{ rewardStats.rewardPerTx | amountShortener: 2 }} sats/tx
@@ -27,9 +27,9 @@
Average Fee
-
-
{{ rewardStats.feePerTx | amountShortener }} +
{{ rewardStats.feePerTx | amountShortener: 2 }} sats/tx
@@ -65,55 +65,3 @@
- - \ No newline at end of file diff --git a/frontend/src/app/shared/pipes/amount-shortener.pipe.ts b/frontend/src/app/shared/pipes/amount-shortener.pipe.ts index 529c6be79..319dc2a5a 100644 --- a/frontend/src/app/shared/pipes/amount-shortener.pipe.ts +++ b/frontend/src/app/shared/pipes/amount-shortener.pipe.ts @@ -5,11 +5,12 @@ import { Pipe, PipeTransform } from '@angular/core'; }) export class AmountShortenerPipe implements PipeTransform { transform(num: number, ...args: number[]): unknown { + const digits = args[0] || 1; + if (num < 1000) { - return num; + return num.toFixed(digits); } - const digits = args[0] || 1; const lookup = [ { value: 1, symbol: '' }, { value: 1e3, symbol: 'k' }, diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index 54476206c..3c38b5557 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -66,6 +66,11 @@ body { .container-xl { padding-bottom: 60px; } +.full-height { + @media (max-width: 767.98px) { + min-height: 100vh; + } +} :focus { outline: none !important; @@ -655,10 +660,6 @@ h1, h2, h3 { margin-top: 0.75rem !important; } -.tooltip-inner { - max-width: inherit; -} - .alert-mempool { color: #ffffff; background-color: #653b9c;