Refactor. API explanations. UX revamp.

This commit is contained in:
Simon Lindh
2020-02-17 20:39:20 +07:00
committed by wiz
parent 45fa1be217
commit 98391580b3
40 changed files with 474 additions and 210 deletions

View File

@@ -0,0 +1,20 @@
<div class="container">
<br>
<ul class="nav nav-tabs mb-2">
<li class="nav-item">
<a class="nav-link" [class.active]="view === 'blocks'" routerLink="/explorer" (click)="view = 'blocks'">Blocks</a>
</li>
<li class="nav-item">
<a class="nav-link" [class.active]="view === 'transactions'" routerLink="/explorer" fragment="transactions" (click)="view = 'transactions'">Transactions</a>
</li>
</ul>
<app-latest-blocks *ngIf="view === 'blocks'; else latestTransactions"></app-latest-blocks>
<ng-template #latestTransactions>
<app-latest-transactions></app-latest-transactions>
</ng-template>
</div>
<br>

View File

@@ -0,0 +1,3 @@
.search-container {
padding-top: 50px;
}

View File

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

View File

@@ -0,0 +1,25 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-explorer',
templateUrl: './explorer.component.html',
styleUrls: ['./explorer.component.scss']
})
export class ExplorerComponent implements OnInit {
view: 'blocks' | 'transactions' = 'blocks';
constructor(
private route: ActivatedRoute,
) {}
ngOnInit() {
this.route.fragment
.subscribe((fragment: string) => {
if (fragment === 'transactions' ) {
this.view = 'transactions';
}
});
}
}