2023-04-03 16:25:10 +09:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2020-11-23 02:30:46 +07:00
|
|
|
import { Env, StateService } from '../../services/state.service';
|
2020-08-02 16:00:08 +07:00
|
|
|
import { Observable, merge, of } from 'rxjs';
|
2022-09-21 17:23:45 +02:00
|
|
|
import { LanguageService } from '../../services/language.service';
|
|
|
|
import { EnterpriseService } from '../../services/enterprise.service';
|
2022-10-12 22:13:29 +00:00
|
|
|
import { NavigationService } from '../../services/navigation.service';
|
2020-02-16 22:15:07 +07:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-master-page',
|
|
|
|
templateUrl: './master-page.component.html',
|
2020-08-02 16:00:08 +07:00
|
|
|
styleUrls: ['./master-page.component.scss'],
|
2020-02-16 22:15:07 +07:00
|
|
|
})
|
|
|
|
export class MasterPageComponent implements OnInit {
|
2020-11-23 02:30:46 +07:00
|
|
|
env: Env;
|
2020-08-02 16:00:08 +07:00
|
|
|
network$: Observable<string>;
|
|
|
|
connectionState$: Observable<number>;
|
2020-02-16 22:15:07 +07:00
|
|
|
navCollapsed = false;
|
2020-10-09 13:56:43 +07:00
|
|
|
isMobile = window.innerWidth <= 767.98;
|
2021-02-18 13:34:05 +07:00
|
|
|
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
|
2022-01-10 15:50:21 +04:00
|
|
|
urlLanguage: string;
|
2022-07-21 19:58:12 +02:00
|
|
|
subdomain = '';
|
2022-10-12 22:13:29 +00:00
|
|
|
networkPaths: { [network: string]: string };
|
2023-05-11 11:38:57 -05:00
|
|
|
networkPaths$: Observable<Record<string, string>>;
|
|
|
|
footerVisible = true;
|
2020-02-16 22:15:07 +07:00
|
|
|
|
|
|
|
constructor(
|
2022-02-15 16:02:30 +09:00
|
|
|
public stateService: StateService,
|
2022-01-10 15:50:21 +04:00
|
|
|
private languageService: LanguageService,
|
2022-07-21 19:58:12 +02:00
|
|
|
private enterpriseService: EnterpriseService,
|
2022-10-12 22:13:29 +00:00
|
|
|
private navigationService: NavigationService,
|
2020-02-16 22:15:07 +07:00
|
|
|
) { }
|
|
|
|
|
2023-05-11 11:38:57 -05:00
|
|
|
ngOnInit(): void {
|
2020-11-23 02:30:46 +07:00
|
|
|
this.env = this.stateService.env;
|
2020-08-02 16:00:08 +07:00
|
|
|
this.connectionState$ = this.stateService.connectionState$;
|
|
|
|
this.network$ = merge(of(''), this.stateService.networkChanged$);
|
2022-01-10 15:50:21 +04:00
|
|
|
this.urlLanguage = this.languageService.getLanguageForUrl();
|
2022-07-21 19:58:12 +02:00
|
|
|
this.subdomain = this.enterpriseService.getSubdomain();
|
2022-10-12 22:13:29 +00:00
|
|
|
this.navigationService.subnetPaths.subscribe((paths) => {
|
|
|
|
this.networkPaths = paths;
|
2023-05-11 11:38:57 -05:00
|
|
|
if (paths.mainnet.indexOf('docs') > -1) {
|
|
|
|
this.footerVisible = false;
|
|
|
|
} else {
|
|
|
|
this.footerVisible = true;
|
|
|
|
}
|
2022-10-12 22:13:29 +00:00
|
|
|
});
|
2020-02-16 22:15:07 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
collapse(): void {
|
|
|
|
this.navCollapsed = !this.navCollapsed;
|
|
|
|
}
|
2021-08-18 21:48:12 +05:30
|
|
|
|
2023-05-11 11:38:57 -05:00
|
|
|
onResize(): void {
|
2021-08-18 21:48:12 +05:30
|
|
|
this.isMobile = window.innerWidth <= 767.98;
|
|
|
|
}
|
2020-02-16 22:15:07 +07:00
|
|
|
}
|