Show explorer links conditionally
This commit is contained in:
		
							parent
							
								
									17883ca085
								
							
						
					
					
						commit
						e81e40889e
					
				@ -46,10 +46,11 @@
 | 
			
		||||
        <div class="row">
 | 
			
		||||
          <div class="col-lg-6 links">
 | 
			
		||||
            <p class="category">More Networks</p>
 | 
			
		||||
            <p><a [routerLink]="['/testnet' | relativeUrl]">Testnet Explorer</a></p>
 | 
			
		||||
            <p><a [routerLink]="['/signet' | relativeUrl]">Signet Explorer</a></p>
 | 
			
		||||
            <p><a href="https://liquid.network">Liquid Explorer</a></p>
 | 
			
		||||
            <p><a href="https://bisq.network">Bisq Explorer</a></p>
 | 
			
		||||
            <p *ngIf="currentNetwork !== '' && currentNetwork !== 'mainnet'"><a [routerLink]="['/' | relativeUrl]">Mainnet Explorer</a></p>
 | 
			
		||||
            <p *ngIf="currentNetwork !== 'testnet'"><a [routerLink]="['/testnet' | relativeUrl]">Testnet Explorer</a></p>
 | 
			
		||||
            <p *ngIf="currentNetwork !== 'signet'"><a [routerLink]="['/signet' | relativeUrl]">Signet 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 class="col-lg-6 links">
 | 
			
		||||
            <p class="category">Legal</p>
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,6 @@
 | 
			
		||||
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 { IBackendInfo } from '../../../interfaces/websocket.interface';
 | 
			
		||||
 | 
			
		||||
@ -10,12 +11,14 @@ import { IBackendInfo } from '../../../interfaces/websocket.interface';
 | 
			
		||||
  changeDetection: ChangeDetectionStrategy.OnPush,
 | 
			
		||||
})
 | 
			
		||||
export class GlobalFooterComponent implements OnInit {
 | 
			
		||||
  private destroy$: Subject<any> = new Subject<any>();
 | 
			
		||||
  env: Env;
 | 
			
		||||
  networkPaths: { [network: string]: string };
 | 
			
		||||
  officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
 | 
			
		||||
  backendInfo$: Observable<IBackendInfo>;
 | 
			
		||||
  frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH;
 | 
			
		||||
  packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
 | 
			
		||||
  network$: Observable<string>;
 | 
			
		||||
  currentNetwork = "";
 | 
			
		||||
 | 
			
		||||
  constructor(
 | 
			
		||||
    public stateService: StateService,
 | 
			
		||||
@ -24,6 +27,14 @@ export class GlobalFooterComponent implements OnInit {
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    this.env = this.stateService.env;
 | 
			
		||||
    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