From 61c309cd1dfb70cf964fc75e05733618a727e2c6 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Fri, 24 Jun 2022 20:06:48 +0000 Subject: [PATCH 1/3] Fix block visualization color for <1 sat/vb txs --- frontend/src/app/components/block-overview-graph/tx-view.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/block-overview-graph/tx-view.ts b/frontend/src/app/components/block-overview-graph/tx-view.ts index 5093f480b..03718d79d 100644 --- a/frontend/src/app/components/block-overview-graph/tx-view.ts +++ b/frontend/src/app/components/block-overview-graph/tx-view.ts @@ -140,9 +140,8 @@ export default class TxView implements TransactionStripped { } getColor(): Color { - let feeLevelIndex = feeLevels.slice().reverse().findIndex((feeLvl) => (this.feerate || 1) >= feeLvl); - feeLevelIndex = feeLevelIndex >= 0 ? feeLevels.length - feeLevelIndex : feeLevelIndex; - return hexToColor(mempoolFeeColors[feeLevelIndex - 1] || mempoolFeeColors[mempoolFeeColors.length - 1]); + const feeLevelIndex = feeLevels.findIndex((feeLvl) => Math.max(1, this.feerate) < feeLvl) - 1; + return hexToColor(mempoolFeeColors[feeLevelIndex] || mempoolFeeColors[mempoolFeeColors.length - 1]); } } From a8de738e9bdd44b759e72dc4590c89fd36df1080 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Sat, 25 Jun 2022 19:06:26 +0200 Subject: [PATCH 2/3] Fixes the minium tx fee bug introduced in ecbd18087b267ba61b74477c973281b740edaf30 --- backend/src/api/common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/api/common.ts b/backend/src/api/common.ts index d1c8cecbb..1dc9f66ea 100644 --- a/backend/src/api/common.ts +++ b/backend/src/api/common.ts @@ -114,7 +114,7 @@ export class Common { totalFees += tx.bestDescendant.fee; } - tx.effectiveFeePerVsize = Math.max(Common.isLiquid() ? 0.1 : 1, totalFees / (totalWeight / 4)); + tx.effectiveFeePerVsize = Math.max(0, totalFees / (totalWeight / 4)); tx.cpfpChecked = true; return { From b97ea010cb2eaf5f7c553d67c7c42e68828be491 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Mon, 27 Jun 2022 00:15:11 +0200 Subject: [PATCH 3/3] Fix js crash when loading faq - fix crash when switching tabs with active fragment --- .../app/docs/api-docs/api-docs.component.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/docs/api-docs/api-docs.component.ts b/frontend/src/app/docs/api-docs/api-docs.component.ts index 323eb1ba6..260a701ea 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.ts +++ b/frontend/src/app/docs/api-docs/api-docs.component.ts @@ -34,13 +34,21 @@ export class ApiDocsComponent implements OnInit, AfterViewInit { private route: ActivatedRoute, ) { } + ngAfterContentChecked() { + if (this.faqTemplates) { + this.faqTemplates.forEach((x) => this.dict[x.type] = x.template); + } + this.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative"; + } + ngAfterViewInit() { const that = this; - this.faqTemplates.forEach((x) => this.dict[x.type] = x.template); setTimeout( () => { if( this.route.snapshot.fragment ) { this.openEndpointContainer( this.route.snapshot.fragment ); - document.getElementById( this.route.snapshot.fragment ).scrollIntoView(); + if (document.getElementById( this.route.snapshot.fragment )) { + document.getElementById( this.route.snapshot.fragment ).scrollIntoView(); + } } window.addEventListener('scroll', function() { that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative"; @@ -90,14 +98,17 @@ export class ApiDocsComponent implements OnInit, AfterViewInit { } targetId = element.hash.substring(1); } - if( this.route.snapshot.fragment === targetId ) { + if( this.route.snapshot.fragment === targetId && document.getElementById( targetId )) { document.getElementById( targetId ).scrollIntoView(); } this.openEndpointContainer( targetId ); } openEndpointContainer( targetId ) { - const tabHeaderHeight = document.getElementById( targetId + "-tab-header" ).scrollHeight; + let tabHeaderHeight = 0; + if (document.getElementById( targetId + "-tab-header" )) { + tabHeaderHeight = document.getElementById( targetId + "-tab-header" ).scrollHeight; + } if( ( window.innerWidth <= 992 ) && ( ( this.whichTab === 'rest' ) || ( this.whichTab === 'faq' ) ) && targetId ) { const endpointContainerEl = document.querySelector( "#" + targetId ); const endpointContentEl = document.querySelector( "#" + targetId + " .endpoint-content" );