From ef49457ec6af5ea2eaa560ebb18b058d1a17c42b Mon Sep 17 00:00:00 2001 From: nymkappa Date: Fri, 25 Mar 2022 17:48:24 +0900 Subject: [PATCH 1/7] Pool addresses collapse - Cleanup mobile layout --- .../app/components/pool/pool.component.html | 118 ++++++++++++++---- .../app/components/pool/pool.component.scss | 17 ++- .../src/app/components/pool/pool.component.ts | 2 + 3 files changed, 106 insertions(+), 31 deletions(-) diff --git a/frontend/src/app/components/pool/pool.component.html b/frontend/src/app/components/pool/pool.component.html index 240648e2c..3ee144f64 100644 --- a/frontend/src/app/components/pool/pool.component.html +++ b/frontend/src/app/components/pool/pool.component.html @@ -9,44 +9,104 @@
+
- - - + + + + + + + - - - + + - - - + + + + +
Tags -
+ + +
Tags + {{ poolStats.pool.regexes }} +
+ Tags +
{{ poolStats.pool.regexes }}
Addresses -
- +
Addresses + + {{ poolStats.pool.addresses[0] }} + + + ~
+ Addresses + +
+
- - + + + + - - + + + + + + + + + + + + +
Mined Blocks
Mined Blocks {{ formatNumber(poolStats.blockCount, this.locale, '1.0-0') }}
Empty Blocks
+ Mined Blocks +
{{ formatNumber(poolStats.blockCount, this.locale, '1.0-0') }}
+
Empty Blocks {{ formatNumber(poolStats.emptyBlocks, this.locale, '1.0-0') }}
+ Blocks +
{{ formatNumber(poolStats.emptyBlocks, this.locale, '1.0-0') }}
+
@@ -54,14 +114,20 @@
+ + ~ + + +
~
+
+
- +
@@ -147,7 +213,9 @@
-

+

+
+

