2020-11-08 07:31:52 +01:00
|
|
|
import {Component, HostListener, OnInit} from '@angular/core';
|
2020-11-25 09:05:13 +01:00
|
|
|
import {BlockSyncService, TransactionService} from './_services';
|
2020-10-30 16:16:05 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: './app.component.html',
|
|
|
|
styleUrls: ['./app.component.scss']
|
|
|
|
})
|
2020-11-08 07:31:52 +01:00
|
|
|
export class AppComponent implements OnInit {
|
2020-10-30 16:16:05 +01:00
|
|
|
title = 'cic-staff-client';
|
2020-11-08 07:31:52 +01:00
|
|
|
readyStateTarget: number = 3;
|
|
|
|
readyState: number = 0;
|
2020-11-25 09:05:13 +01:00
|
|
|
mediaQuery = window.matchMedia('(max-width: 768px)');
|
2020-11-08 07:31:52 +01:00
|
|
|
|
2020-11-25 09:05:13 +01:00
|
|
|
constructor(
|
|
|
|
private transactionService: TransactionService,
|
|
|
|
private blockSyncService: BlockSyncService
|
|
|
|
) {
|
|
|
|
this.blockSyncService.blockSync();
|
|
|
|
}
|
2020-11-08 07:31:52 +01:00
|
|
|
|
|
|
|
ngOnInit(): void {
|
2020-11-25 09:05:13 +01:00
|
|
|
this.mediaQuery.addListener(this.onResize);
|
|
|
|
this.onResize(this.mediaQuery);
|
2020-11-08 07:31:52 +01:00
|
|
|
}
|
|
|
|
|
2020-11-25 09:05:13 +01:00
|
|
|
// Load resize
|
|
|
|
onResize(e): void {
|
|
|
|
const sidebar = document.getElementById('sidebar');
|
|
|
|
const content = document.getElementById('content');
|
|
|
|
const sidebarCollapse = document.getElementById('sidebarCollapse');
|
|
|
|
sidebarCollapse.classList.remove('active');
|
|
|
|
if (e.matches) {
|
|
|
|
sidebar.classList.add('active');
|
|
|
|
content.classList.add('active');
|
|
|
|
} else {
|
|
|
|
sidebar.classList.remove('active');
|
|
|
|
content.classList.remove('active');
|
2020-11-08 07:31:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@HostListener('window:cic_transfer', ['$event'])
|
|
|
|
cicTransfer(event: CustomEvent): void {
|
|
|
|
const transaction = event.detail.tx;
|
2020-11-25 09:05:13 +01:00
|
|
|
this.transactionService.setTransaction(transaction, 100);
|
2020-11-08 07:31:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@HostListener('window:cic_convert', ['$event'])
|
|
|
|
cicConvert(event: CustomEvent): void {
|
|
|
|
const conversion = event.detail.tx;
|
2020-12-05 07:30:30 +01:00
|
|
|
this.transactionService.setConversion(conversion, 100);
|
2020-11-08 07:31:52 +01:00
|
|
|
}
|
2020-10-30 16:16:05 +01:00
|
|
|
}
|