2023-05-05 01:38:58 +04:00
|
|
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
2023-05-11 19:31:22 -04:00
|
|
|
import { Observable, merge, of, Subject } from 'rxjs';
|
|
|
|
import { tap, takeUntil } from 'rxjs/operators';
|
2023-05-05 01:38:58 +04:00
|
|
|
import { Env, StateService } from '../../../services/state.service';
|
2023-05-06 04:10:17 -04:00
|
|
|
import { IBackendInfo } from '../../../interfaces/websocket.interface';
|
2023-05-05 01:38:58 +04:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-global-footer',
|
|
|
|
templateUrl: './global-footer.component.html',
|
|
|
|
styleUrls: ['./global-footer.component.scss'],
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
|
|
})
|
|
|
|
export class GlobalFooterComponent implements OnInit {
|
2023-05-11 19:31:22 -04:00
|
|
|
private destroy$: Subject<any> = new Subject<any>();
|
2023-05-05 01:38:58 +04:00
|
|
|
env: Env;
|
|
|
|
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
|
2023-05-06 04:10:17 -04:00
|
|
|
backendInfo$: Observable<IBackendInfo>;
|
|
|
|
frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH;
|
|
|
|
packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
|
2023-05-11 19:31:22 -04:00
|
|
|
network$: Observable<string>;
|
|
|
|
currentNetwork = "";
|
2023-05-05 01:38:58 +04:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
public stateService: StateService,
|
|
|
|
) {}
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.env = this.stateService.env;
|
2023-05-06 04:10:17 -04:00
|
|
|
this.backendInfo$ = this.stateService.backendInfo$;
|
2023-05-11 19:31:22 -04:00
|
|
|
this.network$ = merge(of(''), this.stateService.networkChanged$).pipe(
|
|
|
|
tap((network: string) => {
|
|
|
|
return network;
|
|
|
|
})
|
|
|
|
);
|
|
|
|
this.network$.pipe(takeUntil(this.destroy$)).subscribe((network) => {
|
|
|
|
this.currentNetwork = network;
|
|
|
|
});
|
2023-05-05 01:38:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|