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