Update title to - "<network> Explorer"

This commit is contained in:
softsimon 2020-08-12 14:04:04 +07:00
parent 2d02ec7092
commit b1c8166936
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
11 changed files with 22 additions and 19 deletions

View File

@ -36,7 +36,7 @@ export class BisqAddressComponent implements OnInit, OnDestroy {
this.transactions = null;
document.body.scrollTo(0, 0);
this.addressString = params.get('id') || '';
this.seoService.setTitle('Address: ' + this.addressString, true);
this.seoService.setTitle('Address: ' + this.addressString);
return this.bisqApiService.getAddress$(this.addressString)
.pipe(

View File

@ -82,7 +82,7 @@ export class BisqBlockComponent implements OnInit, OnDestroy {
}
this.isLoading = false;
this.blockHeight = block.height;
this.seoService.setTitle('Block: #' + block.height + ': ' + block.hash, true);
this.seoService.setTitle('Block: #' + block.height + ': ' + block.hash);
this.block = block;
});
}

View File

@ -33,7 +33,7 @@ export class BisqBlocksComponent implements OnInit {
) { }
ngOnInit(): void {
this.seoService.setTitle('Blocks', true);
this.seoService.setTitle('Blocks');
this.itemsPerPage = Math.max(Math.round(this.contentSpace / this.fiveItemsPxSize) * 5, 10);
this.loadingItems = Array(this.itemsPerPage);
if (document.body.clientWidth < 768) {

View File

@ -21,7 +21,7 @@ export class BisqStatsComponent implements OnInit {
) { }
ngOnInit() {
this.seoService.setTitle('BSQ Statistics', false);
this.seoService.setTitle('BSQ Statistics');
this.stateService.bsqPrice$
.subscribe((bsqPrice) => {

View File

@ -43,7 +43,7 @@ export class BisqTransactionComponent implements OnInit, OnDestroy {
this.error = null;
document.body.scrollTo(0, 0);
this.txId = params.get('id') || '';
this.seoService.setTitle('Transaction: ' + this.txId, true);
this.seoService.setTitle('Transaction: ' + this.txId);
if (history.state.data) {
return of(history.state.data);
}

View File

@ -72,7 +72,7 @@ export class BisqTransactionsComponent implements OnInit {
) { }
ngOnInit(): void {
this.seoService.setTitle('Transactions', true);
this.seoService.setTitle('Transactions');
this.radioGroupForm = this.formBuilder.group({
txTypes: [this.txTypesDefaultChecked],

View File

@ -61,7 +61,7 @@ export class AddressComponent implements OnInit, OnDestroy {
this.transactions = null;
document.body.scrollTo(0, 0);
this.addressString = params.get('id') || '';
this.seoService.setTitle('Address: ' + this.addressString, true);
this.seoService.setTitle('Address: ' + this.addressString);
return merge(
of(true),

View File

@ -68,7 +68,7 @@ export class AssetComponent implements OnInit, OnDestroy {
this.transactions = null;
document.body.scrollTo(0, 0);
this.assetString = params.get('id') || '';
this.seoService.setTitle('Asset: ' + this.assetString, true);
this.seoService.setTitle('Asset: ' + this.assetString);
return merge(
of(true),

View File

@ -92,7 +92,7 @@ export class BlockComponent implements OnInit, OnDestroy {
tap((block: Block) => {
this.block = block;
this.blockHeight = block.height;
this.seoService.setTitle('Block: #' + block.height + ': ' + block.id, true);
this.seoService.setTitle('Block: #' + block.height + ': ' + block.id);
this.isLoadingBlock = false;
if (block.coinbaseTx) {
this.coinbaseTx = block.coinbaseTx;

View File

@ -44,7 +44,7 @@ export class TransactionComponent implements OnInit, OnDestroy {
this.subscription = this.route.paramMap.pipe(
switchMap((params: ParamMap) => {
this.txId = params.get('id') || '';
this.seoService.setTitle('Transaction: ' + this.txId, true);
this.seoService.setTitle('Transaction: ' + this.txId);
this.resetTransaction();
return merge(
of(true),

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);
}
}