Update title to - "<network> Explorer"
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user