From bc882b02108048b12ef311eec15518386ee86d41 Mon Sep 17 00:00:00 2001 From: everoddandeven Date: Sat, 28 Dec 2024 21:42:24 +0100 Subject: [PATCH] Fix window tab scroll --- src/app/pages/about/about.component.html | 2 +- src/app/pages/bans/bans.component.html | 2 +- .../pages/base-page/base-page.component.ts | 58 ++++++++++++++++++- .../blockchain/blockchain.component.html | 2 +- src/app/pages/detail/detail.component.html | 2 +- src/app/pages/logs/logs.component.html | 2 +- src/app/pages/mining/mining.component.html | 2 +- src/app/pages/network/network.component.html | 2 +- src/app/pages/outputs/outputs.component.html | 2 +- src/app/pages/peers/peers.component.html | 2 +- .../pages/settings/settings.component.html | 2 +- .../transactions/transactions.component.html | 2 +- src/app/pages/version/version.component.html | 2 +- .../components/navbar/navbar.service.ts | 6 +- src/styles.scss | 5 ++ 15 files changed, 79 insertions(+), 14 deletions(-) diff --git a/src/app/pages/about/about.component.html b/src/app/pages/about/about.component.html index 2fa4c6b..fe2183e 100644 --- a/src/app/pages/about/about.component.html +++ b/src/app/pages/about/about.component.html @@ -11,7 +11,7 @@ -
+
diff --git a/src/app/pages/bans/bans.component.html b/src/app/pages/bans/bans.component.html index b3b422a..7f51755 100644 --- a/src/app/pages/bans/bans.component.html +++ b/src/app/pages/bans/bans.component.html @@ -11,7 +11,7 @@
-
+

List of banned IPs

void = (event: Event) => setTimeout(() => this.updateTableContentHeight(), 100); + + constructor(private navbarService: NavbarService) { + this.subscriptions.push(this.navbarService.onDaemonStatusChanged.subscribe((running) => { + if (running) setTimeout(() => this.updateTableContentHeight(), 100); + })); + + window.addEventListener('resize', this.mResizeHandler); + } protected setLinks(links: NavbarLink[] = []): void { this._links = links; @@ -169,6 +177,8 @@ export abstract class BasePageComponent implements AfterContentInit, OnDestroy { public ngAfterContentInit(): void { this.navbarService.setLinks(this._links); + + setTimeout(() => this.updateTableContentHeight(), 100); } public ngOnDestroy(): void { @@ -176,7 +186,53 @@ export abstract class BasePageComponent implements AfterContentInit, OnDestroy { this.subscriptions.forEach((sub: Subscription) => sub.unsubscribe()); this.subscriptions = []; + + window.removeEventListener('resize', this.mResizeHandler); this.destroyTables(); } + + public updateTableContentHeight(): void { + if (!visualViewport) { + return; + } + + const viewHeight = visualViewport?.height; + + if (!viewHeight) { + return; + } + + console.log(`view height: ${viewHeight}`); + + const elements = document.getElementsByClassName('tab-content tab-grow'); + + if (!elements || elements.length === 0) { + return; + } + + const offset = 35; + const tab = elements[0] as HTMLElement; + const rect = tab.getBoundingClientRect(); + const left = viewHeight - rect.bottom; + const currentHeight = tab.clientHeight; + let newHeight: number; + + if (left > 0) { + if (left < offset) { + newHeight = parseInt(`${currentHeight}`); + } + else { + const offsetLeft = left - offset; + newHeight = parseInt(`${ currentHeight + offsetLeft }`); + } + } + else { + newHeight = currentHeight + left - offset; + } + + tab.style.height = `${newHeight}px`; + + console.log(`old height: ${currentHeight}, left: ${left} new height: ${newHeight}`); + } } diff --git a/src/app/pages/blockchain/blockchain.component.html b/src/app/pages/blockchain/blockchain.component.html index 6f27d1a..766d576 100644 --- a/src/app/pages/blockchain/blockchain.component.html +++ b/src/app/pages/blockchain/blockchain.component.html @@ -11,7 +11,7 @@ -
+

Overview of current block set queue

diff --git a/src/app/pages/detail/detail.component.html b/src/app/pages/detail/detail.component.html index a7076f0..c210c01 100644 --- a/src/app/pages/detail/detail.component.html +++ b/src/app/pages/detail/detail.component.html @@ -33,7 +33,7 @@
-
+
diff --git a/src/app/pages/logs/logs.component.html b/src/app/pages/logs/logs.component.html index 163567d..0e26af0 100644 --- a/src/app/pages/logs/logs.component.html +++ b/src/app/pages/logs/logs.component.html @@ -10,7 +10,7 @@
-
+
diff --git a/src/app/pages/mining/mining.component.html b/src/app/pages/mining/mining.component.html index cc01e6b..4269fa3 100644 --- a/src/app/pages/mining/mining.component.html +++ b/src/app/pages/mining/mining.component.html @@ -11,7 +11,7 @@
-
+
-
+

Download ({{ currentNetStats.totalGigaBytesIn.toFixed(2) }} GB)

diff --git a/src/app/pages/outputs/outputs.component.html b/src/app/pages/outputs/outputs.component.html index 6905ba8..55143f1 100644 --- a/src/app/pages/outputs/outputs.component.html +++ b/src/app/pages/outputs/outputs.component.html @@ -10,7 +10,7 @@
-
+

Get outputs

diff --git a/src/app/pages/peers/peers.component.html b/src/app/pages/peers/peers.component.html index fdadc56..c67a5c8 100644 --- a/src/app/pages/peers/peers.component.html +++ b/src/app/pages/peers/peers.component.html @@ -11,7 +11,7 @@
-
+

List of known peers

diff --git a/src/app/pages/settings/settings.component.html b/src/app/pages/settings/settings.component.html index f8750e3..45c40ad 100644 --- a/src/app/pages/settings/settings.component.html +++ b/src/app/pages/settings/settings.component.html @@ -13,7 +13,7 @@
-
+
-
+

Information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory

diff --git a/src/app/pages/version/version.component.html b/src/app/pages/version/version.component.html index d501af0..fcc9d22 100644 --- a/src/app/pages/version/version.component.html +++ b/src/app/pages/version/version.component.html @@ -11,7 +11,7 @@
-
+