mirror of
https://github.com/mempool/mempool.git
synced 2025-01-19 13:43:45 +01:00
Vary network urls according to base module
This commit is contained in:
parent
208756bdd2
commit
4fe6a74d20
@ -46,11 +46,11 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6 links">
|
||||
<p class="category">More Networks</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>
|
||||
<p *ngIf="currentNetwork !== '' && currentNetwork !== 'mainnet'"><a [href]="networkLink('mainnet')">Mainnet Explorer</a></p>
|
||||
<p *ngIf="currentNetwork !== 'testnet'"><a [href]="networkLink('testnet')">Testnet Explorer</a></p>
|
||||
<p *ngIf="currentNetwork !== 'signet'"><a [href]="networkLink('signet')">Signet Explorer</a></p>
|
||||
<p *ngIf="currentNetwork !== 'liquid' && currentNetwork !== 'liquidtestnet'"><a [href]="networkLink('liquid')">Liquid Explorer</a></p>
|
||||
<p *ngIf="currentNetwork !== 'bisq'"><a [href]="networkLink('bisq')">Bisq Explorer</a></p>
|
||||
</div>
|
||||
<div class="col-lg-6 links">
|
||||
<p class="category">Legal</p>
|
||||
|
@ -3,6 +3,8 @@ 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';
|
||||
import { LanguageService } from '../../../services/language.service';
|
||||
import { NavigationService } from '../../../services/navigation.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-global-footer',
|
||||
@ -17,16 +19,24 @@ export class GlobalFooterComponent implements OnInit {
|
||||
backendInfo$: Observable<IBackendInfo>;
|
||||
frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH;
|
||||
packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
|
||||
urlLanguage: string;
|
||||
network$: Observable<string>;
|
||||
networkPaths: { [network: string]: string };
|
||||
currentNetwork = "";
|
||||
|
||||
constructor(
|
||||
public stateService: StateService,
|
||||
private languageService: LanguageService,
|
||||
private navigationService: NavigationService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.env = this.stateService.env;
|
||||
this.backendInfo$ = this.stateService.backendInfo$;
|
||||
this.urlLanguage = this.languageService.getLanguageForUrl();
|
||||
this.navigationService.subnetPaths.subscribe((paths) => {
|
||||
this.networkPaths = paths;
|
||||
});
|
||||
this.network$ = merge(of(''), this.stateService.networkChanged$).pipe(
|
||||
tap((network: string) => {
|
||||
return network;
|
||||
@ -35,6 +45,20 @@ export class GlobalFooterComponent implements OnInit {
|
||||
this.network$.pipe(takeUntil(this.destroy$)).subscribe((network) => {
|
||||
this.currentNetwork = network;
|
||||
});
|
||||
console.log(this.networkPaths);
|
||||
}
|
||||
|
||||
networkLink( network ) {
|
||||
let thisNetwork = network || "mainnet";
|
||||
if( network === "" || network === "mainnet" || network === "testnet" || network === "signet" ) {
|
||||
return ( this.env.BASE_MODULE === 'mempool' ? "" : this.env.MEMPOOL_WEBSITE_URL + this.urlLanguage ) + this.networkPaths[thisNetwork] || '/';
|
||||
}
|
||||
if( network === "liquid" || network === "liquidtestnet" ) {
|
||||
return ( this.env.BASE_MODULE === 'liquid' ? "" : this.env.LIQUID_WEBSITE_URL + this.urlLanguage ) + this.networkPaths[thisNetwork] || '/';
|
||||
}
|
||||
if( network === "bisq" ) {
|
||||
return ( this.env.BASE_MODULE === 'bisq' ? "" : this.env.BISQ_WEBSITE_URL + this.urlLanguage ) + this.networkPaths[thisNetwork] || '/';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user