Adding taproot countdown

This commit is contained in:
softsimon
2021-11-12 20:24:15 +04:00
parent 2dc930fad2
commit 9eb159617f
9 changed files with 42 additions and 46 deletions

View File

@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { WebsocketService } from 'src/app/services/websocket.service';
import { StateService } from 'src/app/services/state.service';
import { specialBlocks } from 'src/app/app.constants';
import { takeLast } from 'rxjs/operators';
@Component({
selector: 'app-start',
@@ -9,26 +10,12 @@ import { specialBlocks } from 'src/app/app.constants';
styleUrls: ['./start.component.scss'],
})
export class StartComponent implements OnInit {
interval = 60;
colors = ['#5E35B1', '#ffffff'];
countdown = 0;
specialEvent = false;
eventName = '';
optionsLeft = {
particleCount: 2,
angle: 70,
spread: 50,
origin: { x: 0 },
colors: this.colors,
};
optionsRight = {
particleCount: 2,
angle: 110,
spread: 50,
origin: { x: 1 },
colors: this.colors,
};
constructor(
private websocketService: WebsocketService,
@@ -39,10 +26,23 @@ export class StartComponent implements OnInit {
this.websocketService.want(['blocks', 'stats', 'mempool-blocks']);
this.stateService.blocks$
.subscribe((blocks: any) => {
if (this.stateService.network !== '') {
return;
}
this.countdown = 0;
const block = blocks[0];
if(specialBlocks[block.height]) {
for (const sb in specialBlocks) {
const height = parseInt(sb, 10);
const diff = height - block.height;
if (diff > 0 && diff <= 1008) {
this.countdown = diff;
this.eventName = specialBlocks[sb].labelEvent;
}
}
if (specialBlocks[block.height]) {
this.specialEvent = true;
this.eventName = specialBlocks[block.height].labelEvent;
this.eventName = specialBlocks[block.height].labelEventCompleted;
setTimeout(() => {
this.specialEvent = false;
}, 60 * 60 * 1000);