Show explorer links conditionally
This commit is contained in:
parent
82a072bd87
commit
208756bdd2
@ -46,10 +46,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 links">
|
<div class="col-lg-6 links">
|
||||||
<p class="category">More Networks</p>
|
<p class="category">More Networks</p>
|
||||||
<p><a [routerLink]="['/testnet' | relativeUrl]">Testnet Explorer</a></p>
|
<p *ngIf="currentNetwork !== '' && currentNetwork !== 'mainnet'"><a [routerLink]="['/' | relativeUrl]">Mainnet Explorer</a></p>
|
||||||
<p><a [routerLink]="['/signet' | relativeUrl]">Signet Explorer</a></p>
|
<p *ngIf="currentNetwork !== 'testnet'"><a [routerLink]="['/testnet' | relativeUrl]">Testnet Explorer</a></p>
|
||||||
<p><a href="https://liquid.network">Liquid Explorer</a></p>
|
<p *ngIf="currentNetwork !== 'signet'"><a [routerLink]="['/signet' | relativeUrl]">Signet Explorer</a></p>
|
||||||
<p><a href="https://bisq.network">Bisq Explorer</a></p>
|
<p *ngIf="currentNetwork !== 'liquid' && currentNetwork !== 'liquidtestnet'"><a href="https://liquid.network">Liquid Explorer</a></p>
|
||||||
|
<p *ngIf="currentNetwork !== 'bisq'"><a href="https://bisq.network">Bisq Explorer</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 links">
|
<div class="col-lg-6 links">
|
||||||
<p class="category">Legal</p>
|
<p class="category">Legal</p>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, merge, of, Subject } from 'rxjs';
|
||||||
|
import { tap, takeUntil } from 'rxjs/operators';
|
||||||
import { Env, StateService } from '../../../services/state.service';
|
import { Env, StateService } from '../../../services/state.service';
|
||||||
import { IBackendInfo } from '../../../interfaces/websocket.interface';
|
import { IBackendInfo } from '../../../interfaces/websocket.interface';
|
||||||
|
|
||||||
@ -10,12 +11,14 @@ import { IBackendInfo } from '../../../interfaces/websocket.interface';
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class GlobalFooterComponent implements OnInit {
|
export class GlobalFooterComponent implements OnInit {
|
||||||
|
private destroy$: Subject<any> = new Subject<any>();
|
||||||
env: Env;
|
env: Env;
|
||||||
networkPaths: { [network: string]: string };
|
|
||||||
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
|
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
|
||||||
backendInfo$: Observable<IBackendInfo>;
|
backendInfo$: Observable<IBackendInfo>;
|
||||||
frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH;
|
frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH;
|
||||||
packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
|
packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
|
||||||
|
network$: Observable<string>;
|
||||||
|
currentNetwork = "";
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public stateService: StateService,
|
public stateService: StateService,
|
||||||
@ -24,6 +27,14 @@ export class GlobalFooterComponent implements OnInit {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.env = this.stateService.env;
|
this.env = this.stateService.env;
|
||||||
this.backendInfo$ = this.stateService.backendInfo$;
|
this.backendInfo$ = this.stateService.backendInfo$;
|
||||||
|
this.network$ = merge(of(''), this.stateService.networkChanged$).pipe(
|
||||||
|
tap((network: string) => {
|
||||||
|
return network;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
this.network$.pipe(takeUntil(this.destroy$)).subscribe((network) => {
|
||||||
|
this.currentNetwork = network;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user