@@ -157,13 +225,13 @@
- -
Height Timestamp
Tags +
Addresses +
@@ -176,17 +244,17 @@
- +
- - diff --git a/frontend/src/app/components/pool/pool.component.scss b/frontend/src/app/components/pool/pool.component.scss index 2a06de54a..cae0cc173 100644 --- a/frontend/src/app/components/pool/pool.component.scss +++ b/frontend/src/app/components/pool/pool.component.scss @@ -46,6 +46,9 @@ div.scrollable { .label { width: 35%; + @media (max-width: 767.98px) { + font-weight: bold; + } } .data { @@ -132,12 +135,6 @@ div.scrollable { text-align: left; } -.right-mobile { - @media (max-width: 450px) { - text-align: right; - } -} - .skeleton-loader { max-width: 200px; } @@ -151,3 +148,11 @@ div.scrollable { top: 600px; } } + +.small-button { + height: 20px; + transform: translateY(-20px); + font-size: 10px; + padding-top: 0; + padding-bottom: 0; +} \ No newline at end of file diff --git a/frontend/src/app/components/pool/pool.component.ts b/frontend/src/app/components/pool/pool.component.ts index dee4a9713..17b7fa029 100644 --- a/frontend/src/app/components/pool/pool.component.ts +++ b/frontend/src/app/components/pool/pool.component.ts @@ -19,6 +19,8 @@ export class PoolComponent implements OnInit { @Input() right: number | string = 45; @Input() left: number | string = 75; + gfg = true; + formatNumber = formatNumber; poolStats$: Observable; blocks$: Observable; From 3198feb46dede2a3058afbc8f8a3f406da0bb228 Mon Sep 17 00:00:00 2001 From: softsimon Date: Fri, 25 Mar 2022 21:52:00 +0400 Subject: [PATCH 2/7] Rearrange wallet providers on About page. --- frontend/src/app/components/about/about.component.html | 2 +- frontend/src/app/components/about/about.component.scss | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/about/about.component.html b/frontend/src/app/components/about/about.component.html index c03a3a00a..74203ab81 100644 --- a/frontend/src/app/components/about/about.component.html +++ b/frontend/src/app/components/about/about.component.html @@ -169,7 +169,7 @@ - -
Mined Blocks +
Empty Blocks +
Addresses + {{ poolStats.pool.addresses[0] }}
- Show {{ poolStats.pool.addresses.length }} + Show all ({{ poolStats.pool.addresses.length }}) {{ poolStats.pool.addresses[0] | shortenString: 40 }} @@ -223,41 +223,88 @@
- - + + + + - - - + + + + + + + + + + + + +
Tags
Tags
Addresses -
+ + +
+ Tags +
Addresses +
+
~
+ Addresses +
+
+
+
+
- - - + + - - - + + + + + + + + + + + +
Mined Blocks + + +
Mined Blocks
Empty Blocks + +
+ Mined Blocks +
+
+
+
Empty Blocks
+ Blocks +
+
+
+
diff --git a/frontend/src/app/components/pool/pool.component.scss b/frontend/src/app/components/pool/pool.component.scss index cae0cc173..211469c1b 100644 --- a/frontend/src/app/components/pool/pool.component.scss +++ b/frontend/src/app/components/pool/pool.component.scss @@ -45,16 +45,17 @@ div.scrollable { } .label { - width: 35%; + width: 30%; @media (max-width: 767.98px) { font-weight: bold; } } .data { - text-align: left; + text-align: right; padding-left: 25%; - @media (max-width: 991px) { + @media (max-width: 992px) { + text-align: left; padding-left: 12px; } @media (max-width: 450px) { From cc27b963d3de9bbd26adb8807ffcc688ee930f03 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 29 Mar 2022 12:50:57 +0900 Subject: [PATCH 4/7] Use slug instead of id in mining blocks list component --- .../src/app/components/blocks-list/blocks-list.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c9017a2f3..9c2f964e2 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.html +++ b/frontend/src/app/components/blocks-list/blocks-list.component.html @@ -25,7 +25,7 @@
- + {{ block.extras.pool.name }} From 8fba45003339a76e4b3356e03f0a7d3c0b897827 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 29 Mar 2022 13:34:25 +0900 Subject: [PATCH 5/7] Use mining pool slug in block component --- .../app/components/miner/miner.component.html | 2 +- .../app/components/miner/miner.component.ts | 23 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/components/miner/miner.component.html b/frontend/src/app/components/miner/miner.component.html index 4a54fb4d0..f4798d07d 100644 --- a/frontend/src/app/components/miner/miner.component.html +++ b/frontend/src/app/components/miner/miner.component.html @@ -4,7 +4,7 @@ - {{ miner }} + {{ miner }} Unknown diff --git a/frontend/src/app/components/miner/miner.component.ts b/frontend/src/app/components/miner/miner.component.ts index c022526fb..babda3dad 100644 --- a/frontend/src/app/components/miner/miner.component.ts +++ b/frontend/src/app/components/miner/miner.component.ts @@ -1,6 +1,8 @@ import { Component, Input, OnChanges, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; import { AssetsService } from 'src/app/services/assets.service'; import { Transaction } from 'src/app/interfaces/electrs.interface'; +import { StateService } from 'src/app/services/state.service'; +import { RelativeUrlPipe } from 'src/app/shared/pipes/relative-url/relative-url.pipe'; @Component({ selector: 'app-miner', @@ -13,11 +15,14 @@ export class MinerComponent implements OnChanges { miner = ''; title = ''; url = ''; + target = '_blank'; loading = true; constructor( private assetsService: AssetsService, private cd: ChangeDetectorRef, + public stateService: StateService, + private relativeUrlPipe: RelativeUrlPipe, ) { } ngOnChanges() { @@ -40,7 +45,13 @@ export class MinerComponent implements OnChanges { if (pools.payout_addresses[vout.scriptpubkey_address]) { this.miner = pools.payout_addresses[vout.scriptpubkey_address].name; this.title = $localize`:@@miner-identified-by-payout:Identified by payout address: '${vout.scriptpubkey_address}:PAYOUT_ADDRESS:'`; - this.url = pools.payout_addresses[vout.scriptpubkey_address].link; + const pool = pools.payout_addresses[vout.scriptpubkey_address]; + if (this.stateService.env.MINING_DASHBOARD && pools.slugs[pool.name] !== undefined) { + this.url = this.relativeUrlPipe.transform(`/mining/pool/${pools.slugs[pool.name]}`); + this.target = ''; + } else { + this.url = pool.link; + } break; } @@ -48,9 +59,15 @@ export class MinerComponent implements OnChanges { if (pools.coinbase_tags.hasOwnProperty(tag)) { const coinbaseAscii = this.hex2ascii(this.coinbaseTransaction.vin[0].scriptsig); if (coinbaseAscii.indexOf(tag) > -1) { - this.miner = pools.coinbase_tags[tag].name; + const pool = pools.coinbase_tags[tag]; + this.miner = pool.name; this.title = $localize`:@@miner-identified-by-coinbase:Identified by coinbase tag: '${tag}:TAG:'`; - this.url = pools.coinbase_tags[tag].link; + if (this.stateService.env.MINING_DASHBOARD && pools.slugs[pool.name] !== undefined) { + this.url = this.relativeUrlPipe.transform(`/mining/pool/${pools.slugs[pool.name]}`); + this.target = ''; + } else { + this.url = pool.link; + } break; } } From f51ea5b537439a81adef8e662f4651a75301e14f Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 29 Mar 2022 14:37:17 +0900 Subject: [PATCH 6/7] Fix query to insert unknown mining pool --- backend/src/api/pools-parser.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts index 7243eb023..9629916e3 100644 --- a/backend/src/api/pools-parser.ts +++ b/backend/src/api/pools-parser.ts @@ -108,7 +108,7 @@ class PoolsParser { if (slug === undefined) { // Only keep alphanumerical - slug = poolNames[i].replace(/[^a-z0-9]/gi,'').toLowerCase(); + slug = poolNames[i].replace(/[^a-z0-9]/gi, '').toLowerCase(); logger.debug(`No slug found for '${poolNames[i]}', generating it => '${slug}'`); } @@ -180,7 +180,7 @@ class PoolsParser { const [rows]: any[] = await connection.query({ sql: 'SELECT name from pools where name="Unknown"', timeout: 120000 }); if (rows.length === 0) { await connection.query({ - sql: `INSERT INTO pools(name, link, regexes, addresses) + sql: `INSERT INTO pools(name, link, regexes, addresses, slug) VALUES("Unknown", "https://learnmeabitcoin.com/technical/coinbase-transaction", "[]", "[]", "unknown"); `}); } else { @@ -189,7 +189,7 @@ class PoolsParser { regexes='[]', addresses='[]', slug='unknown' WHERE name='Unknown' - `) + `); } } catch (e) { logger.err('Unable to insert "Unknown" mining pool'); From 7ab950d03c4d6a83a3021616ce4c15ccbaa8964d Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 29 Mar 2022 16:31:26 +0900 Subject: [PATCH 7/7] Add slug when we insert a mining pool for the first time --- backend/src/api/pools-parser.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts index 9629916e3..005806c1d 100644 --- a/backend/src/api/pools-parser.ts +++ b/backend/src/api/pools-parser.ts @@ -135,10 +135,11 @@ class PoolsParser { logger.debug(`Update pools table now`); // Add new mining pools into the database - let queryAdd: string = 'INSERT INTO pools(name, link, regexes, addresses) VALUES '; + let queryAdd: string = 'INSERT INTO pools(name, link, regexes, addresses, slug) VALUES '; for (let i = 0; i < finalPoolDataAdd.length; ++i) { queryAdd += `('${finalPoolDataAdd[i].name}', '${finalPoolDataAdd[i].link}', - '${JSON.stringify(finalPoolDataAdd[i].regexes)}', '${JSON.stringify(finalPoolDataAdd[i].addresses)}'),`; + '${JSON.stringify(finalPoolDataAdd[i].regexes)}', '${JSON.stringify(finalPoolDataAdd[i].addresses)}', + ${JSON.stringify(finalPoolDataAdd[i].slug)}),`; } queryAdd = queryAdd.slice(0, -1) + ';';