Address index and api.

Address view.
This commit is contained in:
softsimon
2020-07-13 21:46:25 +07:00
parent 38afcc6822
commit 3bb2ce7d40
22 changed files with 295 additions and 54 deletions

View File

@@ -1,7 +1,7 @@
<div class="container-xl">
<div class="title-block">
<h1>Block <ng-template [ngIf]="blockHeight"><a [routerLink]="['/block/' | relativeUrl, blockHash]">{{ blockHeight }}</a></ng-template></h1>
<h1>Bisq Block <ng-template [ngIf]="blockHeight"><a [routerLink]="['/block/' | relativeUrl, blockHash]">{{ blockHeight }}</a></ng-template></h1>
</div>
<div class="clearfix"></div>

View File

@@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { BisqBlockComponent } from './bisq-block.component';
describe('BisqBlockComponent', () => {
let component: BisqBlockComponent;
let fixture: ComponentFixture<BisqBlockComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ BisqBlockComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(BisqBlockComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -4,6 +4,7 @@ import { BisqApiService } from '../bisq-api.service';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Subscribable, Subscription, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { SeoService } from 'src/app/services/seo.service';
@Component({
selector: 'app-bisq-block',
@@ -21,6 +22,7 @@ export class BisqBlockComponent implements OnInit, OnDestroy {
constructor(
private bisqApiService: BisqApiService,
private route: ActivatedRoute,
private seoService: SeoService,
) { }
ngOnInit(): void {
@@ -28,6 +30,7 @@ export class BisqBlockComponent implements OnInit, OnDestroy {
.pipe(
switchMap((params: ParamMap) => {
this.blockHash = params.get('id') || '';
document.body.scrollTo(0, 0);
this.isLoading = true;
if (history.state.data && history.state.data.blockHeight) {
this.blockHeight = history.state.data.blockHeight;
@@ -42,6 +45,7 @@ export class BisqBlockComponent implements OnInit, OnDestroy {
.subscribe((block: BisqBlock) => {
this.isLoading = false;
this.blockHeight = block.height;
this.seoService.setTitle('Block: #' + block.height + ': ' + block.hash, true);
this.block = block;
});
}