Subdomain enterprise support

This commit is contained in:
softsimon
2022-07-21 19:58:12 +02:00
parent b52a8c58ab
commit b1b4bdf575
10 changed files with 110 additions and 55 deletions

View File

@@ -1,6 +1,9 @@
<ng-container *ngIf="{ val: network$ | async } as network">
<header>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<ng-template [ngIf]="subdomain">
<img [src]="'/api/v1/enterprise/images/' + subdomain + '/logo'" height="35" class="subdomain_logo" onload="this.style.display='block'">
</ng-template>
<a class="navbar-brand" [routerLink]="['/' | relativeUrl]" style="position: relative;">
<ng-container *ngIf="{ val: connectionState$ | async } as connectionState">
<img *ngIf="!officialMempoolSpace" src="/resources/mempool-logo.png" height="35" width="140" class="logo" [ngStyle]="{'opacity': connectionState.val === 2 ? 1 : 0.5 }" alt="The Mempool Open Source Project logo">

View File

@@ -145,3 +145,8 @@ nav {
.navbar-dark .navbar-nav .nav-link {
color: #f1f1f1;
}
.subdomain_logo {
margin-right: 15px;
display: none;
}

View File

@@ -1,7 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component, Inject, OnInit } from '@angular/core';
import { Env, StateService } from '../../services/state.service';
import { Observable, merge, of } from 'rxjs';
import { LanguageService } from 'src/app/services/language.service';
import { EnterpriseService } from 'src/app/services/enterprise.service';
@Component({
selector: 'app-master-page',
@@ -16,10 +17,12 @@ export class MasterPageComponent implements OnInit {
isMobile = window.innerWidth <= 767.98;
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
urlLanguage: string;
subdomain = '';
constructor(
public stateService: StateService,
private languageService: LanguageService,
private enterpriseService: EnterpriseService,
) { }
ngOnInit() {
@@ -27,6 +30,7 @@ export class MasterPageComponent implements OnInit {
this.connectionState$ = this.stateService.connectionState$;
this.network$ = merge(of(''), this.stateService.networkChanged$);
this.urlLanguage = this.languageService.getLanguageForUrl();
this.subdomain = this.enterpriseService.getSubdomain();
}
collapse(): void {