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; this.transactions = null;
document.body.scrollTo(0, 0); document.body.scrollTo(0, 0);
this.addressString = params.get('id') || ''; this.addressString = params.get('id') || '';
this.seoService.setTitle('Address: ' + this.addressString, true); this.seoService.setTitle('Address: ' + this.addressString);
return this.bisqApiService.getAddress$(this.addressString) return this.bisqApiService.getAddress$(this.addressString)
.pipe( .pipe(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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