SEO and various render fixes.

This commit is contained in:
softsimon 2022-02-06 04:18:56 +04:00
parent d33c12cdee
commit 91082f27e7
No known key found for this signature in database
GPG key ID: 488D7DCFB5A430D7
7 changed files with 14 additions and 24 deletions

View file

@ -63,6 +63,7 @@ export class AssetComponent implements OnInit, OnDestroy {
.pipe(
switchMap((params: ParamMap) => {
this.error = undefined;
this.imageError = false;
this.isLoadingAsset = true;
this.loadedConfirmedTxCount = 0;
this.asset = null;

View file

@ -32,9 +32,8 @@ export class AssetGroupComponent implements OnInit {
const items = [];
// @ts-ignore
for (const item of group.assets) {
items.push(assets[item]);
items.push(assets.objects[item]);
}
console.log(group);
return {
group: group,
assets: items

View file

@ -1,6 +1,6 @@
<div *ngIf="featuredAssets$ | async as featured; else loading" class="featuredBox">
<div *ngFor="let group of featured.featured">
<div *ngFor="let group of featured">
<div class="card">
<ng-template [ngIf]="group.assets" [ngIfElse]="singleAsset">
<img class="assetIcon" [src]="'https://liquid.network/api/v1/asset/' + group.assets[0] + '/icon'">

View file

@ -1,8 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { combineLatest, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { ApiService } from 'src/app/services/api.service';
import { AssetsService } from 'src/app/services/assets.service';
@Component({
selector: 'app-assets-featured',
@ -14,21 +12,10 @@ export class AssetsFeaturedComponent implements OnInit {
constructor(
private apiService: ApiService,
private assetsService: AssetsService,
) { }
ngOnInit(): void {
this.featuredAssets$ = combineLatest([
this.assetsService.getAssetsJson$,
this.apiService.listFeaturedAssets$(),
]).pipe(
map(([assetsJson, featured]) => {
return {
assetsJson: assetsJson,
featured: featured,
};
})
);
this.featuredAssets$ = this.apiService.listFeaturedAssets$();
}
}

View file

@ -39,6 +39,7 @@ export class AssetsNavComponent implements OnInit {
) { }
ngOnInit(): void {
this.seoService.setTitle($localize`:@@ee8f8008bae6ce3a49840c4e1d39b4af23d4c263:Assets`);
this.typeaheadSearchFn = this.typeaheadSearch;
this.searchForm = this.formBuilder.group({
@ -62,13 +63,12 @@ export class AssetsNavComponent implements OnInit {
return this.assetsService.getAssetsJson$.pipe(
map((assets) => {
if (searchText.length ) {
const filteredAssets = assets.filter((asset) => asset.name.toLowerCase().indexOf(searchText.toLowerCase()) > -1
const filteredAssets = assets.array.filter((asset) => asset.name.toLowerCase().indexOf(searchText.toLowerCase()) > -1
|| (asset.ticker || '').toLowerCase().indexOf(searchText.toLowerCase()) > -1
|| (asset.entity && asset.entity.domain || '').toLowerCase().indexOf(searchText.toLowerCase()) > -1);
assets = filteredAssets;
return filteredAssets.slice(0, this.itemsPerPage);
} else {
return assets.slice(0, this.itemsPerPage);
return assets.array.slice(0, this.itemsPerPage);
}
})
)

View file

@ -49,7 +49,7 @@ export class AssetsComponent implements OnInit {
.pipe(
take(1),
switchMap(([assets, qp]) => {
this.assets = assets;
this.assets = assets.array;
return this.route.queryParams
.pipe(

View file

@ -12,7 +12,7 @@ import { AssetExtended } from '../interfaces/electrs.interface';
export class AssetsService {
nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId;
getAssetsJson$: Observable<AssetExtended[]>;
getAssetsJson$: Observable<{ array: AssetExtended[]; objects: any}>;
getAssetsMinimalJson$: Observable<any>;
getMiningPools$: Observable<any>;
@ -47,7 +47,10 @@ export class AssetsService {
});
}
return assets.sort((a: any, b: any) => a.name.localeCompare(b.name));
return {
objects: rawAssets,
array: assets.sort((a: any, b: any) => a.name.localeCompare(b.name)),
};
}),
shareReplay(1),
);