Update title to - "<network> Explorer"

This commit is contained in:
softsimon
2020-08-12 14:04:04 +07:00
parent 2d02ec7092
commit b1c8166936
11 changed files with 22 additions and 19 deletions

View File

@@ -7,7 +7,6 @@ import { StateService } from './state.service';
})
export class SeoService {
network = '';
defaultTitle = 'mempool - Bitcoin Explorer';
constructor(
private titleService: Title,
@@ -16,15 +15,19 @@ export class SeoService {
this.stateService.networkChanged$.subscribe((network) => this.network = network);
}
setTitle(newTitle: string, prependNetwork = false) {
let networkName = '';
if (prependNetwork && this.network !== '') {
networkName = this.network.substr(0, 1).toUpperCase() + this.network.substr(1) + ' ';
}
this.titleService.setTitle(networkName + newTitle + ' - ' + this.defaultTitle);
setTitle(newTitle: string): void {
this.titleService.setTitle(newTitle + ' - ' + this.getTitle());
}
resetTitle() {
this.titleService.setTitle(this.defaultTitle);
resetTitle(): void {
this.titleService.setTitle(this.getTitle());
}
getTitle(): string {
return 'mempool - ' + (this.network ? this.ucfirst(this.network) : 'Bitcoin') + ' Explorer';
}
ucfirst(str: string) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
}