mempool/frontend/src/app/components/blockchain/blockchain.component.ts

33 lines
1.0 KiB
TypeScript
Raw Normal View History

import { Component, OnInit, ChangeDetectionStrategy, Input, ViewChild, ElementRef } from '@angular/core';
import { StateService } from 'src/app/services/state.service';
2019-07-21 17:59:47 +03:00
@Component({
selector: 'app-blockchain',
templateUrl: './blockchain.component.html',
styleUrls: ['./blockchain.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
2019-07-21 17:59:47 +03:00
})
export class BlockchainComponent implements OnInit {
@Input() miningInfo: boolean = false;
@ViewChild('container') container: ElementRef;
network: string;
2019-07-21 17:59:47 +03:00
constructor(
public stateService: StateService,
2019-07-21 17:59:47 +03:00
) {}
ngOnInit() {
this.network = this.stateService.network;
setTimeout(() => {
if (this.miningInfo) {
this.container.nativeElement.className += ' move-left';
this.stateService.blockShifted = true;
} else if (this.stateService.blockShifted) {
this.container.nativeElement.className = this.container.nativeElement.className.replace(' move-left', '');
this.stateService.blockShifted = false;
}
}, 250);
2019-07-21 17:59:47 +03:00
}
}