From fc7a5c2e2863016952b6e0fc8fcc7ffff6fa52cf Mon Sep 17 00:00:00 2001 From: softsimon Date: Fri, 10 Apr 2020 01:05:21 +0700 Subject: [PATCH] Adding countdown timer refs #50 --- .../latest-blocks/latest-blocks.component.html | 5 +++++ .../components/latest-blocks/latest-blocks.component.ts | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/frontend/src/app/components/latest-blocks/latest-blocks.component.html b/frontend/src/app/components/latest-blocks/latest-blocks.component.html index 918e018eb..2c7175224 100644 --- a/frontend/src/app/components/latest-blocks/latest-blocks.component.html +++ b/frontend/src/app/components/latest-blocks/latest-blocks.component.html @@ -1,3 +1,8 @@ + +
+

Quantitative Hardening in {{ 630000 - latestBlockHeight }} blocks (~)

+
+

diff --git a/frontend/src/app/components/latest-blocks/latest-blocks.component.ts b/frontend/src/app/components/latest-blocks/latest-blocks.component.ts index afe3c99e9..6cb223b91 100644 --- a/frontend/src/app/components/latest-blocks/latest-blocks.component.ts +++ b/frontend/src/app/components/latest-blocks/latest-blocks.component.ts @@ -4,6 +4,7 @@ import { StateService } from '../../services/state.service'; import { Block } from '../../interfaces/electrs.interface'; import { Subscription } from 'rxjs'; import { SeoService } from 'src/app/services/seo.service'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'app-latest-blocks', @@ -11,11 +12,15 @@ import { SeoService } from 'src/app/services/seo.service'; styleUrls: ['./latest-blocks.component.scss'], }) export class LatestBlocksComponent implements OnInit, OnDestroy { + network = environment.network; + blocks: any[] = []; blockSubscription: Subscription; isLoading = true; interval: any; + latestBlockHeight: number; + heightOfPageUntilBlocks = 430; heightOfBlocksTableChunk = 470; @@ -34,6 +39,8 @@ export class LatestBlocksComponent implements OnInit, OnDestroy { return; } + this.latestBlockHeight = block.height; + if (block.height === this.blocks[0].height) { return; } @@ -66,6 +73,8 @@ export class LatestBlocksComponent implements OnInit, OnDestroy { this.blocks = blocks; this.isLoading = false; + this.latestBlockHeight = blocks[0].height; + const spaceForBlocks = window.innerHeight - this.heightOfPageUntilBlocks; const chunks = Math.ceil(spaceForBlocks / this.heightOfBlocksTableChunk) - 1; if (chunks > 0) {