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

50 lines
1.7 KiB
TypeScript
Raw Normal View History

2021-05-18 11:23:39 +02:00
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { WebsocketService } from '../../services/websocket.service';
2020-03-23 18:52:08 +01:00
import { SeoService } from 'src/app/services/seo.service';
import { StateService } from 'src/app/services/state.service';
2021-05-18 11:23:39 +02:00
import { Observable } from 'rxjs';
import { ApiService } from 'src/app/services/api.service';
import { IBackendInfo } from 'src/app/interfaces/websocket.interface';
2021-05-18 11:23:39 +02:00
import { Router } from '@angular/router';
2019-07-21 16:59:47 +02:00
@Component({
selector: 'app-about',
templateUrl: './about.component.html',
styleUrls: ['./about.component.scss'],
2021-05-18 11:23:39 +02:00
changeDetection: ChangeDetectionStrategy.OnPush,
2019-07-21 16:59:47 +02:00
})
2021-05-18 11:23:39 +02:00
export class AboutComponent implements OnInit {
backendInfo$: Observable<IBackendInfo>;
sponsors$: Observable<any>;
contributors$: Observable<any>;
frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH.substr(0, 8);
packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
2021-05-18 11:23:39 +02:00
showNavigateToSponsor = false;
2019-07-21 16:59:47 +02:00
constructor(
private websocketService: WebsocketService,
2020-03-23 18:52:08 +01:00
private seoService: SeoService,
private stateService: StateService,
private apiService: ApiService,
2021-05-18 11:23:39 +02:00
private router: Router,
) { }
2019-07-21 16:59:47 +02:00
ngOnInit() {
this.backendInfo$ = this.stateService.backendInfo$;
2020-12-03 12:34:19 +01:00
this.seoService.setTitle($localize`:@@004b222ff9ef9dd4771b777950ca1d0e4cd4348a:About`);
2020-02-17 14:39:20 +01:00
this.websocketService.want(['blocks']);
2021-05-18 11:23:39 +02:00
this.sponsors$ = this.apiService.getDonation$();
this.contributors$ = this.apiService.getContributor$();
}
2021-05-18 11:23:39 +02:00
sponsor() {
if (this.officialMempoolSpace) {
this.router.navigateByUrl('/sponsor');
} else {
this.showNavigateToSponsor = true;
}
}
2019-07-21 16:59:47 +02:00
}